powersync 0.9.2 → 0.9.3
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/README.md +103 -74
- package/bin/dev.js +7 -1
- package/dist/api/BaseDeployCommand.d.ts +39 -0
- package/dist/api/BaseDeployCommand.js +230 -0
- package/dist/api/BaseDeployCommand.js.map +1 -0
- package/dist/api/build-service-yaml.d.ts +29 -0
- package/dist/api/build-service-yaml.js +246 -0
- package/dist/api/build-service-yaml.js.map +1 -0
- package/dist/api/cloud/create-cloud-instance.js +1 -0
- package/dist/api/cloud/create-cloud-instance.js.map +1 -0
- package/dist/api/cloud/create-cloud-template.d.ts +15 -0
- package/dist/api/cloud/create-cloud-template.js +33 -0
- package/dist/api/cloud/create-cloud-template.js.map +1 -0
- package/dist/api/cloud/fetch-cloud-config.js +1 -0
- package/dist/api/cloud/fetch-cloud-config.js.map +1 -0
- package/dist/api/cloud/fetch-cloud-sync-rules-content.js +6 -7
- package/dist/api/cloud/fetch-cloud-sync-rules-content.js.map +1 -0
- package/dist/api/cloud/test-connection.js +3 -3
- package/dist/api/cloud/test-connection.js.map +1 -0
- package/dist/api/cloud/validate-cloud-link-config.js +1 -0
- package/dist/api/cloud/validate-cloud-link-config.js.map +1 -0
- package/dist/api/cloud/wait-for-operation.js +1 -0
- package/dist/api/cloud/wait-for-operation.js.map +1 -0
- package/dist/api/cloud/write-cloud-link.js +1 -0
- package/dist/api/cloud/write-cloud-link.js.map +1 -0
- package/dist/api/display-status.js +1 -0
- package/dist/api/display-status.js.map +1 -0
- package/dist/api/ide/configure-vscode-ide.js +1 -0
- package/dist/api/ide/configure-vscode-ide.js.map +1 -0
- package/dist/api/login-server.js +1 -0
- package/dist/api/login-server.js.map +1 -0
- package/dist/api/parse-local-cloud-service-config.d.ts +13 -0
- package/dist/api/parse-local-cloud-service-config.js +35 -0
- package/dist/api/parse-local-cloud-service-config.js.map +1 -0
- package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js +7 -8
- package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js.map +1 -0
- package/dist/api/validations/ValidationTestDefinition.d.ts +23 -0
- package/dist/api/validations/ValidationTestDefinition.js +10 -0
- package/dist/api/validations/ValidationTestDefinition.js.map +1 -0
- package/dist/api/validations/ValidationsRunner.d.ts +35 -0
- package/dist/api/validations/ValidationsRunner.js +82 -0
- package/dist/api/validations/ValidationsRunner.js.map +1 -0
- package/dist/api/validations/cloud-validations.d.ts +15 -0
- package/dist/api/validations/cloud-validations.js +120 -0
- package/dist/api/validations/cloud-validations.js.map +1 -0
- package/dist/api/validations/self-hosted-validations.d.ts +7 -0
- package/dist/api/validations/self-hosted-validations.js +25 -0
- package/dist/api/validations/self-hosted-validations.js.map +1 -0
- package/dist/api/validations/validation-flags.d.ts +38 -0
- package/dist/api/validations/validation-flags.js +77 -0
- package/dist/api/validations/validation-flags.js.map +1 -0
- package/dist/api/validations/validation-utils.d.ts +46 -0
- package/dist/api/validations/validation-utils.js +154 -0
- package/dist/api/validations/validation-utils.js.map +1 -0
- package/dist/api/validations/validations.d.ts +15 -0
- package/dist/api/validations/validations.js +102 -0
- package/dist/api/validations/validations.js.map +1 -0
- package/dist/commands/configure/ide.js +1 -0
- package/dist/commands/configure/ide.js.map +1 -0
- package/dist/commands/configure/index.js +1 -0
- package/dist/commands/configure/index.js.map +1 -0
- package/dist/commands/deploy/index.d.ts +5 -41
- package/dist/commands/deploy/index.js +69 -279
- package/dist/commands/deploy/index.js.map +1 -0
- package/dist/commands/deploy/service-config.d.ts +3 -7
- package/dist/commands/deploy/service-config.js +30 -7
- package/dist/commands/deploy/service-config.js.map +1 -0
- package/dist/commands/deploy/sync-config.d.ts +5 -8
- package/dist/commands/deploy/sync-config.js +43 -20
- package/dist/commands/deploy/sync-config.js.map +1 -0
- package/dist/commands/destroy.d.ts +0 -4
- package/dist/commands/destroy.js +2 -2
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/fetch/config.d.ts +0 -4
- package/dist/commands/fetch/config.js +2 -2
- package/dist/commands/fetch/config.js.map +1 -0
- package/dist/commands/fetch/index.js +1 -0
- package/dist/commands/fetch/index.js.map +1 -0
- package/dist/commands/fetch/instances.js +1 -0
- package/dist/commands/fetch/instances.js.map +1 -0
- package/dist/commands/fetch/status.d.ts +0 -5
- package/dist/commands/fetch/status.js +2 -2
- package/dist/commands/fetch/status.js.map +1 -0
- package/dist/commands/generate/index.js +1 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/generate/schema.d.ts +3 -6
- package/dist/commands/generate/schema.js +5 -5
- package/dist/commands/generate/schema.js.map +1 -0
- package/dist/commands/generate/token.d.ts +0 -5
- package/dist/commands/generate/token.js +2 -2
- package/dist/commands/generate/token.js.map +1 -0
- package/dist/commands/init/cloud.d.ts +0 -3
- package/dist/commands/init/cloud.js +21 -18
- package/dist/commands/init/cloud.js.map +1 -0
- package/dist/commands/init/index.js +1 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/self-hosted.d.ts +0 -3
- package/dist/commands/init/self-hosted.js +29 -6
- package/dist/commands/init/self-hosted.js.map +1 -0
- package/dist/commands/link/cloud.d.ts +0 -1
- package/dist/commands/link/cloud.js +3 -3
- package/dist/commands/link/cloud.js.map +1 -0
- package/dist/commands/link/index.js +1 -0
- package/dist/commands/link/index.js.map +1 -0
- package/dist/commands/link/self-hosted.d.ts +0 -1
- package/dist/commands/link/self-hosted.js +3 -3
- package/dist/commands/link/self-hosted.js.map +1 -0
- package/dist/commands/login.js +1 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.js +1 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/migrate/index.js +1 -0
- package/dist/commands/migrate/index.js.map +1 -0
- package/dist/commands/migrate/sync-rules.d.ts +0 -5
- package/dist/commands/migrate/sync-rules.js +2 -2
- package/dist/commands/migrate/sync-rules.js.map +1 -0
- package/dist/commands/pull/index.js +1 -0
- package/dist/commands/pull/index.js.map +1 -0
- package/dist/commands/pull/instance.d.ts +1 -4
- package/dist/commands/pull/instance.js +26 -12
- package/dist/commands/pull/instance.js.map +1 -0
- package/dist/commands/status.js +1 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +0 -4
- package/dist/commands/stop.js +2 -2
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/validate.d.ts +4 -8
- package/dist/commands/validate.js +50 -128
- package/dist/commands/validate.js.map +1 -0
- package/dist/help.js +1 -0
- package/dist/help.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/oclif.manifest.json +263 -161
- package/package.json +10 -9
- package/templates/cloud/powersync/service.template.yaml +164 -0
- package/templates/self-hosted/base/powersync/service.template.yaml +209 -0
- package/dist/api/run-validation-tests.d.ts +0 -63
- package/dist/api/run-validation-tests.js +0 -202
- package/templates/cloud/powersync/service.yaml +0 -174
- package/templates/self-hosted/base/powersync/service.yaml +0 -243
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# PowerSync Cloud config – source-of-truth template with all schema options as valid YAML.
|
|
2
|
+
# Docs: https://docs.powersync.com/sync/overview
|
|
3
|
+
|
|
4
|
+
# [required] Service type identifier.
|
|
5
|
+
_type: cloud
|
|
6
|
+
|
|
7
|
+
# [required] Instance name for display in the PowerSync Cloud dashboard.
|
|
8
|
+
name: my-cli-instance
|
|
9
|
+
|
|
10
|
+
# [required] Deployment region, e.g. us. Cannot be changed after initial deployment.
|
|
11
|
+
region: us
|
|
12
|
+
|
|
13
|
+
# -------------------------------------------------------------------------
|
|
14
|
+
# Replication (required): database connections for sync
|
|
15
|
+
# Note: only a single connection is currently supported.
|
|
16
|
+
# Connection: `uri` and `password` are required for a complete connection. Alternatively omit `uri`
|
|
17
|
+
# and provide individual fields (hostname, port, database, username, password, etc.); they are used
|
|
18
|
+
# to construct the connection URI. For MongoDB, `uri` is required.
|
|
19
|
+
# -------------------------------------------------------------------------
|
|
20
|
+
replication:
|
|
21
|
+
connections:
|
|
22
|
+
# -------------------------------------------------------------------------
|
|
23
|
+
# PostgreSQL – uncomment this entire block to use
|
|
24
|
+
# -------------------------------------------------------------------------
|
|
25
|
+
- type: postgresql
|
|
26
|
+
# [optional] Connection string (recommended). Omit and use hostname/port/database/username/password instead.
|
|
27
|
+
uri: postgresql://user:pass@host:5432/dbname
|
|
28
|
+
password:
|
|
29
|
+
secret: !env POWERSYNC_DATABASE_PASSWORD
|
|
30
|
+
# [optional] Alternative to uri: individual connection parameters.
|
|
31
|
+
hostname: example.com
|
|
32
|
+
port: 5432
|
|
33
|
+
database: one
|
|
34
|
+
username: postgres
|
|
35
|
+
# [optional] Connection identifiers.
|
|
36
|
+
name: string
|
|
37
|
+
id: string
|
|
38
|
+
tag: string
|
|
39
|
+
# [optional] TLS mode. Options: verify-full | verify-ca. Default: verify-full. Use verify-full for production.
|
|
40
|
+
sslmode: verify-full
|
|
41
|
+
# [optional] TLS certificates (PEM). Required for verify-ca; optional for verify-full.
|
|
42
|
+
cacert: string
|
|
43
|
+
client_certificate: string
|
|
44
|
+
client_private_key:
|
|
45
|
+
secret: !env POWERSYNC_DATABASE_CLIENT_KEY
|
|
46
|
+
# [optional] Cloud VPC endpoint hostname.
|
|
47
|
+
vpc_endpoint_hostname: string
|
|
48
|
+
|
|
49
|
+
# -------------------------------------------------------------------------
|
|
50
|
+
# MongoDB – uncomment this entire block to use (comment out PostgreSQL above).
|
|
51
|
+
# uri is required for MongoDB; other fields are optional.
|
|
52
|
+
# -------------------------------------------------------------------------
|
|
53
|
+
- type: mongodb
|
|
54
|
+
# [required for MongoDB] Connection string.
|
|
55
|
+
uri: mongodb+srv://user:pass@host/db
|
|
56
|
+
password:
|
|
57
|
+
secret: !env POWERSYNC_MONGODB_PASSWORD
|
|
58
|
+
# [optional] Connection parameters (if not in URI).
|
|
59
|
+
username: string
|
|
60
|
+
database: string
|
|
61
|
+
# [optional] Connection identifiers.
|
|
62
|
+
name: string
|
|
63
|
+
id: string
|
|
64
|
+
tag: string
|
|
65
|
+
# [optional] Change-data-capture mode. Options: off | auto_configure | read_only. Default: off.
|
|
66
|
+
post_images: off
|
|
67
|
+
# [optional] Cloud VPC endpoint hostname.
|
|
68
|
+
vpc_endpoint_hostname: string
|
|
69
|
+
|
|
70
|
+
# -------------------------------------------------------------------------
|
|
71
|
+
# MySQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
72
|
+
# -------------------------------------------------------------------------
|
|
73
|
+
- type: mysql
|
|
74
|
+
# [optional] Connection string. Omit and use hostname/port/database/username/password instead.
|
|
75
|
+
uri: string
|
|
76
|
+
password:
|
|
77
|
+
secret: !env POWERSYNC_MYSQL_PASSWORD
|
|
78
|
+
# [optional] Alternative to uri: individual connection parameters.
|
|
79
|
+
hostname: db.example.com
|
|
80
|
+
port: 3306
|
|
81
|
+
database: mydb
|
|
82
|
+
username: sync
|
|
83
|
+
# [optional] Connection identifiers.
|
|
84
|
+
name: string
|
|
85
|
+
id: string
|
|
86
|
+
tag: string
|
|
87
|
+
# [optional] TLS client certificate and key (PEM).
|
|
88
|
+
client_certificate: string
|
|
89
|
+
client_private_key:
|
|
90
|
+
secret: !env POWERSYNC_MYSQL_CLIENT_KEY
|
|
91
|
+
|
|
92
|
+
# -------------------------------------------------------------------------
|
|
93
|
+
# MSSQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
94
|
+
# -------------------------------------------------------------------------
|
|
95
|
+
- type: mssql
|
|
96
|
+
# [optional] Connection string. Omit and use hostname/port/database/schema/username/password instead.
|
|
97
|
+
uri: string
|
|
98
|
+
password:
|
|
99
|
+
secret: !env POWERSYNC_MSSQL_PASSWORD
|
|
100
|
+
# [optional] Alternative to uri: individual connection parameters.
|
|
101
|
+
hostname: sql.example.com
|
|
102
|
+
port: 1433
|
|
103
|
+
database: mydb
|
|
104
|
+
schema: dbo
|
|
105
|
+
username: sync
|
|
106
|
+
# [optional] Connection identifiers.
|
|
107
|
+
name: string
|
|
108
|
+
id: string
|
|
109
|
+
tag: string
|
|
110
|
+
# [optional] Auth type. Options: default | azure-active-directory-password | azure-active-directory-service-principal-secret.
|
|
111
|
+
authentication:
|
|
112
|
+
type: default
|
|
113
|
+
options:
|
|
114
|
+
password:
|
|
115
|
+
secret: !env POWERSYNC_MSSQL_PASSWORD
|
|
116
|
+
# [optional] Polling and TLS options.
|
|
117
|
+
additionalConfig:
|
|
118
|
+
pollingIntervalMs: 5000
|
|
119
|
+
pollingBatchSize: 1000
|
|
120
|
+
trustServerCertificate: false
|
|
121
|
+
|
|
122
|
+
# -----------------------------------------------------------------------------
|
|
123
|
+
# CLIENT AUTH (optional) – uncomment this entire block to enable
|
|
124
|
+
# -----------------------------------------------------------------------------
|
|
125
|
+
client_auth:
|
|
126
|
+
# [optional] Use the same JWT secret as Supabase. Default: false.
|
|
127
|
+
supabase: false
|
|
128
|
+
# [optional] Legacy: Supabase project's legacy JWT secret from API settings in the Supabase Dashboard.
|
|
129
|
+
supabase_jwt_secret:
|
|
130
|
+
secret: !env POWERSYNC_SUPABASE_JWT_SECRET
|
|
131
|
+
# [optional] JWKS URL; instance fetches public keys to verify JWT signatures.
|
|
132
|
+
jwks_uri: https://example.com/jwks.json
|
|
133
|
+
# [optional] Inline JWKS; provide keys directly instead of or in addition to jwks_uri.
|
|
134
|
+
jwks:
|
|
135
|
+
keys:
|
|
136
|
+
# HMAC (symmetric) – Options: HS256 | HS384 | HS512
|
|
137
|
+
- kty: oct
|
|
138
|
+
alg: HS256
|
|
139
|
+
kid: example-key
|
|
140
|
+
k:
|
|
141
|
+
secret: !env POWERSYNC_CLIENT_AUTH_KEY
|
|
142
|
+
# RSA – Options for alg: RS256 | RS384 | RS512
|
|
143
|
+
- kty: RSA
|
|
144
|
+
kid: my-rsa-key
|
|
145
|
+
n: '<base64url-modulus>'
|
|
146
|
+
e: '<base64url-exponent>'
|
|
147
|
+
alg: RS256
|
|
148
|
+
# EC – Options for crv: P-256 | P-384 | P-512; alg: ES256 | ES384 | ES512
|
|
149
|
+
- kty: EC
|
|
150
|
+
kid: my-ec-key
|
|
151
|
+
crv: P-256
|
|
152
|
+
x: '<base64url-x>'
|
|
153
|
+
y: '<base64url-y>'
|
|
154
|
+
alg: ES256
|
|
155
|
+
# OKP (EdDSA) – Options for crv: Ed25519 | Ed448
|
|
156
|
+
- kty: OKP
|
|
157
|
+
kid: my-okp-key
|
|
158
|
+
crv: Ed25519
|
|
159
|
+
x: '<base64url-public-key>'
|
|
160
|
+
alg: EdDSA
|
|
161
|
+
# [optional] Additional audiences to accept (instance domain is always accepted). Default: [].
|
|
162
|
+
additional_audiences: []
|
|
163
|
+
# [optional] Allow development/temporary tokens. Default: false.
|
|
164
|
+
allow_temporary_tokens: false
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# PowerSync self-hosted config – source-of-truth template with all schema options as valid YAML.
|
|
2
|
+
# Docs: https://docs.powersync.com/self-hosting
|
|
3
|
+
|
|
4
|
+
# [required] Service type identifier.
|
|
5
|
+
_type: self-hosted
|
|
6
|
+
|
|
7
|
+
# [optional] Telemetry configuration for service monitoring.
|
|
8
|
+
# See https://docs.powersync.com/self-hosting/telemetry
|
|
9
|
+
telemetry:
|
|
10
|
+
# When true, disables sharing of anonymized telemetry data. Default: false.
|
|
11
|
+
disable_telemetry_sharing: false
|
|
12
|
+
|
|
13
|
+
# -----------------------------------------------------------------------------
|
|
14
|
+
# [required] REPLICATION – configuration for data replication; array of data source connections
|
|
15
|
+
# Connection: `uri` and `password` are required for a complete connection. Alternatively omit `uri`
|
|
16
|
+
# and provide individual fields (hostname, port, database, username, password, etc.); they are used
|
|
17
|
+
# to construct the connection URI. For MongoDB, `uri` is required.
|
|
18
|
+
# -----------------------------------------------------------------------------
|
|
19
|
+
replication:
|
|
20
|
+
connections:
|
|
21
|
+
# -------------------------------------------------------------------------
|
|
22
|
+
# PostgreSQL – uncomment this entire block to use
|
|
23
|
+
# -------------------------------------------------------------------------
|
|
24
|
+
- type: postgresql
|
|
25
|
+
# [optional] Connection string (recommended). Omit and use hostname/port/database/username/password instead.
|
|
26
|
+
uri: !env PS_DATA_SOURCE_URI
|
|
27
|
+
password: !env PS_DATABASE_PASSWORD
|
|
28
|
+
# [optional] Alternative to uri: individual connection parameters.
|
|
29
|
+
hostname: string
|
|
30
|
+
port: 5432
|
|
31
|
+
database: string
|
|
32
|
+
username: string
|
|
33
|
+
# [optional] Connection identifiers.
|
|
34
|
+
id: string
|
|
35
|
+
tag: string
|
|
36
|
+
# [optional] TLS mode. Options: verify-full | verify-ca | disable. Default: verify-full for production; disable is for local/private networks only.
|
|
37
|
+
sslmode: disable
|
|
38
|
+
# [optional] TLS certificates (PEM). Required for verify-ca; optional for verify-full.
|
|
39
|
+
cacert: string
|
|
40
|
+
client_certificate: string
|
|
41
|
+
client_private_key: string
|
|
42
|
+
# [optional] TLS SNI when connecting.
|
|
43
|
+
tls_servername: string
|
|
44
|
+
# [optional] IP ranges to reject for this connection.
|
|
45
|
+
reject_ip_ranges: []
|
|
46
|
+
# [optional] Replication slot name prefix.
|
|
47
|
+
slot_name_prefix: string
|
|
48
|
+
# [optional] Maximum connection pool size.
|
|
49
|
+
max_pool_size: 8
|
|
50
|
+
|
|
51
|
+
# -------------------------------------------------------------------------
|
|
52
|
+
# MongoDB – uncomment this entire block to use (comment out PostgreSQL above).
|
|
53
|
+
# uri is required for MongoDB; other fields are optional.
|
|
54
|
+
# -------------------------------------------------------------------------
|
|
55
|
+
- type: mongodb
|
|
56
|
+
# [required for MongoDB] Connection string.
|
|
57
|
+
uri: !env PS_MONGODB_URI
|
|
58
|
+
password: !env PS_MONGODB_PASSWORD
|
|
59
|
+
# [optional] Connection parameters (if not in URI).
|
|
60
|
+
username: string
|
|
61
|
+
database: string
|
|
62
|
+
# [optional] Connection identifiers.
|
|
63
|
+
id: string
|
|
64
|
+
tag: string
|
|
65
|
+
# [optional] IP ranges to reject for this connection.
|
|
66
|
+
reject_ip_ranges: []
|
|
67
|
+
# [optional] Change-data-capture mode. Options: off | auto_configure | read_only. Default: off.
|
|
68
|
+
post_images: off
|
|
69
|
+
|
|
70
|
+
# -------------------------------------------------------------------------
|
|
71
|
+
# MySQL – uncomment this entire block to use (comment out PostgreSQL above).
|
|
72
|
+
# -------------------------------------------------------------------------
|
|
73
|
+
- type: mysql
|
|
74
|
+
# [optional] Connection string. Omit and use hostname/port/database/username/password instead.
|
|
75
|
+
uri: !env PS_MYSQL_URI
|
|
76
|
+
password: !env PS_MYSQL_PASSWORD
|
|
77
|
+
# [optional] Alternative to uri: individual connection parameters.
|
|
78
|
+
hostname: db.example.com
|
|
79
|
+
port: 3306
|
|
80
|
+
database: mydb
|
|
81
|
+
username: sync
|
|
82
|
+
# [optional] Connection identifiers.
|
|
83
|
+
id: string
|
|
84
|
+
tag: string
|
|
85
|
+
# [optional] MySQL server ID for replication.
|
|
86
|
+
server_id: 1
|
|
87
|
+
# [optional] TLS: CA cert and client cert/key (PEM).
|
|
88
|
+
cacert: string
|
|
89
|
+
client_certificate: string
|
|
90
|
+
client_private_key: string
|
|
91
|
+
# [optional] IP ranges to reject for this connection.
|
|
92
|
+
reject_ip_ranges: []
|
|
93
|
+
# [optional] Binlog queue memory limit.
|
|
94
|
+
binlog_queue_memory_limit: 67108864
|
|
95
|
+
|
|
96
|
+
# -----------------------------------------------------------------------------
|
|
97
|
+
# Sync Storage – configuration for the storage backend. MongoDB and Postgres are supported.
|
|
98
|
+
# A MongoDB example is provided below.
|
|
99
|
+
# -----------------------------------------------------------------------------
|
|
100
|
+
storage:
|
|
101
|
+
# MongoDB storage backend
|
|
102
|
+
type: mongodb
|
|
103
|
+
# [required] Connection string for MongoDB storage.
|
|
104
|
+
uri: !env PS_MONGO_URI
|
|
105
|
+
# [optional] Connection parameters (if not in URI).
|
|
106
|
+
database: string
|
|
107
|
+
username: string
|
|
108
|
+
password: !env PS_MONGO_PASSWORD
|
|
109
|
+
# [optional] IP ranges to reject for this connection.
|
|
110
|
+
reject_ip_ranges: []
|
|
111
|
+
|
|
112
|
+
# -----------------------------------------------------------------------------
|
|
113
|
+
# [optional] PORT – the port on which the service will listen for connections (number or string)
|
|
114
|
+
# -----------------------------------------------------------------------------
|
|
115
|
+
port: !env PS_PORT
|
|
116
|
+
|
|
117
|
+
# -----------------------------------------------------------------------------
|
|
118
|
+
# SYNC CONFIG – configuration for Sync Streams/Sync Rules that define which data is synced to each user.
|
|
119
|
+
# -----------------------------------------------------------------------------
|
|
120
|
+
# One of path or content is supported. path is the most common (file reference).
|
|
121
|
+
sync_config:
|
|
122
|
+
# Path to the sync config YAML file (sync rules).
|
|
123
|
+
path: sync-config.yaml
|
|
124
|
+
# [optional] Inline sync config content as a string; use this or path, not both.
|
|
125
|
+
content: string
|
|
126
|
+
# [optional] When true, exit the process if sync config fails to parse. Default: false.
|
|
127
|
+
exit_on_error: false
|
|
128
|
+
|
|
129
|
+
# -----------------------------------------------------------------------------
|
|
130
|
+
# CLIENT AUTH (optional) – configuration for client authentication mechanisms
|
|
131
|
+
# -----------------------------------------------------------------------------
|
|
132
|
+
client_auth:
|
|
133
|
+
# [optional] Use the same JWT secret as Supabase. Default: false.
|
|
134
|
+
supabase: false
|
|
135
|
+
# [optional] Legacy: Supabase project's legacy JWT secret from API settings in the Supabase Dashboard.
|
|
136
|
+
supabase_jwt_secret: !env PS_SUPABASE_JWT_SECRET
|
|
137
|
+
# [optional] JWKS URL or array of URLs; instance fetches public keys to verify JWT signatures.
|
|
138
|
+
jwks_uri: https://example.com/jwks.json
|
|
139
|
+
# [optional] Inline JWKS; provide keys directly instead of or in addition to jwks_uri.
|
|
140
|
+
jwks:
|
|
141
|
+
keys:
|
|
142
|
+
# HMAC (symmetric) – Options: HS256 | HS384 | HS512
|
|
143
|
+
- kty: oct
|
|
144
|
+
alg: HS256
|
|
145
|
+
kid: example-key
|
|
146
|
+
k: !env PS_CLIENT_AUTH_KEY
|
|
147
|
+
# RSA – Options for alg: RS256 | RS384 | RS512
|
|
148
|
+
- kty: RSA
|
|
149
|
+
kid: my-rsa-key
|
|
150
|
+
n: '<base64url-modulus>'
|
|
151
|
+
e: '<base64url-exponent>'
|
|
152
|
+
alg: RS256
|
|
153
|
+
# EC – Options for crv: P-256 | P-384 | P-512; alg: ES256 | ES384 | ES512
|
|
154
|
+
- kty: EC
|
|
155
|
+
kid: my-ec-key
|
|
156
|
+
crv: P-256
|
|
157
|
+
x: '<base64url-x>'
|
|
158
|
+
y: '<base64url-y>'
|
|
159
|
+
alg: ES256
|
|
160
|
+
# OKP (EdDSA) – Options for crv: Ed25519 | Ed448
|
|
161
|
+
- kty: OKP
|
|
162
|
+
kid: my-okp-key
|
|
163
|
+
crv: Ed25519
|
|
164
|
+
x: '<base64url-public-key>'
|
|
165
|
+
alg: EdDSA
|
|
166
|
+
# [optional] Valid audiences for JWT validation.
|
|
167
|
+
audience:
|
|
168
|
+
- authenticated
|
|
169
|
+
# [optional] When true, block JWKS URIs that resolve to local network addresses. Default: false.
|
|
170
|
+
block_local_jwks: false
|
|
171
|
+
# [optional] IP ranges to reject when resolving JWKS URIs.
|
|
172
|
+
jwks_reject_ip_ranges: []
|
|
173
|
+
|
|
174
|
+
# -----------------------------------------------------------------------------
|
|
175
|
+
# [optional] API – API service configuration and parameters
|
|
176
|
+
# -----------------------------------------------------------------------------
|
|
177
|
+
api:
|
|
178
|
+
# API access tokens for administrative operations (e.g. CLI link). Use a strong token in production.
|
|
179
|
+
tokens:
|
|
180
|
+
- use_a_better_token_in_production
|
|
181
|
+
# [optional] Performance and safety parameters.
|
|
182
|
+
parameters:
|
|
183
|
+
# Max connections (HTTP/websocket) per API process.
|
|
184
|
+
max_concurrent_connections: 200
|
|
185
|
+
# Should not exceed storage.max_pool_size.
|
|
186
|
+
max_data_fetch_concurrency: 10
|
|
187
|
+
# Hard limit; service errors if exceeded.
|
|
188
|
+
max_buckets_per_connection: 1000
|
|
189
|
+
# Limit before converting to unique set.
|
|
190
|
+
max_parameter_query_results: 1000
|
|
191
|
+
|
|
192
|
+
# -----------------------------------------------------------------------------
|
|
193
|
+
# [optional] HEALTHCHECK – mechanisms for exposing health check data
|
|
194
|
+
# -----------------------------------------------------------------------------
|
|
195
|
+
healthcheck:
|
|
196
|
+
probes:
|
|
197
|
+
# [optional] Expose healthcheck status via filesystem files.
|
|
198
|
+
use_filesystem: false
|
|
199
|
+
# [optional] Expose healthcheck status via HTTP endpoints.
|
|
200
|
+
use_http: false
|
|
201
|
+
# [optional] Deprecated: HTTP probes for API and UNIFIED; filesystem probes are always enabled.
|
|
202
|
+
use_legacy: false
|
|
203
|
+
|
|
204
|
+
# -----------------------------------------------------------------------------
|
|
205
|
+
# [optional] MIGRATIONS – configuration for database schema migrations
|
|
206
|
+
# -----------------------------------------------------------------------------
|
|
207
|
+
migrations:
|
|
208
|
+
# When true, disables automatic storage schema migrations; start them manually. Default: false.
|
|
209
|
+
disable_auto_migration: false
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { CloudProject, SelfHostedProject, SyncValidationTestRunResult, ValidationResult, ValidationTestRunResult } from '@powersync/cli-core';
|
|
2
|
-
/** Indentation used for nested human-readable output rows. */
|
|
3
|
-
export declare const INDENT = " ";
|
|
4
|
-
/** Bullet character used for list rows in human-readable output. */
|
|
5
|
-
export declare const BULLET = "\u2022";
|
|
6
|
-
/**
|
|
7
|
-
* Definition of a test: display name and async runner function.
|
|
8
|
-
*/
|
|
9
|
-
export type ValidationTestDef = {
|
|
10
|
-
name: string;
|
|
11
|
-
run: () => Promise<ValidationTestRunResult>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Runtime test entry, storing the in-flight promise and optional settled result.
|
|
15
|
-
*/
|
|
16
|
-
export type ValidationTestEntry = {
|
|
17
|
-
name: string;
|
|
18
|
-
promise: Promise<ValidationTestRunResult>;
|
|
19
|
-
result?: ValidationTestRunResult;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Named test buckets used by the validate command.
|
|
23
|
-
*/
|
|
24
|
-
export declare enum Tests {
|
|
25
|
-
CONFIGURATION_SCHEMA = "Validate Configuration Schema",
|
|
26
|
-
SYNC_RULES = "Validate Sync Config",
|
|
27
|
-
TEST_CONNECTIONS = "Test Connections"
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Formats spinner text showing per-test progress while tests are running.
|
|
31
|
-
* These logs are indeted with bullets for readability, and update in-place as each test settles to show pass/fail status.
|
|
32
|
-
*/
|
|
33
|
-
export declare function formatOraMessage(entries: ValidationTestEntry[]): string;
|
|
34
|
-
/**
|
|
35
|
-
* Formats suite output for `--output=human`.
|
|
36
|
-
*/
|
|
37
|
-
export declare function formatValidationHuman(result: ValidationResult): string;
|
|
38
|
-
/**
|
|
39
|
-
* Formats suite output for `--output=json`.
|
|
40
|
-
*/
|
|
41
|
-
export declare function formatValidationJson(result: ValidationResult): string;
|
|
42
|
-
/**
|
|
43
|
-
* Formats suite output for `--output=yaml`.
|
|
44
|
-
*/
|
|
45
|
-
export declare function formatValidationYaml(result: ValidationResult): string;
|
|
46
|
-
/**
|
|
47
|
-
* Renders a warning into two lines for human output:
|
|
48
|
-
* 1) gray source fragment
|
|
49
|
-
* 2) yellow `[warning] line:column` prefix followed by plain message text
|
|
50
|
-
*/
|
|
51
|
-
export declare function renderWarningForHumanOutput(warning: string): string[];
|
|
52
|
-
/**
|
|
53
|
-
* Validates `service.yaml` against the cloud or self-hosted schema, depending on project type.
|
|
54
|
-
*/
|
|
55
|
-
export declare function runConfigTest(projectDir: string, isCloud: boolean): Promise<ValidationTestRunResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Runs cloud sync-rules validation and maps diagnostics into warning/error message arrays.
|
|
58
|
-
*/
|
|
59
|
-
export declare function runSyncRulesTestCloud(project: CloudProject): Promise<SyncValidationTestRunResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Runs self-hosted sync-rules validation and maps diagnostics into warning/error message arrays.
|
|
62
|
-
*/
|
|
63
|
-
export declare function runSyncRulesTestSelfHosted(project: SelfHostedProject): Promise<SyncValidationTestRunResult>;
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { ux } from '@oclif/core';
|
|
2
|
-
import { parseYamlFile, SERVICE_FILENAME, SYNC_FILENAME, validateCloudSyncRules, validateSelfHostedSyncRules } from '@powersync/cli-core';
|
|
3
|
-
import { ServiceCloudConfig, ServiceSelfHostedConfig } from '@powersync/cli-schemas';
|
|
4
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { Document } from 'yaml';
|
|
7
|
-
/** Indentation used for nested human-readable output rows. */
|
|
8
|
-
export const INDENT = ' ';
|
|
9
|
-
/** Bullet character used for list rows in human-readable output. */
|
|
10
|
-
export const BULLET = '•';
|
|
11
|
-
/**
|
|
12
|
-
* Named test buckets used by the validate command.
|
|
13
|
-
*/
|
|
14
|
-
export var Tests;
|
|
15
|
-
(function (Tests) {
|
|
16
|
-
Tests["CONFIGURATION_SCHEMA"] = "Validate Configuration Schema";
|
|
17
|
-
Tests["SYNC_RULES"] = "Validate Sync Config";
|
|
18
|
-
Tests["TEST_CONNECTIONS"] = "Test Connections";
|
|
19
|
-
})(Tests || (Tests = {}));
|
|
20
|
-
/**
|
|
21
|
-
* Formats spinner text showing per-test progress while tests are running.
|
|
22
|
-
* These logs are indeted with bullets for readability, and update in-place as each test settles to show pass/fail status.
|
|
23
|
-
*/
|
|
24
|
-
export function formatOraMessage(entries) {
|
|
25
|
-
return entries
|
|
26
|
-
.map((e) => (e.result === undefined ? `\t... ${e.name}` : e.result.passed ? `\t✓ ${e.name}` : `\t✗ ${e.name}`))
|
|
27
|
-
.join('\n');
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Formats one test result into human-readable plain text.
|
|
31
|
-
*/
|
|
32
|
-
function formatTestResultHuman(test) {
|
|
33
|
-
const status = test.passed ? '✓' : '✗';
|
|
34
|
-
const name = `${status} ${test.name}`;
|
|
35
|
-
const warningLines = (test.warnings ?? []).map((warning) => `${INDENT}${BULLET} [warning] ${warning}`);
|
|
36
|
-
if (test.passed && warningLines.length === 0)
|
|
37
|
-
return name;
|
|
38
|
-
const errorLines = (test.errors ?? []).map((e) => `${INDENT}${BULLET} ${e}`);
|
|
39
|
-
return [name, ...warningLines, ...errorLines].join('\n');
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Formats suite output for `--output=human`.
|
|
43
|
-
*/
|
|
44
|
-
export function formatValidationHuman(result) {
|
|
45
|
-
const header = result.passed ? 'All validation tests passed.' : 'Some validation tests failed.';
|
|
46
|
-
const lines = [header, '', ...result.tests.map((test) => formatTestResultHuman(test))];
|
|
47
|
-
return lines.join('\n');
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Formats suite output for `--output=json`.
|
|
51
|
-
*/
|
|
52
|
-
export function formatValidationJson(result) {
|
|
53
|
-
return JSON.stringify(result, null, 2);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Formats suite output for `--output=yaml`.
|
|
57
|
-
*/
|
|
58
|
-
export function formatValidationYaml(result) {
|
|
59
|
-
return new Document(result).toString();
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Builds a two-line diagnostic message containing a source fragment and location-prefixed message.
|
|
63
|
-
*/
|
|
64
|
-
function formatSyncDiagnosticMessage(diagnostic, syncRulesContent) {
|
|
65
|
-
const lineText = getLineAt(syncRulesContent, diagnostic.startLine);
|
|
66
|
-
const fragment = getLineFragment(lineText, diagnostic.startColumn);
|
|
67
|
-
return `${fragment}\n${diagnostic.startLine}:${diagnostic.startColumn} ${diagnostic.message}`;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Retrieves a specific 1-based line from text content.
|
|
71
|
-
*/
|
|
72
|
-
function getLineAt(content, lineNumber) {
|
|
73
|
-
if (!content) {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
const lines = content.split(/\r?\n/);
|
|
77
|
-
return lines[Math.max(0, lineNumber - 1)] ?? '';
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Extracts a nearby fragment around `startColumn`, clipping to a fixed width for readability.
|
|
81
|
-
*/
|
|
82
|
-
function getLineFragment(lineText, startColumn) {
|
|
83
|
-
if (!lineText) {
|
|
84
|
-
return '(line unavailable)';
|
|
85
|
-
}
|
|
86
|
-
const maxWidth = 120;
|
|
87
|
-
if (lineText.length <= maxWidth) {
|
|
88
|
-
return lineText;
|
|
89
|
-
}
|
|
90
|
-
const centerIndex = Math.max(0, startColumn - 1);
|
|
91
|
-
let start = Math.max(0, centerIndex - Math.floor(maxWidth / 2));
|
|
92
|
-
const end = Math.min(lineText.length, start + maxWidth);
|
|
93
|
-
if (end - start < maxWidth) {
|
|
94
|
-
start = Math.max(0, end - maxWidth);
|
|
95
|
-
}
|
|
96
|
-
const prefix = start > 0 ? '…' : '';
|
|
97
|
-
const suffix = end < lineText.length ? '…' : '';
|
|
98
|
-
return `${prefix}${lineText.slice(start, end)}${suffix}`;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Renders a warning into two lines for human output:
|
|
102
|
-
* 1) gray source fragment
|
|
103
|
-
* 2) yellow `[warning] line:column` prefix followed by plain message text
|
|
104
|
-
*/
|
|
105
|
-
export function renderWarningForHumanOutput(warning) {
|
|
106
|
-
const [fragmentRaw, locationAndMessageRaw] = warning.split('\n', 2);
|
|
107
|
-
const fragment = fragmentRaw ?? '';
|
|
108
|
-
const locationAndMessage = locationAndMessageRaw ?? '';
|
|
109
|
-
const parsed = locationAndMessage.match(/^(\d+:\d+)\s+([\s\S]+)$/);
|
|
110
|
-
const location = parsed?.[1] ?? '';
|
|
111
|
-
const message = parsed?.[2] ?? locationAndMessage;
|
|
112
|
-
const lines = [ux.colorize('gray', `${INDENT}${BULLET} ${fragment}`)];
|
|
113
|
-
if (location) {
|
|
114
|
-
lines.push(`${INDENT}${ux.colorize('yellow', '[warning]')} ${ux.colorize('yellow', location)} ${message}`);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
lines.push(`${INDENT}${ux.colorize('yellow', '[warning]')} ${message}`);
|
|
118
|
-
}
|
|
119
|
-
return lines;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Validates `service.yaml` against the cloud or self-hosted schema, depending on project type.
|
|
123
|
-
*/
|
|
124
|
-
export async function runConfigTest(projectDir, isCloud) {
|
|
125
|
-
const servicePath = join(projectDir, SERVICE_FILENAME);
|
|
126
|
-
try {
|
|
127
|
-
const doc = parseYamlFile(servicePath);
|
|
128
|
-
const raw = doc.contents?.toJSON();
|
|
129
|
-
if (isCloud) {
|
|
130
|
-
ServiceCloudConfig.decode(raw);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
ServiceSelfHostedConfig.decode(raw);
|
|
134
|
-
}
|
|
135
|
-
return { passed: true };
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
139
|
-
return { errors: [message], passed: false };
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Runs cloud sync-rules validation and maps diagnostics into warning/error message arrays.
|
|
144
|
-
*/
|
|
145
|
-
export async function runSyncRulesTestCloud(project) {
|
|
146
|
-
const syncRulesPath = join(project.projectDirectory, SYNC_FILENAME);
|
|
147
|
-
const syncRulesContent = project.syncRulesContent ?? (existsSync(syncRulesPath) ? readFileSync(syncRulesPath, 'utf8') : undefined);
|
|
148
|
-
const syncText = syncRulesContent ?? '';
|
|
149
|
-
try {
|
|
150
|
-
const result = await validateCloudSyncRules({
|
|
151
|
-
linked: project.linked,
|
|
152
|
-
syncRulesContent: syncText
|
|
153
|
-
});
|
|
154
|
-
const errors = result.diagnostics
|
|
155
|
-
.filter((diagnostic) => diagnostic.level === 'fatal')
|
|
156
|
-
.map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
|
|
157
|
-
const warnings = result.diagnostics
|
|
158
|
-
.filter((diagnostic) => diagnostic.level === 'warning')
|
|
159
|
-
.map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
|
|
160
|
-
return {
|
|
161
|
-
// Add detailed diagnostics for errors and warnings.
|
|
162
|
-
diagnostics: result.diagnostics,
|
|
163
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
164
|
-
passed: errors.length === 0,
|
|
165
|
-
warnings: warnings.length > 0 ? warnings : undefined
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
170
|
-
return { diagnostics: [], errors: [message], passed: false };
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Runs self-hosted sync-rules validation and maps diagnostics into warning/error message arrays.
|
|
175
|
-
*/
|
|
176
|
-
export async function runSyncRulesTestSelfHosted(project) {
|
|
177
|
-
const syncRulesPath = join(project.projectDirectory, SYNC_FILENAME);
|
|
178
|
-
const syncRulesContent = existsSync(syncRulesPath) ? readFileSync(syncRulesPath, 'utf8') : undefined;
|
|
179
|
-
const syncText = syncRulesContent ?? '';
|
|
180
|
-
try {
|
|
181
|
-
const result = await validateSelfHostedSyncRules({
|
|
182
|
-
linked: project.linked,
|
|
183
|
-
syncRulesContent: syncText
|
|
184
|
-
});
|
|
185
|
-
const errors = result.diagnostics
|
|
186
|
-
.filter((diagnostic) => diagnostic.level === 'fatal')
|
|
187
|
-
.map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
|
|
188
|
-
const warnings = result.diagnostics
|
|
189
|
-
.filter((diagnostic) => diagnostic.level === 'warning')
|
|
190
|
-
.map((diagnostic) => formatSyncDiagnosticMessage(diagnostic, syncText));
|
|
191
|
-
return {
|
|
192
|
-
diagnostics: result.diagnostics,
|
|
193
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
194
|
-
passed: errors.length === 0,
|
|
195
|
-
warnings: warnings.length > 0 ? warnings : undefined
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
200
|
-
return { diagnostics: [], errors: [message], passed: false };
|
|
201
|
-
}
|
|
202
|
-
}
|