@powersync/service-schema 0.0.0-dev-20250507132759

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 ADDED
@@ -0,0 +1,67 @@
1
+ # Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2023-2024 Journey Mobile, Inc.
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under these Terms and Conditions, as indicated by our inclusion of these Terms and Conditions with the Software.
20
+
21
+ ### License Grant
22
+
23
+ Subject to your compliance with this License Grant and the Patents, Redistribution and Trademark clauses below, we hereby grant you the right to use, copy, modify, create derivative works, publicly perform, publicly display and redistribute the Software for any Permitted Purpose identified below.
24
+
25
+ ### Permitted Purpose
26
+
27
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use means making the Software available to others in a commercial product or service that:
28
+
29
+ 1. substitutes for the Software;
30
+ 2. substitutes for any other product or service we offer using the Software that exists as of the date we make the Software available; or
31
+ 3. offers the same or substantially similar functionality as the Software.
32
+
33
+ Permitted Purposes specifically include using the Software:
34
+
35
+ 1. for your internal use and access;
36
+ 2. for non-commercial education;
37
+ 3. for non-commercial research; and
38
+ 4. in connection with professional services that you provide to a licensee using the Software in accordance with these Terms and Conditions.
39
+
40
+ ### Patents
41
+
42
+ To the extent your use for a Permitted Purpose would necessarily infringe our patents, the license grant above includes a license under our patents. If you make a claim against any party that the Software infringes or contributes to the infringement of any patent, then your patent license to the Software ends immediately.
43
+
44
+ ### Redistribution
45
+
46
+ The Terms and Conditions apply to all copies, modifications and derivatives of the Software.
47
+ If you redistribute any copies, modifications or derivatives of the Software, you must include a copy of or a link to these Terms and Conditions and not remove any copyright notices provided in or with the Software.
48
+
49
+ ### Disclaimer
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
52
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
53
+
54
+ ### Trademarks
55
+
56
+ Except for displaying the License Details and identifying us as the origin of the Software, you have no right under these Terms and Conditions to use our trademarks, trade names, service marks or product names.
57
+
58
+ ## Grant of Future License
59
+
60
+ We hereby irrevocably grant you an additional license to use the Software under the Apache License, Version 2.0 that is effective on the second anniversary of the date we make the Software available. On or after that date, you may use the Software under the Apache License, Version 2.0, in which case the following will apply:
61
+
62
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
63
+ You may obtain a copy of the License at
64
+
65
+ http://www.apache.org/licenses/LICENSE-2.0
66
+
67
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # PowerSync Service Schema
2
+
3
+ This package includes a JSON Schema for the PowerSync service configuration file.
4
+
5
+ This can be used to provide validations and suggestions for configuration files
6
+
7
+ ```yaml
8
+ # yaml-language-server: $schema=https://unpkg.com/@powersync/service-schema@latest/json-schema/powersync-config.json
9
+ ```
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export {};
2
+ // This project does not yet include TypeScript source, but it does use TypeScript to depend on the build of @powersync/service-types.
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sIAAsI"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { MongoStorageConfig } from '@powersync/service-module-mongodb-storage/types';
2
+ import { MongoConnectionConfig } from '@powersync/service-module-mongodb/types';
3
+ import { MySQLConnectionConfig } from '@powersync/service-module-mysql/types';
4
+ import { PostgresStorageConfig } from '@powersync/service-module-postgres-storage/types';
5
+ import { PostgresConnectionConfig } from '@powersync/service-module-postgres/types';
6
+ import { configFile } from '@powersync/service-types';
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ import * as t from 'ts-codec';
10
+ import { fileURLToPath } from 'url';
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ const schemaDir = path.join(__dirname, '../../json-schema');
13
+ fs.mkdirSync(schemaDir, { recursive: true });
14
+ // Merge configs for modules
15
+ const baseShape = configFile.powerSyncConfig.props.shape;
16
+ const mergedDataSourceConfig = configFile.genericDataSourceConfig
17
+ .or(PostgresConnectionConfig)
18
+ .or(MongoConnectionConfig)
19
+ .or(MySQLConnectionConfig);
20
+ const mergedStorageConfig = configFile.GenericStorageConfig.or(PostgresStorageConfig).or(MongoStorageConfig);
21
+ const mergedConfig = t.object({
22
+ ...baseShape,
23
+ replication: t
24
+ .object({
25
+ ...baseShape.replication.props.shape,
26
+ connections: t.array(mergedDataSourceConfig).optional()
27
+ })
28
+ .optional(),
29
+ storage: mergedStorageConfig.optional()
30
+ });
31
+ const mergedConfigSchema = t.generateJSONSchema(mergedConfig, {
32
+ allowAdditional: true,
33
+ parsers: [configFile.portParser]
34
+ });
35
+ fs.writeFileSync(path.join(schemaDir, 'powersync-config.json'), JSON.stringify(mergedConfigSchema, null, '\t'));
36
+ //# sourceMappingURL=compile-json-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-json-schema.js","sourceRoot":"","sources":["../../src/scripts/compile-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE5D,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAE7C,4BAA4B;AAC5B,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC;AAEzD,MAAM,sBAAsB,GAAG,UAAU,CAAC,uBAAuB;KAC9D,EAAE,CAAC,wBAAwB,CAAC;KAC5B,EAAE,CAAC,qBAAqB,CAAC;KACzB,EAAE,CAAC,qBAAqB,CAAC,CAAC;AAE7B,MAAM,mBAAmB,GAAG,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AAE7G,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,GAAG,SAAS;IACZ,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,GAAG,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK;QACpC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE;KACxD,CAAC;SACD,QAAQ,EAAE;IACb,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE;IAC5D,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;CACjC,CAAC,CAAC;AAEH,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,866 @@
1
+ {
2
+ "definitions": {},
3
+ "type": "object",
4
+ "properties": {
5
+ "replication": {
6
+ "type": "object",
7
+ "properties": {
8
+ "connections": {
9
+ "type": "array",
10
+ "items": {
11
+ "anyOf": [
12
+ {
13
+ "type": "object",
14
+ "properties": {
15
+ "type": {
16
+ "description": "Unique string identifier for the data source type (e.g., \"postgresql\", \"mysql\", etc.).",
17
+ "type": "string"
18
+ },
19
+ "id": {
20
+ "description": "Unique identifier for the connection. Optional when only a single connection is present.",
21
+ "type": "string"
22
+ },
23
+ "tag": {
24
+ "description": "Additional meta tag for the connection, used for categorization or grouping.",
25
+ "type": "string"
26
+ },
27
+ "debug_api": {
28
+ "description": "When enabled, allows query execution.",
29
+ "type": "boolean"
30
+ }
31
+ },
32
+ "additionalProperties": true,
33
+ "required": [
34
+ "type"
35
+ ]
36
+ },
37
+ {
38
+ "type": "object",
39
+ "properties": {
40
+ "type": {
41
+ "type": "string",
42
+ "const": "postgresql"
43
+ },
44
+ "id": {
45
+ "type": "string"
46
+ },
47
+ "tag": {
48
+ "type": "string"
49
+ },
50
+ "debug_api": {
51
+ "description": "When enabled, allows query execution.",
52
+ "type": "boolean"
53
+ },
54
+ "uri": {
55
+ "type": "string"
56
+ },
57
+ "hostname": {
58
+ "type": "string"
59
+ },
60
+ "port": {
61
+ "description": "A network port value that can be specified as either a number or a string that will be parsed to a number.",
62
+ "anyOf": [
63
+ {
64
+ "type": "number"
65
+ },
66
+ {
67
+ "type": "string"
68
+ }
69
+ ]
70
+ },
71
+ "username": {
72
+ "type": "string"
73
+ },
74
+ "password": {
75
+ "type": "string"
76
+ },
77
+ "database": {
78
+ "type": "string"
79
+ },
80
+ "sslmode": {
81
+ "anyOf": [
82
+ {
83
+ "type": "string",
84
+ "const": "verify-full"
85
+ },
86
+ {
87
+ "type": "string",
88
+ "const": "verify-ca"
89
+ },
90
+ {
91
+ "type": "string",
92
+ "const": "disable"
93
+ }
94
+ ]
95
+ },
96
+ "cacert": {
97
+ "type": "string"
98
+ },
99
+ "client_certificate": {
100
+ "type": "string"
101
+ },
102
+ "client_private_key": {
103
+ "type": "string"
104
+ },
105
+ "tls_servername": {
106
+ "type": "string"
107
+ },
108
+ "reject_ip_ranges": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "string"
112
+ }
113
+ },
114
+ "slot_name_prefix": {
115
+ "type": "string"
116
+ },
117
+ "max_pool_size": {
118
+ "type": "number"
119
+ }
120
+ },
121
+ "additionalProperties": true,
122
+ "required": [
123
+ "type"
124
+ ]
125
+ },
126
+ {
127
+ "type": "object",
128
+ "properties": {
129
+ "type": {
130
+ "description": "Unique string identifier for the data source type (e.g., \"postgresql\", \"mysql\", etc.).",
131
+ "type": "string"
132
+ },
133
+ "uri": {
134
+ "type": "string"
135
+ },
136
+ "database": {
137
+ "type": "string"
138
+ },
139
+ "username": {
140
+ "type": "string"
141
+ },
142
+ "password": {
143
+ "type": "string"
144
+ },
145
+ "reject_ip_ranges": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "string"
149
+ }
150
+ },
151
+ "id": {
152
+ "description": "Unique identifier for the connection. Optional when only a single connection is present.",
153
+ "type": "string"
154
+ },
155
+ "tag": {
156
+ "description": "Additional meta tag for the connection, used for categorization or grouping.",
157
+ "type": "string"
158
+ },
159
+ "debug_api": {
160
+ "description": "When enabled, allows query execution.",
161
+ "type": "boolean"
162
+ },
163
+ "post_images": {
164
+ "anyOf": [
165
+ {
166
+ "type": "string",
167
+ "const": "off"
168
+ },
169
+ {
170
+ "type": "string",
171
+ "const": "auto_configure"
172
+ },
173
+ {
174
+ "type": "string",
175
+ "const": "read_only"
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ "additionalProperties": true,
181
+ "required": [
182
+ "type",
183
+ "uri"
184
+ ]
185
+ },
186
+ {
187
+ "type": "object",
188
+ "properties": {
189
+ "type": {
190
+ "type": "string",
191
+ "const": "mysql"
192
+ },
193
+ "id": {
194
+ "description": "Unique identifier for the connection. Optional when only a single connection is present.",
195
+ "type": "string"
196
+ },
197
+ "tag": {
198
+ "description": "Additional meta tag for the connection, used for categorization or grouping.",
199
+ "type": "string"
200
+ },
201
+ "debug_api": {
202
+ "description": "When enabled, allows query execution.",
203
+ "type": "boolean"
204
+ },
205
+ "uri": {
206
+ "type": "string"
207
+ },
208
+ "hostname": {
209
+ "type": "string"
210
+ },
211
+ "port": {
212
+ "description": "A network port value that can be specified as either a number or a string that will be parsed to a number.",
213
+ "anyOf": [
214
+ {
215
+ "type": "number"
216
+ },
217
+ {
218
+ "type": "string"
219
+ }
220
+ ]
221
+ },
222
+ "username": {
223
+ "type": "string"
224
+ },
225
+ "password": {
226
+ "type": "string"
227
+ },
228
+ "database": {
229
+ "type": "string"
230
+ },
231
+ "server_id": {
232
+ "type": "number"
233
+ },
234
+ "cacert": {
235
+ "type": "string"
236
+ },
237
+ "client_certificate": {
238
+ "type": "string"
239
+ },
240
+ "client_private_key": {
241
+ "type": "string"
242
+ },
243
+ "reject_ip_ranges": {
244
+ "type": "array",
245
+ "items": {
246
+ "type": "string"
247
+ }
248
+ }
249
+ },
250
+ "additionalProperties": true,
251
+ "required": [
252
+ "type"
253
+ ]
254
+ }
255
+ ]
256
+ }
257
+ }
258
+ },
259
+ "additionalProperties": true,
260
+ "required": []
261
+ },
262
+ "dev": {
263
+ "description": "Development-specific configuration options.",
264
+ "type": "object",
265
+ "properties": {
266
+ "demo_auth": {
267
+ "description": "Enables demo authentication for development purposes.",
268
+ "type": "boolean"
269
+ },
270
+ "demo_password": {
271
+ "description": "Deprecated. Demo password for development authentication.",
272
+ "type": "string"
273
+ },
274
+ "crud_api": {
275
+ "description": "Deprecated. Enables CRUD API for development.",
276
+ "type": "boolean"
277
+ },
278
+ "demo_client": {
279
+ "description": "Deprecated. Enables demo client for development.",
280
+ "type": "boolean"
281
+ }
282
+ },
283
+ "additionalProperties": true,
284
+ "required": []
285
+ },
286
+ "client_auth": {
287
+ "description": "Configuration for client authentication mechanisms.",
288
+ "type": "object",
289
+ "properties": {
290
+ "jwks_uri": {
291
+ "description": "URI or array of URIs pointing to JWKS endpoints for client authentication.",
292
+ "anyOf": [
293
+ {
294
+ "type": "string"
295
+ },
296
+ {
297
+ "type": "array",
298
+ "items": {
299
+ "type": "string"
300
+ }
301
+ }
302
+ ]
303
+ },
304
+ "block_local_jwks": {
305
+ "description": "When true, blocks JWKS URIs that resolve to local network addresses.",
306
+ "type": "boolean"
307
+ },
308
+ "jwks_reject_ip_ranges": {
309
+ "description": "IP ranges to reject when validating JWKS URIs.",
310
+ "type": "array",
311
+ "items": {
312
+ "type": "string"
313
+ }
314
+ },
315
+ "jwks": {
316
+ "description": "Inline JWKS configuration for client authentication.",
317
+ "type": "object",
318
+ "properties": {
319
+ "keys": {
320
+ "description": "An array of JSON Web Keys (JWKs).",
321
+ "type": "array",
322
+ "items": {
323
+ "description": "A JSON Web Key (JWK) representing a cryptographic key. Can be RSA, HMAC, OKP, or EC key types.",
324
+ "anyOf": [
325
+ {
326
+ "description": "JSON Web Key (JWK) representation of an RSA key.",
327
+ "type": "object",
328
+ "properties": {
329
+ "kty": {
330
+ "description": "Key type identifier, must be \"RSA\" for RSA keys.",
331
+ "type": "string",
332
+ "const": "RSA"
333
+ },
334
+ "kid": {
335
+ "description": "Key ID, a unique identifier for the key.",
336
+ "type": "string"
337
+ },
338
+ "n": {
339
+ "description": "RSA modulus, Base64 URL encoded.",
340
+ "type": "string"
341
+ },
342
+ "e": {
343
+ "description": "RSA exponent, Base64 URL encoded.",
344
+ "type": "string"
345
+ },
346
+ "alg": {
347
+ "description": "The algorithm intended for use with this key (RS256, RS384, or RS512).",
348
+ "anyOf": [
349
+ {
350
+ "type": "string",
351
+ "const": "RS256"
352
+ },
353
+ {
354
+ "type": "string",
355
+ "const": "RS384"
356
+ },
357
+ {
358
+ "type": "string",
359
+ "const": "RS512"
360
+ }
361
+ ]
362
+ },
363
+ "use": {
364
+ "description": "The intended use of the key (e.g., \"sig\" for signature).",
365
+ "type": "string"
366
+ }
367
+ },
368
+ "additionalProperties": true,
369
+ "required": [
370
+ "kty",
371
+ "kid",
372
+ "n",
373
+ "e"
374
+ ]
375
+ },
376
+ {
377
+ "description": "JSON Web Key (JWK) representation of an HMAC key.",
378
+ "type": "object",
379
+ "properties": {
380
+ "kty": {
381
+ "description": "Key type identifier, must be \"oct\" for HMAC keys.",
382
+ "type": "string",
383
+ "const": "oct"
384
+ },
385
+ "kid": {
386
+ "description": "Key ID. Undefined kid indicates it can match any JWT, with or without a kid. Use a kid wherever possible.",
387
+ "type": "string"
388
+ },
389
+ "k": {
390
+ "description": "The HMAC key value, Base64 URL encoded.",
391
+ "type": "string"
392
+ },
393
+ "alg": {
394
+ "description": "The algorithm intended for use with this key (HS256, HS384, or HS512).",
395
+ "anyOf": [
396
+ {
397
+ "type": "string",
398
+ "const": "HS256"
399
+ },
400
+ {
401
+ "type": "string",
402
+ "const": "HS384"
403
+ },
404
+ {
405
+ "type": "string",
406
+ "const": "HS512"
407
+ }
408
+ ]
409
+ },
410
+ "use": {
411
+ "description": "The intended use of the key (e.g., \"sig\" for signature).",
412
+ "type": "string"
413
+ }
414
+ },
415
+ "additionalProperties": true,
416
+ "required": [
417
+ "kty",
418
+ "k",
419
+ "alg"
420
+ ]
421
+ },
422
+ {
423
+ "description": "JSON Web Key (JWK) representation of an Octet Key Pair (OKP) key used with Edwards-curve Digital Signature Algorithm.",
424
+ "type": "object",
425
+ "properties": {
426
+ "kty": {
427
+ "description": "Key type identifier, must be \"OKP\" for Octet Key Pair keys.",
428
+ "type": "string",
429
+ "const": "OKP"
430
+ },
431
+ "kid": {
432
+ "description": "Key ID, a unique identifier for the key.",
433
+ "type": "string"
434
+ },
435
+ "crv": {
436
+ "description": "The cryptographic curve used with this key. Only Ed25519 and Ed448 are supported.",
437
+ "anyOf": [
438
+ {
439
+ "type": "string",
440
+ "const": "Ed25519"
441
+ },
442
+ {
443
+ "type": "string",
444
+ "const": "Ed448"
445
+ }
446
+ ]
447
+ },
448
+ "x": {
449
+ "description": "The public key, Base64 URL encoded.",
450
+ "type": "string"
451
+ },
452
+ "alg": {
453
+ "description": "The algorithm intended for use with this key (EdDSA).",
454
+ "type": "string",
455
+ "const": "EdDSA"
456
+ },
457
+ "use": {
458
+ "description": "The intended use of the key (e.g., \"sig\" for signature).",
459
+ "type": "string"
460
+ }
461
+ },
462
+ "additionalProperties": true,
463
+ "required": [
464
+ "kty",
465
+ "crv",
466
+ "x",
467
+ "alg"
468
+ ]
469
+ },
470
+ {
471
+ "description": "JSON Web Key (JWK) representation of an Elliptic Curve key.",
472
+ "type": "object",
473
+ "properties": {
474
+ "kty": {
475
+ "description": "Key type identifier, must be \"EC\" for Elliptic Curve keys.",
476
+ "type": "string",
477
+ "const": "EC"
478
+ },
479
+ "kid": {
480
+ "description": "Key ID, a unique identifier for the key.",
481
+ "type": "string"
482
+ },
483
+ "crv": {
484
+ "description": "The cryptographic curve used with this key (P-256, P-384, or P-512).",
485
+ "anyOf": [
486
+ {
487
+ "type": "string",
488
+ "const": "P-256"
489
+ },
490
+ {
491
+ "type": "string",
492
+ "const": "P-384"
493
+ },
494
+ {
495
+ "type": "string",
496
+ "const": "P-512"
497
+ }
498
+ ]
499
+ },
500
+ "x": {
501
+ "description": "The x coordinate for the Elliptic Curve point, Base64 URL encoded.",
502
+ "type": "string"
503
+ },
504
+ "y": {
505
+ "description": "The y coordinate for the Elliptic Curve point, Base64 URL encoded.",
506
+ "type": "string"
507
+ },
508
+ "alg": {
509
+ "description": "The algorithm intended for use with this key (ES256, ES384, or ES512).",
510
+ "anyOf": [
511
+ {
512
+ "type": "string",
513
+ "const": "ES256"
514
+ },
515
+ {
516
+ "type": "string",
517
+ "const": "ES384"
518
+ },
519
+ {
520
+ "type": "string",
521
+ "const": "ES512"
522
+ }
523
+ ]
524
+ },
525
+ "use": {
526
+ "description": "The intended use of the key (e.g., \"sig\" for signature).",
527
+ "type": "string"
528
+ }
529
+ },
530
+ "additionalProperties": true,
531
+ "required": [
532
+ "kty",
533
+ "crv",
534
+ "x",
535
+ "y",
536
+ "alg"
537
+ ]
538
+ }
539
+ ]
540
+ }
541
+ }
542
+ },
543
+ "additionalProperties": true,
544
+ "required": [
545
+ "keys"
546
+ ]
547
+ },
548
+ "supabase": {
549
+ "description": "Enables Supabase authentication integration.",
550
+ "type": "boolean"
551
+ },
552
+ "supabase_jwt_secret": {
553
+ "description": "JWT secret for Supabase authentication.",
554
+ "type": "string"
555
+ },
556
+ "audience": {
557
+ "description": "Valid audiences for JWT validation.",
558
+ "type": "array",
559
+ "items": {
560
+ "type": "string"
561
+ }
562
+ }
563
+ },
564
+ "additionalProperties": true,
565
+ "required": []
566
+ },
567
+ "api": {
568
+ "description": "API service configuration and parameters.",
569
+ "type": "object",
570
+ "properties": {
571
+ "tokens": {
572
+ "description": "API access tokens for administrative operations.",
573
+ "type": "array",
574
+ "items": {
575
+ "type": "string"
576
+ }
577
+ },
578
+ "parameters": {
579
+ "description": "Performance and safety parameters for the API service.",
580
+ "type": "object",
581
+ "properties": {
582
+ "max_concurrent_connections": {
583
+ "description": "Maximum number of connections (http streams or websockets) per API process.\nDefault of 200.",
584
+ "type": "number"
585
+ },
586
+ "max_data_fetch_concurrency": {
587
+ "description": "This should not be siginificantly more than storage.max_pool_size, otherwise it would block on the\npool. Increasing this can significantly increase memory usage in some cases.\nDefault of 10.",
588
+ "type": "number"
589
+ },
590
+ "max_buckets_per_connection": {
591
+ "description": "Maximum number of buckets for each connection.\nMore buckets increase latency and memory usage. While the actual number is controlled by sync rules,\nhaving a hard limit ensures that the service errors instead of crashing when a sync rule is misconfigured.\nDefault of 1000.",
592
+ "type": "number"
593
+ },
594
+ "max_parameter_query_results": {
595
+ "description": "Related to max_buckets_per_connection, but this limit applies directly on the parameter\nquery results, _before_ we convert it into an unique set.\nDefault of 1000.",
596
+ "type": "number"
597
+ }
598
+ },
599
+ "additionalProperties": true,
600
+ "required": []
601
+ }
602
+ },
603
+ "additionalProperties": true,
604
+ "required": []
605
+ },
606
+ "storage": {
607
+ "anyOf": [
608
+ {
609
+ "type": "object",
610
+ "properties": {
611
+ "type": {
612
+ "description": "The type of storage backend to use (e.g., \"postgresql\", \"mongodb\").",
613
+ "type": "string"
614
+ },
615
+ "max_pool_size": {
616
+ "description": "Maximum number of connections to the storage database, per process. Defaults to 8.",
617
+ "type": "number"
618
+ }
619
+ },
620
+ "additionalProperties": true,
621
+ "required": [
622
+ "type"
623
+ ]
624
+ },
625
+ {
626
+ "type": "object",
627
+ "properties": {
628
+ "type": {
629
+ "type": "string",
630
+ "const": "postgresql"
631
+ },
632
+ "max_pool_size": {
633
+ "type": "number"
634
+ },
635
+ "id": {
636
+ "type": "string"
637
+ },
638
+ "tag": {
639
+ "type": "string"
640
+ },
641
+ "uri": {
642
+ "type": "string"
643
+ },
644
+ "hostname": {
645
+ "type": "string"
646
+ },
647
+ "port": {
648
+ "description": "A network port value that can be specified as either a number or a string that will be parsed to a number.",
649
+ "anyOf": [
650
+ {
651
+ "type": "number"
652
+ },
653
+ {
654
+ "type": "string"
655
+ }
656
+ ]
657
+ },
658
+ "username": {
659
+ "type": "string"
660
+ },
661
+ "password": {
662
+ "type": "string"
663
+ },
664
+ "database": {
665
+ "type": "string"
666
+ },
667
+ "sslmode": {
668
+ "anyOf": [
669
+ {
670
+ "type": "string",
671
+ "const": "verify-full"
672
+ },
673
+ {
674
+ "type": "string",
675
+ "const": "verify-ca"
676
+ },
677
+ {
678
+ "type": "string",
679
+ "const": "disable"
680
+ }
681
+ ]
682
+ },
683
+ "cacert": {
684
+ "type": "string"
685
+ },
686
+ "client_certificate": {
687
+ "type": "string"
688
+ },
689
+ "client_private_key": {
690
+ "type": "string"
691
+ },
692
+ "tls_servername": {
693
+ "type": "string"
694
+ },
695
+ "reject_ip_ranges": {
696
+ "type": "array",
697
+ "items": {
698
+ "type": "string"
699
+ }
700
+ },
701
+ "slot_name_prefix": {
702
+ "type": "string"
703
+ },
704
+ "batch_limits": {
705
+ "type": "object",
706
+ "properties": {
707
+ "max_estimated_size": {
708
+ "type": "number"
709
+ },
710
+ "max_record_count": {
711
+ "type": "number"
712
+ },
713
+ "max_current_data_batch_size": {
714
+ "type": "number"
715
+ }
716
+ },
717
+ "additionalProperties": true,
718
+ "required": []
719
+ }
720
+ },
721
+ "additionalProperties": true,
722
+ "required": [
723
+ "type"
724
+ ]
725
+ },
726
+ {
727
+ "type": "object",
728
+ "properties": {
729
+ "type": {
730
+ "type": "string",
731
+ "const": "mongodb"
732
+ },
733
+ "uri": {
734
+ "type": "string"
735
+ },
736
+ "database": {
737
+ "type": "string"
738
+ },
739
+ "username": {
740
+ "type": "string"
741
+ },
742
+ "password": {
743
+ "type": "string"
744
+ },
745
+ "reject_ip_ranges": {
746
+ "type": "array",
747
+ "items": {
748
+ "type": "string"
749
+ }
750
+ }
751
+ },
752
+ "additionalProperties": true,
753
+ "required": [
754
+ "type",
755
+ "uri"
756
+ ]
757
+ }
758
+ ]
759
+ },
760
+ "port": {
761
+ "description": "The port on which the service will listen for connections. Can be specified as a number or string.",
762
+ "anyOf": [
763
+ {
764
+ "type": "number"
765
+ },
766
+ {
767
+ "type": "string"
768
+ }
769
+ ]
770
+ },
771
+ "sync_rules": {
772
+ "description": "Configuration for synchronization rules that define data access patterns.",
773
+ "type": "object",
774
+ "properties": {
775
+ "path": {
776
+ "description": "Path to the sync rules file or directory.",
777
+ "type": "string"
778
+ },
779
+ "content": {
780
+ "description": "Inline sync rules content as a string.",
781
+ "type": "string"
782
+ },
783
+ "exit_on_error": {
784
+ "description": "Whether to exit the process if there is an error parsing sync rules.",
785
+ "type": "boolean"
786
+ }
787
+ },
788
+ "additionalProperties": true,
789
+ "required": []
790
+ },
791
+ "metadata": {
792
+ "description": "Custom metadata key-value pairs for the service.",
793
+ "type": "object",
794
+ "additionalProperties": {
795
+ "type": "string"
796
+ },
797
+ "properties": {},
798
+ "required": []
799
+ },
800
+ "migrations": {
801
+ "description": "Configuration for database schema migrations.",
802
+ "type": "object",
803
+ "properties": {
804
+ "disable_auto_migration": {
805
+ "description": "When true, disables automatic storage database schema migrations.",
806
+ "type": "boolean"
807
+ }
808
+ },
809
+ "additionalProperties": true,
810
+ "required": []
811
+ },
812
+ "telemetry": {
813
+ "description": "Configuration for service telemetry and monitoring.",
814
+ "type": "object",
815
+ "properties": {
816
+ "prometheus_port": {
817
+ "description": "Port on which Prometheus metrics will be exposed. When set, metrics will be available on this port for scraping.",
818
+ "anyOf": [
819
+ {
820
+ "type": "number"
821
+ },
822
+ {
823
+ "type": "string"
824
+ }
825
+ ]
826
+ },
827
+ "disable_telemetry_sharing": {
828
+ "description": "When true, disables sharing of anonymized telemetry data.",
829
+ "type": "boolean"
830
+ },
831
+ "internal_service_endpoint": {
832
+ "description": "Internal endpoint for telemetry services.",
833
+ "type": "string"
834
+ }
835
+ },
836
+ "additionalProperties": true,
837
+ "required": [
838
+ "disable_telemetry_sharing"
839
+ ]
840
+ },
841
+ "parameters": {
842
+ "description": "Global parameters that can be referenced in sync rules and other configurations.",
843
+ "type": "object",
844
+ "additionalProperties": {
845
+ "anyOf": [
846
+ {
847
+ "type": "number"
848
+ },
849
+ {
850
+ "type": "string"
851
+ },
852
+ {
853
+ "type": "boolean"
854
+ },
855
+ {
856
+ "type": "null"
857
+ }
858
+ ]
859
+ },
860
+ "properties": {},
861
+ "required": []
862
+ }
863
+ },
864
+ "additionalProperties": true,
865
+ "required": []
866
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@powersync/service-schema",
3
+ "version": "0.0.0-dev-20250507132759",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "license": "FSL-1.1-Apache-2.0",
7
+ "type": "module",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist/**/*",
13
+ "json-schema/*"
14
+ ],
15
+ "repository": "https://github.com/powersync-ja/powersync-service",
16
+ "dependencies": {},
17
+ "devDependencies": {
18
+ "ts-codec": "^1.3.0",
19
+ "@powersync/service-module-postgres": "0.0.0-dev-20250507132759",
20
+ "@powersync/service-module-postgres-storage": "0.0.0-dev-20250507132759",
21
+ "@powersync/service-module-mongodb": "0.0.0-dev-20250507132759",
22
+ "@powersync/service-module-mongodb-storage": "0.0.0-dev-20250507132759",
23
+ "@powersync/service-module-mysql": "0.0.0-dev-20250507132759",
24
+ "@powersync/service-types": "0.0.0-dev-20250507132759"
25
+ },
26
+ "scripts": {
27
+ "clean": "rm -r ./dist && tsc -b --clean",
28
+ "build:ts": "tsc -b",
29
+ "build": "pnpm build:ts && node ./dist/scripts/compile-json-schema.js"
30
+ }
31
+ }