powersync 0.1.0

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.
Files changed (221) hide show
  1. package/README.md +339 -0
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +9 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +8 -0
  6. package/dist/commands/init.d.ts +7 -0
  7. package/dist/commands/init.js +49 -0
  8. package/dist/commands/instance/config.d.ts +6 -0
  9. package/dist/commands/instance/config.js +23 -0
  10. package/dist/commands/instance/create.d.ts +16 -0
  11. package/dist/commands/instance/create.js +163 -0
  12. package/dist/commands/instance/deploy.d.ts +15 -0
  13. package/dist/commands/instance/deploy.js +142 -0
  14. package/dist/commands/instance/destroy.d.ts +9 -0
  15. package/dist/commands/instance/destroy.js +42 -0
  16. package/dist/commands/instance/schema.d.ts +6 -0
  17. package/dist/commands/instance/schema.js +20 -0
  18. package/dist/commands/instance/set.d.ts +9 -0
  19. package/dist/commands/instance/set.js +31 -0
  20. package/dist/commands/instance/status.d.ts +6 -0
  21. package/dist/commands/instance/status.js +21 -0
  22. package/dist/commands/instance/stop.d.ts +9 -0
  23. package/dist/commands/instance/stop.js +42 -0
  24. package/dist/commands/instance/sync-rules/deploy.d.ts +10 -0
  25. package/dist/commands/instance/sync-rules/deploy.js +49 -0
  26. package/dist/commands/instance/sync-rules/generate-schema.d.ts +10 -0
  27. package/dist/commands/instance/sync-rules/generate-schema.js +55 -0
  28. package/dist/commands/instance/sync-rules/validate.d.ts +9 -0
  29. package/dist/commands/instance/sync-rules/validate.js +29 -0
  30. package/dist/commands/instances.d.ts +6 -0
  31. package/dist/commands/instances.js +20 -0
  32. package/dist/constants.d.ts +11 -0
  33. package/dist/constants.js +8 -0
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/powersync-sdk/accounts/api.d.ts +717 -0
  37. package/dist/powersync-sdk/accounts/api.js +182 -0
  38. package/dist/powersync-sdk/accounts/client.d.ts +1096 -0
  39. package/dist/powersync-sdk/accounts/client.js +124 -0
  40. package/dist/powersync-sdk/accounts/codecs.d.ts +32 -0
  41. package/dist/powersync-sdk/accounts/codecs.js +93 -0
  42. package/dist/powersync-sdk/accounts/index.d.ts +4 -0
  43. package/dist/powersync-sdk/accounts/index.js +4 -0
  44. package/dist/powersync-sdk/accounts/models.d.ts +260 -0
  45. package/dist/powersync-sdk/accounts/models.js +96 -0
  46. package/dist/powersync-sdk/accounts/routes.d.ts +44 -0
  47. package/dist/powersync-sdk/accounts/routes.js +45 -0
  48. package/dist/powersync-sdk/accounts/source.d.ts +76 -0
  49. package/dist/powersync-sdk/accounts/source.js +32 -0
  50. package/dist/powersync-sdk/errors/errors.d.ts +62 -0
  51. package/dist/powersync-sdk/errors/errors.js +115 -0
  52. package/dist/powersync-sdk/errors/index.d.ts +2 -0
  53. package/dist/powersync-sdk/errors/index.js +2 -0
  54. package/dist/powersync-sdk/errors/utils.d.ts +4 -0
  55. package/dist/powersync-sdk/errors/utils.js +18 -0
  56. package/dist/powersync-sdk/fetch-clients/codecs.d.ts +4 -0
  57. package/dist/powersync-sdk/fetch-clients/codecs.js +34 -0
  58. package/dist/powersync-sdk/fetch-clients/decoders.d.ts +3 -0
  59. package/dist/powersync-sdk/fetch-clients/decoders.js +35 -0
  60. package/dist/powersync-sdk/fetch-clients/definitions.d.ts +97 -0
  61. package/dist/powersync-sdk/fetch-clients/definitions.js +22 -0
  62. package/dist/powersync-sdk/fetch-clients/errors.d.ts +7 -0
  63. package/dist/powersync-sdk/fetch-clients/errors.js +19 -0
  64. package/dist/powersync-sdk/fetch-clients/index.d.ts +5 -0
  65. package/dist/powersync-sdk/fetch-clients/index.js +5 -0
  66. package/dist/powersync-sdk/fetch-clients/node-client.d.ts +9 -0
  67. package/dist/powersync-sdk/fetch-clients/node-client.js +107 -0
  68. package/dist/powersync-sdk/fetch-clients/request.d.ts +11 -0
  69. package/dist/powersync-sdk/fetch-clients/request.js +138 -0
  70. package/dist/powersync-sdk/fetch-clients/streaming.d.ts +65 -0
  71. package/dist/powersync-sdk/fetch-clients/streaming.js +99 -0
  72. package/dist/powersync-sdk/fetch-clients/utils.d.ts +13 -0
  73. package/dist/powersync-sdk/fetch-clients/utils.js +43 -0
  74. package/dist/powersync-sdk/fetch-clients/web-client.d.ts +14 -0
  75. package/dist/powersync-sdk/fetch-clients/web-client.js +56 -0
  76. package/dist/powersync-sdk/json/index.d.ts +4 -0
  77. package/dist/powersync-sdk/json/index.js +3 -0
  78. package/dist/powersync-sdk/json/json.d.ts +5 -0
  79. package/dist/powersync-sdk/json/json.js +35 -0
  80. package/dist/powersync-sdk/json/json_container.d.ts +18 -0
  81. package/dist/powersync-sdk/json/json_container.js +28 -0
  82. package/dist/powersync-sdk/json/json_stringify.d.ts +36 -0
  83. package/dist/powersync-sdk/json/json_stringify.js +162 -0
  84. package/dist/powersync-sdk/powersync/client.d.ts +449 -0
  85. package/dist/powersync-sdk/powersync/client.js +53 -0
  86. package/dist/powersync-sdk/powersync/config/HostedConfig.d.ts +327 -0
  87. package/dist/powersync-sdk/powersync/config/HostedConfig.js +92 -0
  88. package/dist/powersync-sdk/powersync/config/PowerSyncConfig.d.ts +211 -0
  89. package/dist/powersync-sdk/powersync/config/PowerSyncConfig.js +97 -0
  90. package/dist/powersync-sdk/powersync/config/normalize.d.ts +32 -0
  91. package/dist/powersync-sdk/powersync/config/normalize.js +85 -0
  92. package/dist/powersync-sdk/powersync/definitions.d.ts +149 -0
  93. package/dist/powersync-sdk/powersync/definitions.js +97 -0
  94. package/dist/powersync-sdk/powersync/index.d.ts +8 -0
  95. package/dist/powersync-sdk/powersync/index.js +8 -0
  96. package/dist/powersync-sdk/powersync/internal_routes.d.ts +247 -0
  97. package/dist/powersync-sdk/powersync/internal_routes.js +69 -0
  98. package/dist/powersync-sdk/powersync/routes.d.ts +779 -0
  99. package/dist/powersync-sdk/powersync/routes.js +191 -0
  100. package/dist/powersync-sdk/sdk-clients/endpoints.d.ts +31 -0
  101. package/dist/powersync-sdk/sdk-clients/endpoints.js +48 -0
  102. package/dist/powersync-sdk/sdk-clients/index.d.ts +3 -0
  103. package/dist/powersync-sdk/sdk-clients/index.js +3 -0
  104. package/dist/powersync-sdk/sdk-clients/pagination.d.ts +14 -0
  105. package/dist/powersync-sdk/sdk-clients/pagination.js +21 -0
  106. package/dist/powersync-sdk/sdk-clients/sdk-client.d.ts +17 -0
  107. package/dist/powersync-sdk/sdk-clients/sdk-client.js +30 -0
  108. package/dist/powersync-sdk/streaming/bson/buffer-array.d.ts +31 -0
  109. package/dist/powersync-sdk/streaming/bson/buffer-array.js +79 -0
  110. package/dist/powersync-sdk/streaming/bson/constants.d.ts +2 -0
  111. package/dist/powersync-sdk/streaming/bson/constants.js +1 -0
  112. package/dist/powersync-sdk/streaming/bson/decoder.d.ts +10 -0
  113. package/dist/powersync-sdk/streaming/bson/decoder.js +62 -0
  114. package/dist/powersync-sdk/streaming/bson/encoder.d.ts +10 -0
  115. package/dist/powersync-sdk/streaming/bson/encoder.js +23 -0
  116. package/dist/powersync-sdk/streaming/bson/header.d.ts +11 -0
  117. package/dist/powersync-sdk/streaming/bson/header.js +52 -0
  118. package/dist/powersync-sdk/streaming/bson/index.d.ts +5 -0
  119. package/dist/powersync-sdk/streaming/bson/index.js +5 -0
  120. package/dist/powersync-sdk/streaming/core/backpressure.d.ts +15 -0
  121. package/dist/powersync-sdk/streaming/core/backpressure.js +34 -0
  122. package/dist/powersync-sdk/streaming/core/cross-stream.d.ts +6 -0
  123. package/dist/powersync-sdk/streaming/core/cross-stream.js +17 -0
  124. package/dist/powersync-sdk/streaming/core/index.d.ts +4 -0
  125. package/dist/powersync-sdk/streaming/core/index.js +4 -0
  126. package/dist/powersync-sdk/streaming/core/node-utils.d.ts +7 -0
  127. package/dist/powersync-sdk/streaming/core/node-utils.js +11 -0
  128. package/dist/powersync-sdk/streaming/core/transformers.d.ts +41 -0
  129. package/dist/powersync-sdk/streaming/core/transformers.js +70 -0
  130. package/dist/powersync-sdk/streaming/core/utils.d.ts +36 -0
  131. package/dist/powersync-sdk/streaming/core/utils.js +66 -0
  132. package/dist/powersync-sdk/streaming/index.d.ts +3 -0
  133. package/dist/powersync-sdk/streaming/index.js +3 -0
  134. package/dist/powersync-sdk/streaming/web.d.ts +4 -0
  135. package/dist/powersync-sdk/streaming/web.js +4 -0
  136. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.d.ts +2 -0
  137. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.js +36 -0
  138. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.d.ts +2 -0
  139. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.js +58 -0
  140. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.d.ts +18 -0
  141. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.js +348 -0
  142. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.d.ts +11 -0
  143. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.js +118 -0
  144. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.d.ts +11 -0
  145. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.js +131 -0
  146. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.d.ts +11 -0
  147. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.js +134 -0
  148. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.d.ts +11 -0
  149. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.js +122 -0
  150. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.d.ts +11 -0
  151. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.js +158 -0
  152. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.d.ts +14 -0
  153. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.js +165 -0
  154. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.d.ts +11 -0
  155. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.js +207 -0
  156. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.d.ts +30 -0
  157. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.js +29 -0
  158. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.d.ts +2 -0
  159. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.js +111 -0
  160. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.d.ts +9 -0
  161. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.js +9 -0
  162. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.d.ts +5 -0
  163. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.js +9 -0
  164. package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.d.ts +12 -0
  165. package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.js +35 -0
  166. package/dist/powersync-sdk/sync-rules/ExpressionType.d.ts +33 -0
  167. package/dist/powersync-sdk/sync-rules/ExpressionType.js +62 -0
  168. package/dist/powersync-sdk/sync-rules/IdSequence.d.ts +4 -0
  169. package/dist/powersync-sdk/sync-rules/IdSequence.js +7 -0
  170. package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.d.ts +12 -0
  171. package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.js +38 -0
  172. package/dist/powersync-sdk/sync-rules/SchemaGenerator.d.ts +14 -0
  173. package/dist/powersync-sdk/sync-rules/SchemaGenerator.js +24 -0
  174. package/dist/powersync-sdk/sync-rules/SourceTableInterface.d.ts +5 -0
  175. package/dist/powersync-sdk/sync-rules/SourceTableInterface.js +1 -0
  176. package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.d.ts +37 -0
  177. package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.js +116 -0
  178. package/dist/powersync-sdk/sync-rules/SqlDataQuery.d.ts +39 -0
  179. package/dist/powersync-sdk/sync-rules/SqlDataQuery.js +245 -0
  180. package/dist/powersync-sdk/sync-rules/SqlParameterQuery.d.ts +43 -0
  181. package/dist/powersync-sdk/sync-rules/SqlParameterQuery.js +254 -0
  182. package/dist/powersync-sdk/sync-rules/SqlSyncRules.d.ts +52 -0
  183. package/dist/powersync-sdk/sync-rules/SqlSyncRules.js +252 -0
  184. package/dist/powersync-sdk/sync-rules/StaticSchema.d.ts +26 -0
  185. package/dist/powersync-sdk/sync-rules/StaticSchema.js +71 -0
  186. package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.d.ts +24 -0
  187. package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.js +71 -0
  188. package/dist/powersync-sdk/sync-rules/TablePattern.d.ts +17 -0
  189. package/dist/powersync-sdk/sync-rules/TablePattern.js +56 -0
  190. package/dist/powersync-sdk/sync-rules/TableQuerySchema.d.ts +9 -0
  191. package/dist/powersync-sdk/sync-rules/TableQuerySchema.js +41 -0
  192. package/dist/powersync-sdk/sync-rules/errors.d.ts +22 -0
  193. package/dist/powersync-sdk/sync-rules/errors.js +60 -0
  194. package/dist/powersync-sdk/sync-rules/generators.d.ts +6 -0
  195. package/dist/powersync-sdk/sync-rules/generators.js +6 -0
  196. package/dist/powersync-sdk/sync-rules/index.d.ts +17 -0
  197. package/dist/powersync-sdk/sync-rules/index.js +17 -0
  198. package/dist/powersync-sdk/sync-rules/json_schema.d.ts +3 -0
  199. package/dist/powersync-sdk/sync-rules/json_schema.js +50 -0
  200. package/dist/powersync-sdk/sync-rules/sql_filters.d.ts +91 -0
  201. package/dist/powersync-sdk/sync-rules/sql_filters.js +491 -0
  202. package/dist/powersync-sdk/sync-rules/sql_functions.d.ts +53 -0
  203. package/dist/powersync-sdk/sync-rules/sql_functions.js +755 -0
  204. package/dist/powersync-sdk/sync-rules/sql_support.d.ts +22 -0
  205. package/dist/powersync-sdk/sync-rules/sql_support.js +208 -0
  206. package/dist/powersync-sdk/sync-rules/types.d.ts +174 -0
  207. package/dist/powersync-sdk/sync-rules/types.js +9 -0
  208. package/dist/powersync-sdk/sync-rules/utils.d.ts +45 -0
  209. package/dist/powersync-sdk/sync-rules/utils.js +163 -0
  210. package/dist/service/accounts.client.d.ts +26 -0
  211. package/dist/service/accounts.client.js +26 -0
  212. package/dist/service/powersync.client.d.ts +269 -0
  213. package/dist/service/powersync.client.js +135 -0
  214. package/dist/service/types.d.ts +69 -0
  215. package/dist/service/types.js +1 -0
  216. package/dist/service/utils.d.ts +5 -0
  217. package/dist/service/utils.js +7 -0
  218. package/dist/utils.d.ts +6 -0
  219. package/dist/utils.js +52 -0
  220. package/oclif.manifest.json +514 -0
  221. package/package.json +81 -0
@@ -0,0 +1,327 @@
1
+ import * as t from 'ts-codec';
2
+ export declare const hostedSecretValue: t.ObjectCodec<{
3
+ secret: t.IdentityCodec<t.CodecType.String>;
4
+ }>;
5
+ export declare const hostedSecretRef: t.ObjectCodec<{
6
+ secret_ref: t.IdentityCodec<t.CodecType.String>;
7
+ }>;
8
+ export declare const hostedSecret: t.Union<t.Codec<{
9
+ secret: string;
10
+ }, {
11
+ secret: string;
12
+ }, string, t.CodecProps>, t.ObjectCodec<{
13
+ secret_ref: t.IdentityCodec<t.CodecType.String>;
14
+ }>>;
15
+ export type HostedSecret = t.Decoded<typeof hostedSecret>;
16
+ export type HostedSecretValue = t.Decoded<typeof hostedSecretValue>;
17
+ export type HostedSecretRef = t.Decoded<typeof hostedSecretRef>;
18
+ export declare function isHostedSecretValue(v: HostedSecret): v is HostedSecretValue;
19
+ export declare const hostedPostgresConnection: t.ObjectCodec<{
20
+ /** Required for verify-ca, optional for verify-full */
21
+ cacert: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
22
+ /** For mutual TLS */
23
+ client_certificate: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
24
+ client_private_key: t.OptionalCodec<t.Codec<{
25
+ secret: string;
26
+ } | {
27
+ secret_ref: string;
28
+ }, {
29
+ secret: string;
30
+ } | {
31
+ secret_ref: string;
32
+ }, string, t.CodecProps>>;
33
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
34
+ /** Expose execute-sql */
35
+ debug_api: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
36
+ hostname: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
37
+ /** Unique identifier for the connection - optional when a single connection is present. */
38
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
39
+ /** Descriptive name */
40
+ name: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
41
+ password: t.OptionalCodec<t.Codec<{
42
+ secret: string;
43
+ } | {
44
+ secret_ref: string;
45
+ }, {
46
+ secret: string;
47
+ } | {
48
+ secret_ref: string;
49
+ }, string, t.CodecProps>>;
50
+ port: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
51
+ /** Defaults to verify-full */
52
+ sslmode: t.OptionalCodec<t.Codec<"verify-full" | "verify-ca", "verify-full" | "verify-ca", string, t.CodecProps>>;
53
+ /** Tag used as reference in sync rules. Defaults to "default". Does not have to be unique. */
54
+ tag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
55
+ type: t.LiteralCodec<"postgresql">;
56
+ uri: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
57
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
58
+ }>;
59
+ export type HostedPostgresConnection = t.Encoded<typeof hostedPostgresConnection>;
60
+ export declare const hostedDemoConnection: t.ObjectCodec<{
61
+ tag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
62
+ type: t.LiteralCodec<"postgresql-demo">;
63
+ }>;
64
+ export declare const anyConnection: t.Union<t.Codec<{
65
+ type: "postgresql";
66
+ uri?: string | undefined;
67
+ hostname?: string | undefined;
68
+ port?: number | undefined;
69
+ name?: string | undefined;
70
+ id?: string | undefined;
71
+ cacert?: string | undefined;
72
+ client_certificate?: string | undefined;
73
+ client_private_key?: {
74
+ secret: string;
75
+ } | {
76
+ secret_ref: string;
77
+ } | undefined;
78
+ database?: string | undefined;
79
+ debug_api?: boolean | undefined;
80
+ password?: {
81
+ secret: string;
82
+ } | {
83
+ secret_ref: string;
84
+ } | undefined;
85
+ sslmode?: "verify-full" | "verify-ca" | undefined;
86
+ tag?: string | undefined;
87
+ username?: string | undefined;
88
+ }, {
89
+ type: "postgresql";
90
+ uri?: string | undefined;
91
+ hostname?: string | undefined;
92
+ port?: number | undefined;
93
+ name?: string | undefined;
94
+ id?: string | undefined;
95
+ cacert?: string | undefined;
96
+ client_certificate?: string | undefined;
97
+ client_private_key?: {
98
+ secret: string;
99
+ } | {
100
+ secret_ref: string;
101
+ } | undefined;
102
+ database?: string | undefined;
103
+ debug_api?: boolean | undefined;
104
+ password?: {
105
+ secret: string;
106
+ } | {
107
+ secret_ref: string;
108
+ } | undefined;
109
+ sslmode?: "verify-full" | "verify-ca" | undefined;
110
+ tag?: string | undefined;
111
+ username?: string | undefined;
112
+ }, string, t.CodecProps>, t.ObjectCodec<{
113
+ tag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
114
+ type: t.LiteralCodec<"postgresql-demo">;
115
+ }>>;
116
+ export type ReplicationConnection = t.Decoded<typeof anyConnection>;
117
+ export declare const jwkRSA: t.ObjectCodec<{
118
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
119
+ e: t.IdentityCodec<t.CodecType.String>;
120
+ kid: t.IdentityCodec<t.CodecType.String>;
121
+ kty: t.LiteralCodec<"RSA">;
122
+ n: t.IdentityCodec<t.CodecType.String>;
123
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
124
+ }>;
125
+ export declare const jwkHmac: t.ObjectCodec<{
126
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
127
+ k: t.Union<t.Codec<{
128
+ secret: string;
129
+ }, {
130
+ secret: string;
131
+ }, string, t.CodecProps>, t.ObjectCodec<{
132
+ secret_ref: t.IdentityCodec<t.CodecType.String>;
133
+ }>>;
134
+ kid: t.IdentityCodec<t.CodecType.String>;
135
+ kty: t.LiteralCodec<"oct">;
136
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
137
+ }>;
138
+ export declare const jwk: t.Union<t.ObjectCodec<{
139
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
140
+ e: t.IdentityCodec<t.CodecType.String>;
141
+ kid: t.IdentityCodec<t.CodecType.String>;
142
+ kty: t.LiteralCodec<"RSA">;
143
+ n: t.IdentityCodec<t.CodecType.String>;
144
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
145
+ }>, t.ObjectCodec<{
146
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
147
+ k: t.Union<t.Codec<{
148
+ secret: string;
149
+ }, {
150
+ secret: string;
151
+ }, string, t.CodecProps>, t.ObjectCodec<{
152
+ secret_ref: t.IdentityCodec<t.CodecType.String>;
153
+ }>>;
154
+ kid: t.IdentityCodec<t.CodecType.String>;
155
+ kty: t.LiteralCodec<"oct">;
156
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
157
+ }>>;
158
+ export declare const jwks: t.ObjectCodec<{
159
+ keys: t.ArrayCodec<t.Union<t.ObjectCodec<{
160
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
161
+ e: t.IdentityCodec<t.CodecType.String>;
162
+ kid: t.IdentityCodec<t.CodecType.String>;
163
+ kty: t.LiteralCodec<"RSA">;
164
+ n: t.IdentityCodec<t.CodecType.String>;
165
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
166
+ }>, t.ObjectCodec<{
167
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
168
+ k: t.Union<t.Codec<{
169
+ secret: string;
170
+ }, {
171
+ secret: string;
172
+ }, string, t.CodecProps>, t.ObjectCodec<{
173
+ secret_ref: t.IdentityCodec<t.CodecType.String>;
174
+ }>>;
175
+ kid: t.IdentityCodec<t.CodecType.String>;
176
+ kty: t.LiteralCodec<"oct">;
177
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
178
+ }>>>;
179
+ }>;
180
+ export type Jwk = t.Decoded<typeof jwk>;
181
+ export declare const powerSyncHostedConfig: t.ObjectCodec<{
182
+ api: t.OptionalCodec<t.Codec<{
183
+ tokens?: ({
184
+ secret: string;
185
+ } | {
186
+ secret_ref: string;
187
+ })[] | undefined;
188
+ }, {
189
+ tokens?: ({
190
+ secret: string;
191
+ } | {
192
+ secret_ref: string;
193
+ })[] | undefined;
194
+ }, string, t.CodecProps>>;
195
+ client_auth: t.OptionalCodec<t.Codec<{
196
+ additional_audiences?: string[] | undefined;
197
+ allow_temporary_tokens?: boolean | undefined;
198
+ jwks?: {
199
+ keys: ({
200
+ e: string;
201
+ kty: "RSA";
202
+ n: string;
203
+ kid: string;
204
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
205
+ use?: string | undefined;
206
+ } | {
207
+ k: {
208
+ secret: string;
209
+ } | {
210
+ secret_ref: string;
211
+ };
212
+ kty: "oct";
213
+ alg: "HS256" | "HS384" | "HS512";
214
+ kid: string;
215
+ use?: string | undefined;
216
+ })[];
217
+ } | undefined;
218
+ jwks_uri?: string | undefined;
219
+ supabase?: boolean | undefined;
220
+ }, {
221
+ additional_audiences?: string[] | undefined;
222
+ allow_temporary_tokens?: boolean | undefined;
223
+ jwks?: {
224
+ keys: ({
225
+ e: string;
226
+ kty: "RSA";
227
+ n: string;
228
+ kid: string;
229
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
230
+ use?: string | undefined;
231
+ } | {
232
+ k: {
233
+ secret: string;
234
+ } | {
235
+ secret_ref: string;
236
+ };
237
+ kty: "oct";
238
+ alg: "HS256" | "HS384" | "HS512";
239
+ kid: string;
240
+ use?: string | undefined;
241
+ })[];
242
+ } | undefined;
243
+ jwks_uri?: string | undefined;
244
+ supabase?: boolean | undefined;
245
+ }, string, t.CodecProps>>;
246
+ dev: t.OptionalCodec<t.Codec<{
247
+ crud_api?: boolean | undefined;
248
+ demo_auth?: boolean | undefined;
249
+ demo_client?: boolean | undefined;
250
+ demo_password?: {
251
+ secret: string;
252
+ } | {
253
+ secret_ref: string;
254
+ } | undefined;
255
+ }, {
256
+ crud_api?: boolean | undefined;
257
+ demo_auth?: boolean | undefined;
258
+ demo_client?: boolean | undefined;
259
+ demo_password?: {
260
+ secret: string;
261
+ } | {
262
+ secret_ref: string;
263
+ } | undefined;
264
+ }, string, t.CodecProps>>;
265
+ /** 'us' or 'eu' */
266
+ region: t.IdentityCodec<t.CodecType.String>;
267
+ replication: t.OptionalCodec<t.Codec<{
268
+ connections?: ({
269
+ type: "postgresql";
270
+ uri?: string | undefined;
271
+ hostname?: string | undefined;
272
+ port?: number | undefined;
273
+ name?: string | undefined;
274
+ id?: string | undefined;
275
+ cacert?: string | undefined;
276
+ client_certificate?: string | undefined;
277
+ client_private_key?: {
278
+ secret: string;
279
+ } | {
280
+ secret_ref: string;
281
+ } | undefined;
282
+ database?: string | undefined;
283
+ debug_api?: boolean | undefined;
284
+ password?: {
285
+ secret: string;
286
+ } | {
287
+ secret_ref: string;
288
+ } | undefined;
289
+ sslmode?: "verify-full" | "verify-ca" | undefined;
290
+ tag?: string | undefined;
291
+ username?: string | undefined;
292
+ } | {
293
+ type: "postgresql-demo";
294
+ tag?: string | undefined;
295
+ })[] | undefined;
296
+ }, {
297
+ connections?: ({
298
+ type: "postgresql";
299
+ uri?: string | undefined;
300
+ hostname?: string | undefined;
301
+ port?: number | undefined;
302
+ name?: string | undefined;
303
+ id?: string | undefined;
304
+ cacert?: string | undefined;
305
+ client_certificate?: string | undefined;
306
+ client_private_key?: {
307
+ secret: string;
308
+ } | {
309
+ secret_ref: string;
310
+ } | undefined;
311
+ database?: string | undefined;
312
+ debug_api?: boolean | undefined;
313
+ password?: {
314
+ secret: string;
315
+ } | {
316
+ secret_ref: string;
317
+ } | undefined;
318
+ sslmode?: "verify-full" | "verify-ca" | undefined;
319
+ tag?: string | undefined;
320
+ username?: string | undefined;
321
+ } | {
322
+ type: "postgresql-demo";
323
+ tag?: string | undefined;
324
+ })[] | undefined;
325
+ }, string, t.CodecProps>>;
326
+ }>;
327
+ export type PowerSyncHostedConfig = t.Decoded<typeof powerSyncHostedConfig>;
@@ -0,0 +1,92 @@
1
+ /* eslint-disable unicorn/filename-case */
2
+ /* eslint-disable camelcase */
3
+ import * as t from 'ts-codec';
4
+ export const hostedSecretValue = t.object({
5
+ secret: t.string
6
+ });
7
+ export const hostedSecretRef = t.object({
8
+ secret_ref: t.string
9
+ });
10
+ export const hostedSecret = hostedSecretValue.or(hostedSecretRef);
11
+ export function isHostedSecretValue(v) {
12
+ return typeof v.secret === 'string';
13
+ }
14
+ export const hostedPostgresConnection = t.object({
15
+ /** Required for verify-ca, optional for verify-full */
16
+ cacert: t.string.optional(),
17
+ /** For mutual TLS */
18
+ client_certificate: t.string.optional(),
19
+ client_private_key: hostedSecret.optional(),
20
+ database: t.string.optional(),
21
+ /** Expose execute-sql */
22
+ debug_api: t.boolean.optional(),
23
+ hostname: t.string.optional(),
24
+ /** Unique identifier for the connection - optional when a single connection is present. */
25
+ id: t.string.optional(),
26
+ /** Descriptive name */
27
+ name: t.string.optional(),
28
+ password: hostedSecret.optional(),
29
+ port: t.number.optional(),
30
+ /** Defaults to verify-full */
31
+ sslmode: t.literal('verify-full').or(t.literal('verify-ca')).optional(),
32
+ /** Tag used as reference in sync rules. Defaults to "default". Does not have to be unique. */
33
+ tag: t.string.optional(),
34
+ type: t.literal('postgresql'),
35
+ uri: t.string.optional(),
36
+ username: t.string.optional()
37
+ });
38
+ export const hostedDemoConnection = t.object({
39
+ tag: t.string.optional(),
40
+ type: t.literal('postgresql-demo')
41
+ });
42
+ export const anyConnection = hostedPostgresConnection.or(hostedDemoConnection);
43
+ export const jwkRSA = t.object({
44
+ alg: t.literal('RS256').or(t.literal('RS384')).or(t.literal('RS512')).optional(),
45
+ e: t.string,
46
+ kid: t.string,
47
+ kty: t.literal('RSA'),
48
+ n: t.string,
49
+ use: t.string.optional()
50
+ });
51
+ export const jwkHmac = t.object({
52
+ alg: t.literal('HS256').or(t.literal('HS384')).or(t.literal('HS512')),
53
+ k: hostedSecret,
54
+ kid: t.string,
55
+ kty: t.literal('oct'),
56
+ use: t.string.optional()
57
+ });
58
+ export const jwk = t.union(jwkRSA, jwkHmac);
59
+ export const jwks = t.object({
60
+ keys: t.array(jwk)
61
+ });
62
+ export const powerSyncHostedConfig = t.object({
63
+ api: t
64
+ .object({
65
+ tokens: t.array(hostedSecret).optional()
66
+ })
67
+ .optional(),
68
+ client_auth: t
69
+ .object({
70
+ additional_audiences: t.array(t.string).optional(),
71
+ allow_temporary_tokens: t.boolean.optional(),
72
+ jwks: jwks.optional(),
73
+ jwks_uri: t.string.optional(),
74
+ supabase: t.boolean.optional()
75
+ })
76
+ .optional(),
77
+ dev: t
78
+ .object({
79
+ crud_api: t.boolean.optional(),
80
+ demo_auth: t.boolean.optional(),
81
+ demo_client: t.boolean.optional(),
82
+ demo_password: hostedSecret.optional()
83
+ })
84
+ .optional(),
85
+ /** 'us' or 'eu' */
86
+ region: t.string,
87
+ replication: t
88
+ .object({
89
+ connections: t.array(anyConnection).optional()
90
+ })
91
+ .optional()
92
+ });
@@ -0,0 +1,211 @@
1
+ import * as t from 'ts-codec';
2
+ export declare const postgresConnection: t.ObjectCodec<{
3
+ /** Required for verify-ca, optional for verify-full */
4
+ cacert: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
5
+ client_certificate: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
6
+ client_private_key: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
7
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
8
+ /** Expose "execute-sql" */
9
+ debug_api: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
10
+ /** Expose database credentials */
11
+ demo_database: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
12
+ hostname: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
13
+ /** Unique identifier for the connection - optional when a single connection is present. */
14
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
15
+ password: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
16
+ port: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
17
+ /**
18
+ * Prefix for the slot name. Defaults to "powersync_"
19
+ */
20
+ slot_name_prefix: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
21
+ /** Defaults to verify-full */
22
+ sslmode: t.OptionalCodec<t.Codec<"verify-full" | "verify-ca" | "disable", "verify-full" | "verify-ca" | "disable", string, t.CodecProps>>;
23
+ /** Tag used as reference in sync rules. Defaults to "default". Does not have to be unique. */
24
+ tag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
25
+ type: t.LiteralCodec<"postgresql">;
26
+ uri: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
27
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
28
+ }>;
29
+ export type PostgresConnection = t.Decoded<typeof postgresConnection>;
30
+ export declare const jwkRSA: t.ObjectCodec<{
31
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
32
+ e: t.IdentityCodec<t.CodecType.String>;
33
+ kid: t.IdentityCodec<t.CodecType.String>;
34
+ kty: t.LiteralCodec<"RSA">;
35
+ n: t.IdentityCodec<t.CodecType.String>;
36
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
37
+ }>;
38
+ export declare const jwkHmac: t.ObjectCodec<{
39
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
40
+ k: t.IdentityCodec<t.CodecType.String>;
41
+ /**
42
+ * undefined kid indicates it can match any JWT, with or without a kid.
43
+ * Use a kid wherever possible.
44
+ */
45
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
46
+ kty: t.LiteralCodec<"oct">;
47
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
48
+ }>;
49
+ declare const jwk: t.Union<t.ObjectCodec<{
50
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
51
+ e: t.IdentityCodec<t.CodecType.String>;
52
+ kid: t.IdentityCodec<t.CodecType.String>;
53
+ kty: t.LiteralCodec<"RSA">;
54
+ n: t.IdentityCodec<t.CodecType.String>;
55
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
56
+ }>, t.ObjectCodec<{
57
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
58
+ k: t.IdentityCodec<t.CodecType.String>;
59
+ /**
60
+ * undefined kid indicates it can match any JWT, with or without a kid.
61
+ * Use a kid wherever possible.
62
+ */
63
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
64
+ kty: t.LiteralCodec<"oct">;
65
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
66
+ }>>;
67
+ export declare const strictJwks: t.ObjectCodec<{
68
+ keys: t.ArrayCodec<t.Union<t.ObjectCodec<{
69
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
70
+ e: t.IdentityCodec<t.CodecType.String>;
71
+ kid: t.IdentityCodec<t.CodecType.String>;
72
+ kty: t.LiteralCodec<"RSA">;
73
+ n: t.IdentityCodec<t.CodecType.String>;
74
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
75
+ }>, t.ObjectCodec<{
76
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
77
+ k: t.IdentityCodec<t.CodecType.String>;
78
+ /**
79
+ * undefined kid indicates it can match any JWT, with or without a kid.
80
+ * Use a kid wherever possible.
81
+ */
82
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
83
+ kty: t.LiteralCodec<"oct">;
84
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
85
+ }>>>;
86
+ }>;
87
+ export type StrictJwk = t.Decoded<typeof jwk>;
88
+ export declare const storageConfig: t.ObjectCodec<{
89
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
90
+ password: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
91
+ type: t.LiteralCodec<"mongodb">;
92
+ uri: t.IdentityCodec<t.CodecType.String>;
93
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
94
+ }>;
95
+ export type StorageConfig = t.Decoded<typeof storageConfig>;
96
+ export declare const powerSyncConfig: t.ObjectCodec<{
97
+ api: t.OptionalCodec<t.Codec<{
98
+ tokens?: string[] | undefined;
99
+ }, {
100
+ tokens?: string[] | undefined;
101
+ }, string, t.CodecProps>>;
102
+ client_auth: t.OptionalCodec<t.Codec<{
103
+ jwks?: {
104
+ keys: ({
105
+ e: string;
106
+ kty: "RSA";
107
+ n: string;
108
+ kid: string;
109
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
110
+ use?: string | undefined;
111
+ } | {
112
+ k: string;
113
+ kty: "oct";
114
+ alg: "HS256" | "HS384" | "HS512";
115
+ kid?: string | undefined;
116
+ use?: string | undefined;
117
+ })[];
118
+ } | undefined;
119
+ jwks_uri?: string | string[] | undefined;
120
+ supabase?: boolean | undefined;
121
+ audience?: string[] | undefined;
122
+ }, {
123
+ jwks?: {
124
+ keys: ({
125
+ e: string;
126
+ kty: "RSA";
127
+ n: string;
128
+ kid: string;
129
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
130
+ use?: string | undefined;
131
+ } | {
132
+ k: string;
133
+ kty: "oct";
134
+ alg: "HS256" | "HS384" | "HS512";
135
+ kid?: string | undefined;
136
+ use?: string | undefined;
137
+ })[];
138
+ } | undefined;
139
+ jwks_uri?: string | string[] | undefined;
140
+ supabase?: boolean | undefined;
141
+ audience?: string[] | undefined;
142
+ }, string, t.CodecProps>>;
143
+ dev: t.OptionalCodec<t.Codec<{
144
+ crud_api?: boolean | undefined;
145
+ demo_auth?: boolean | undefined;
146
+ demo_client?: boolean | undefined;
147
+ demo_password?: string | undefined;
148
+ }, {
149
+ crud_api?: boolean | undefined;
150
+ demo_auth?: boolean | undefined;
151
+ demo_client?: boolean | undefined;
152
+ demo_password?: string | undefined;
153
+ }, string, t.CodecProps>>;
154
+ metadata: t.OptionalCodec<t.Codec<Record<string, string>, Record<string, string>, string, t.CodecProps>>;
155
+ port: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
156
+ replication: t.OptionalCodec<t.Codec<{
157
+ connections?: {
158
+ type: "postgresql";
159
+ uri?: string | undefined;
160
+ hostname?: string | undefined;
161
+ port?: number | undefined;
162
+ id?: string | undefined;
163
+ cacert?: string | undefined;
164
+ client_certificate?: string | undefined;
165
+ client_private_key?: string | undefined;
166
+ database?: string | undefined;
167
+ debug_api?: boolean | undefined;
168
+ password?: string | undefined;
169
+ sslmode?: "verify-full" | "verify-ca" | "disable" | undefined;
170
+ tag?: string | undefined;
171
+ username?: string | undefined;
172
+ demo_database?: boolean | undefined;
173
+ slot_name_prefix?: string | undefined;
174
+ }[] | undefined;
175
+ }, {
176
+ connections?: {
177
+ type: "postgresql";
178
+ uri?: string | undefined;
179
+ hostname?: string | undefined;
180
+ port?: number | undefined;
181
+ id?: string | undefined;
182
+ cacert?: string | undefined;
183
+ client_certificate?: string | undefined;
184
+ client_private_key?: string | undefined;
185
+ database?: string | undefined;
186
+ debug_api?: boolean | undefined;
187
+ password?: string | undefined;
188
+ sslmode?: "verify-full" | "verify-ca" | "disable" | undefined;
189
+ tag?: string | undefined;
190
+ username?: string | undefined;
191
+ demo_database?: boolean | undefined;
192
+ slot_name_prefix?: string | undefined;
193
+ }[] | undefined;
194
+ }, string, t.CodecProps>>;
195
+ storage: t.ObjectCodec<{
196
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
197
+ password: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
198
+ type: t.LiteralCodec<"mongodb">;
199
+ uri: t.IdentityCodec<t.CodecType.String>;
200
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
201
+ }>;
202
+ sync_rules: t.OptionalCodec<t.Codec<{
203
+ path?: string | undefined;
204
+ content?: string | undefined;
205
+ }, {
206
+ path?: string | undefined;
207
+ content?: string | undefined;
208
+ }, string, t.CodecProps>>;
209
+ }>;
210
+ export type PowerSyncConfig = t.Decoded<typeof powerSyncConfig>;
211
+ export {};