@powersync/service-types 0.0.0-dev-20240918082156

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/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # @powersync/service-types
2
+
3
+ ## 0.0.0-dev-20240918082156
4
+
5
+ ### Minor Changes
6
+
7
+ - d51921f: - Introduced modules to the powersync service architecture
8
+ - Core functionality has been moved to "engine" classes. Modules can register additional functionality with these engines.
9
+ - The sync API functionality used by the routes has been abstracted to an interface. API routes are now managed by the RouterEngine.
10
+ - Replication is managed by the ReplicationEngine and new replication data sources can be registered to the engine by modules.
11
+ - Refactored existing Postgres replication as a module.
12
+ - Removed Postgres specific code from the core service packages.
13
+
14
+ ## 0.2.0
15
+
16
+ ### Minor Changes
17
+
18
+ - c9ad713: Removed unused development routes
19
+
20
+ ## 0.1.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 3d9feb2: Added the ability to capture anonymous usage metrics
25
+
26
+ ## 0.0.2
27
+
28
+ ### Patch Changes
29
+
30
+ - 285f368: Initial public release
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.
@@ -0,0 +1,216 @@
1
+ import * as t from 'ts-codec';
2
+ /**
3
+ * Users might specify ports as strings if using YAML custom tag environment substitutions
4
+ */
5
+ export declare const portCodec: t.Codec<number, string | number, string, t.CodecProps>;
6
+ /**
7
+ * This gets used whenever generating a JSON schema
8
+ */
9
+ export declare const portParser: {
10
+ tag: string;
11
+ parse: () => {
12
+ anyOf: {
13
+ type: string;
14
+ }[];
15
+ };
16
+ };
17
+ export declare const dataSourceConfig: t.ObjectCodec<{
18
+ type: t.IdentityCodec<t.CodecType.String>;
19
+ /** Unique identifier for the connection - optional when a single connection is present. */
20
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
21
+ /** Additional meta tag for connection */
22
+ tag: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
23
+ /**
24
+ * Allows for debug query execution
25
+ */
26
+ debug_api: t.OptionalCodec<t.Codec<boolean, boolean, string, t.CodecProps>>;
27
+ }>;
28
+ export type DataSourceConfig = t.Decoded<typeof dataSourceConfig>;
29
+ /**
30
+ * This essentially allows any extra fields on this type
31
+ */
32
+ export declare const genericDataSourceConfig: t.Intersection<t.Codec<{
33
+ type: string;
34
+ id?: string | undefined;
35
+ tag?: string | undefined;
36
+ debug_api?: boolean | undefined;
37
+ }, {
38
+ type: string;
39
+ id?: string | undefined;
40
+ tag?: string | undefined;
41
+ debug_api?: boolean | undefined;
42
+ }, string, t.CodecProps>, t.RecordCodec<t.Codec<any, any, t.CodecType.Any, t.CodecProps>>>;
43
+ export type GenericDataSourceConfig = t.Decoded<typeof genericDataSourceConfig>;
44
+ export declare const jwkRSA: t.ObjectCodec<{
45
+ kty: t.LiteralCodec<"RSA">;
46
+ kid: t.IdentityCodec<t.CodecType.String>;
47
+ n: t.IdentityCodec<t.CodecType.String>;
48
+ e: t.IdentityCodec<t.CodecType.String>;
49
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
50
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
51
+ }>;
52
+ export declare const jwkHmac: t.ObjectCodec<{
53
+ kty: t.LiteralCodec<"oct">;
54
+ /**
55
+ * undefined kid indicates it can match any JWT, with or without a kid.
56
+ * Use a kid wherever possible.
57
+ */
58
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
59
+ k: t.IdentityCodec<t.CodecType.String>;
60
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
61
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
62
+ }>;
63
+ declare const jwk: t.Union<t.ObjectCodec<{
64
+ kty: t.LiteralCodec<"RSA">;
65
+ kid: t.IdentityCodec<t.CodecType.String>;
66
+ n: t.IdentityCodec<t.CodecType.String>;
67
+ e: t.IdentityCodec<t.CodecType.String>;
68
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
69
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
70
+ }>, t.ObjectCodec<{
71
+ kty: t.LiteralCodec<"oct">;
72
+ /**
73
+ * undefined kid indicates it can match any JWT, with or without a kid.
74
+ * Use a kid wherever possible.
75
+ */
76
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
77
+ k: t.IdentityCodec<t.CodecType.String>;
78
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
79
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
80
+ }>>;
81
+ export declare const strictJwks: t.ObjectCodec<{
82
+ keys: t.ArrayCodec<t.Union<t.ObjectCodec<{
83
+ kty: t.LiteralCodec<"RSA">;
84
+ kid: t.IdentityCodec<t.CodecType.String>;
85
+ n: t.IdentityCodec<t.CodecType.String>;
86
+ e: t.IdentityCodec<t.CodecType.String>;
87
+ alg: t.OptionalCodec<t.Codec<"RS256" | "RS384" | "RS512", "RS256" | "RS384" | "RS512", string, t.CodecProps>>;
88
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
89
+ }>, t.ObjectCodec<{
90
+ kty: t.LiteralCodec<"oct">;
91
+ /**
92
+ * undefined kid indicates it can match any JWT, with or without a kid.
93
+ * Use a kid wherever possible.
94
+ */
95
+ kid: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
96
+ k: t.IdentityCodec<t.CodecType.String>;
97
+ alg: t.Union<t.Codec<"HS256" | "HS384", "HS256" | "HS384", string, t.CodecProps>, t.LiteralCodec<"HS512">>;
98
+ use: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
99
+ }>>>;
100
+ }>;
101
+ export type StrictJwk = t.Decoded<typeof jwk>;
102
+ export declare const storageConfig: t.ObjectCodec<{
103
+ type: t.LiteralCodec<"mongodb">;
104
+ uri: t.IdentityCodec<t.CodecType.String>;
105
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
106
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
107
+ password: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
108
+ }>;
109
+ export type StorageConfig = t.Decoded<typeof storageConfig>;
110
+ export declare const powerSyncConfig: t.ObjectCodec<{
111
+ replication: t.OptionalCodec<t.Codec<{
112
+ connections?: ({
113
+ type: string;
114
+ id?: string | undefined;
115
+ tag?: string | undefined;
116
+ debug_api?: boolean | undefined;
117
+ } & Record<string, any>)[] | undefined;
118
+ }, {
119
+ connections?: ({
120
+ type: string;
121
+ id?: string | undefined;
122
+ tag?: string | undefined;
123
+ debug_api?: boolean | undefined;
124
+ } & Record<string, any>)[] | undefined;
125
+ }, string, t.CodecProps>>;
126
+ dev: t.OptionalCodec<t.Codec<{
127
+ demo_auth?: boolean | undefined;
128
+ demo_password?: string | undefined;
129
+ crud_api?: boolean | undefined;
130
+ demo_client?: boolean | undefined;
131
+ }, {
132
+ demo_auth?: boolean | undefined;
133
+ demo_password?: string | undefined;
134
+ crud_api?: boolean | undefined;
135
+ demo_client?: boolean | undefined;
136
+ }, string, t.CodecProps>>;
137
+ client_auth: t.OptionalCodec<t.Codec<{
138
+ jwks_uri?: string | string[] | undefined;
139
+ block_local_jwks?: boolean | undefined;
140
+ jwks?: {
141
+ keys: ({
142
+ kty: "RSA";
143
+ kid: string;
144
+ n: string;
145
+ e: string;
146
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
147
+ use?: string | undefined;
148
+ } | {
149
+ kty: "oct";
150
+ alg: "HS256" | "HS384" | "HS512";
151
+ k: string;
152
+ kid?: string | undefined;
153
+ use?: string | undefined;
154
+ })[];
155
+ } | undefined;
156
+ supabase?: boolean | undefined;
157
+ audience?: string[] | undefined;
158
+ }, {
159
+ jwks_uri?: string | string[] | undefined;
160
+ block_local_jwks?: boolean | undefined;
161
+ jwks?: {
162
+ keys: ({
163
+ kty: "RSA";
164
+ kid: string;
165
+ n: string;
166
+ e: string;
167
+ alg?: "RS256" | "RS384" | "RS512" | undefined;
168
+ use?: string | undefined;
169
+ } | {
170
+ kty: "oct";
171
+ alg: "HS256" | "HS384" | "HS512";
172
+ k: string;
173
+ kid?: string | undefined;
174
+ use?: string | undefined;
175
+ })[];
176
+ } | undefined;
177
+ supabase?: boolean | undefined;
178
+ audience?: string[] | undefined;
179
+ }, string, t.CodecProps>>;
180
+ api: t.OptionalCodec<t.Codec<{
181
+ tokens?: string[] | undefined;
182
+ }, {
183
+ tokens?: string[] | undefined;
184
+ }, string, t.CodecProps>>;
185
+ storage: t.ObjectCodec<{
186
+ type: t.LiteralCodec<"mongodb">;
187
+ uri: t.IdentityCodec<t.CodecType.String>;
188
+ database: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
189
+ username: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
190
+ password: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
191
+ }>;
192
+ port: t.OptionalCodec<t.Codec<number, string | number, string, t.CodecProps>>;
193
+ sync_rules: t.OptionalCodec<t.Codec<{
194
+ content?: string | undefined;
195
+ path?: string | undefined;
196
+ }, {
197
+ content?: string | undefined;
198
+ path?: string | undefined;
199
+ }, string, t.CodecProps>>;
200
+ metadata: t.OptionalCodec<t.Codec<Record<string, string>, Record<string, string>, string, t.CodecProps>>;
201
+ migrations: t.OptionalCodec<t.Codec<{
202
+ disable_auto_migration?: boolean | undefined;
203
+ }, {
204
+ disable_auto_migration?: boolean | undefined;
205
+ }, string, t.CodecProps>>;
206
+ telemetry: t.OptionalCodec<t.Codec<{
207
+ disable_telemetry_sharing: boolean;
208
+ internal_service_endpoint?: string | undefined;
209
+ }, {
210
+ disable_telemetry_sharing: boolean;
211
+ internal_service_endpoint?: string | undefined;
212
+ }, string, t.CodecProps>>;
213
+ }>;
214
+ export type PowerSyncConfig = t.Decoded<typeof powerSyncConfig>;
215
+ export type SerializedPowerSyncConfig = t.Encoded<typeof powerSyncConfig>;
216
+ export {};
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.powerSyncConfig = exports.storageConfig = exports.strictJwks = exports.jwkHmac = exports.jwkRSA = exports.genericDataSourceConfig = exports.dataSourceConfig = exports.portParser = exports.portCodec = void 0;
27
+ const t = __importStar(require("ts-codec"));
28
+ /**
29
+ * Users might specify ports as strings if using YAML custom tag environment substitutions
30
+ */
31
+ exports.portCodec = t.codec('Port', (value) => value, (value) => (typeof value == 'number' ? value : parseInt(value)));
32
+ /**
33
+ * This gets used whenever generating a JSON schema
34
+ */
35
+ exports.portParser = {
36
+ tag: exports.portCodec._tag,
37
+ parse: () => ({
38
+ anyOf: [{ type: 'number' }, { type: 'string' }]
39
+ })
40
+ };
41
+ exports.dataSourceConfig = t.object({
42
+ // Unique string identifier for the data source
43
+ type: t.string,
44
+ /** Unique identifier for the connection - optional when a single connection is present. */
45
+ id: t.string.optional(),
46
+ /** Additional meta tag for connection */
47
+ tag: t.string.optional(),
48
+ /**
49
+ * Allows for debug query execution
50
+ */
51
+ debug_api: t.boolean.optional()
52
+ });
53
+ /**
54
+ * This essentially allows any extra fields on this type
55
+ */
56
+ exports.genericDataSourceConfig = exports.dataSourceConfig.and(t.record(t.any));
57
+ exports.jwkRSA = t.object({
58
+ kty: t.literal('RSA'),
59
+ kid: t.string,
60
+ n: t.string,
61
+ e: t.string,
62
+ alg: t.literal('RS256').or(t.literal('RS384')).or(t.literal('RS512')).optional(),
63
+ use: t.string.optional()
64
+ });
65
+ exports.jwkHmac = t.object({
66
+ kty: t.literal('oct'),
67
+ /**
68
+ * undefined kid indicates it can match any JWT, with or without a kid.
69
+ * Use a kid wherever possible.
70
+ */
71
+ kid: t.string.optional(),
72
+ k: t.string,
73
+ alg: t.literal('HS256').or(t.literal('HS384')).or(t.literal('HS512')),
74
+ use: t.string.optional()
75
+ });
76
+ const jwk = t.union(exports.jwkRSA, exports.jwkHmac);
77
+ exports.strictJwks = t.object({
78
+ keys: t.array(jwk)
79
+ });
80
+ exports.storageConfig = t.object({
81
+ type: t.literal('mongodb'),
82
+ uri: t.string,
83
+ database: t.string.optional(),
84
+ username: t.string.optional(),
85
+ password: t.string.optional()
86
+ });
87
+ exports.powerSyncConfig = t.object({
88
+ replication: t
89
+ .object({
90
+ // This uses the generic config which may have additional fields
91
+ connections: t.array(exports.genericDataSourceConfig).optional()
92
+ })
93
+ .optional(),
94
+ dev: t
95
+ .object({
96
+ demo_auth: t.boolean.optional(),
97
+ demo_password: t.string.optional(),
98
+ crud_api: t.boolean.optional(),
99
+ demo_client: t.boolean.optional()
100
+ })
101
+ .optional(),
102
+ client_auth: t
103
+ .object({
104
+ jwks_uri: t.string.or(t.array(t.string)).optional(),
105
+ block_local_jwks: t.boolean.optional(),
106
+ jwks: exports.strictJwks.optional(),
107
+ supabase: t.boolean.optional(),
108
+ audience: t.array(t.string).optional()
109
+ })
110
+ .optional(),
111
+ api: t
112
+ .object({
113
+ tokens: t.array(t.string).optional()
114
+ })
115
+ .optional(),
116
+ storage: exports.storageConfig,
117
+ port: exports.portCodec.optional(),
118
+ sync_rules: t
119
+ .object({
120
+ path: t.string.optional(),
121
+ content: t.string.optional()
122
+ })
123
+ .optional(),
124
+ metadata: t.record(t.string).optional(),
125
+ migrations: t
126
+ .object({
127
+ disable_auto_migration: t.boolean.optional()
128
+ })
129
+ .optional(),
130
+ telemetry: t
131
+ .object({
132
+ disable_telemetry_sharing: t.boolean,
133
+ internal_service_endpoint: t.string.optional()
134
+ })
135
+ .optional()
136
+ });
137
+ //# sourceMappingURL=PowerSyncConfig.js.map
@@ -0,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E,iBAAS,CAAC,QAAQ,EAAE;IAC1B,UAAU,EAAE,CAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;KAC7B,CAAC;SACD,QAAQ,EAAE;IAEb,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAEvC,UAAU,EAAE,CAAC;SACV,MAAM,CAAC;QACN,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE;KAC7C,CAAC;SACD,QAAQ,EAAE;IAEb,SAAS,EAAE,CAAC;SACT,MAAM,CAAC;QACN,yBAAyB,EAAE,CAAC,CAAC,OAAO;QACpC,yBAAyB,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;KAC/C,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/config/normalize.ts"],"names":[],"mappings":""}
@@ -0,0 +1,150 @@
1
+ import * as t from 'ts-codec';
2
+ export declare const ReplicationError: t.ObjectCodec<{
3
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
4
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
5
+ message: t.IdentityCodec<t.CodecType.String>;
6
+ }>;
7
+ export type ReplicationError = t.Encoded<typeof ReplicationError>;
8
+ export declare const TableInfo: t.ObjectCodec<{
9
+ schema: t.IdentityCodec<t.CodecType.String>;
10
+ name: t.IdentityCodec<t.CodecType.String>;
11
+ /** Specified if this table is part of a wildcard pattern. */
12
+ pattern: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
13
+ /** Usually just ['id'] */
14
+ replication_id: t.ArrayCodec<t.IdentityCodec<t.CodecType.String>>;
15
+ /** Used in data replication */
16
+ data_queries: t.IdentityCodec<t.CodecType.Boolean>;
17
+ /** Used for parameter query replication */
18
+ parameter_queries: t.IdentityCodec<t.CodecType.Boolean>;
19
+ /** Also included in the global errors array. */
20
+ errors: t.ArrayCodec<t.ObjectCodec<{
21
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
22
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
23
+ message: t.IdentityCodec<t.CodecType.String>;
24
+ }>>;
25
+ }>;
26
+ export type TableInfo = t.Encoded<typeof TableInfo>;
27
+ export declare const SyncRulesStatus: t.ObjectCodec<{
28
+ content: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
29
+ connections: t.ArrayCodec<t.ObjectCodec<{
30
+ id: t.IdentityCodec<t.CodecType.String>;
31
+ tag: t.IdentityCodec<t.CodecType.String>;
32
+ /**
33
+ * PostgreSQL logical replication slot name.
34
+ */
35
+ slot_name: t.IdentityCodec<t.CodecType.String>;
36
+ /**
37
+ * Once initial replication is done, this moves over to
38
+ * logical replication.
39
+ */
40
+ initial_replication_done: t.IdentityCodec<t.CodecType.Boolean>;
41
+ /**
42
+ * The last LSN that has been replicated. This may be in the middle of a transaction.
43
+ */
44
+ last_lsn: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
45
+ /**
46
+ * The last time any replication activity was recorded.
47
+ *
48
+ * This is typically (but not always) updated together with last_lsn
49
+ */
50
+ last_keepalive_ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
51
+ /**
52
+ * The last time we created a new checkpoint. In other words, a transaction
53
+ * was successfully replicated.
54
+ */
55
+ last_checkpoint_ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
56
+ /** Replication lag in bytes. undefined if we cannot calculate this. */
57
+ replication_lag_bytes: t.OptionalCodec<t.Codec<number, number, string, t.CodecProps>>;
58
+ tables: t.ArrayCodec<t.ObjectCodec<{
59
+ schema: t.IdentityCodec<t.CodecType.String>;
60
+ name: t.IdentityCodec<t.CodecType.String>;
61
+ /** Specified if this table is part of a wildcard pattern. */
62
+ pattern: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
63
+ /** Usually just ['id'] */
64
+ replication_id: t.ArrayCodec<t.IdentityCodec<t.CodecType.String>>;
65
+ /** Used in data replication */
66
+ data_queries: t.IdentityCodec<t.CodecType.Boolean>;
67
+ /** Used for parameter query replication */
68
+ parameter_queries: t.IdentityCodec<t.CodecType.Boolean>;
69
+ /** Also included in the global errors array. */
70
+ errors: t.ArrayCodec<t.ObjectCodec<{
71
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
72
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
73
+ message: t.IdentityCodec<t.CodecType.String>;
74
+ }>>;
75
+ }>>;
76
+ }>>;
77
+ /** Sync-rule-level errors */
78
+ errors: t.ArrayCodec<t.ObjectCodec<{
79
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
80
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
81
+ message: t.IdentityCodec<t.CodecType.String>;
82
+ }>>;
83
+ }>;
84
+ export type SyncRulesStatus = t.Encoded<typeof SyncRulesStatus>;
85
+ export declare const ConnectionStatus: t.ObjectCodec<{
86
+ id: t.IdentityCodec<t.CodecType.String>;
87
+ postgres_uri: t.IdentityCodec<t.CodecType.String>;
88
+ connected: t.IdentityCodec<t.CodecType.Boolean>;
89
+ /** Connection-level errors */
90
+ errors: t.ArrayCodec<t.ObjectCodec<{
91
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
92
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
93
+ message: t.IdentityCodec<t.CodecType.String>;
94
+ }>>;
95
+ }>;
96
+ export type ConnectionStatus = t.Encoded<typeof ConnectionStatus>;
97
+ export declare const ConnectionStatusV2: t.ObjectCodec<{
98
+ id: t.IdentityCodec<t.CodecType.String>;
99
+ uri: t.IdentityCodec<t.CodecType.String>;
100
+ connected: t.IdentityCodec<t.CodecType.Boolean>;
101
+ /** Connection-level errors */
102
+ errors: t.ArrayCodec<t.ObjectCodec<{
103
+ /** Warning: Could indicate an issue. Fatal: Prevents replicating. */
104
+ level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
105
+ message: t.IdentityCodec<t.CodecType.String>;
106
+ }>>;
107
+ }>;
108
+ export type ConnectionStatusV2 = t.Encoded<typeof ConnectionStatusV2>;
109
+ export declare const DatabaseSchema: t.ObjectCodec<{
110
+ name: t.IdentityCodec<t.CodecType.String>;
111
+ tables: t.ArrayCodec<t.ObjectCodec<{
112
+ name: t.IdentityCodec<t.CodecType.String>;
113
+ columns: t.ArrayCodec<t.ObjectCodec<{
114
+ name: t.IdentityCodec<t.CodecType.String>;
115
+ /**
116
+ * Full type name, e.g. "character varying(255)[]"
117
+ */
118
+ type: t.IdentityCodec<t.CodecType.String>;
119
+ /**
120
+ * Internal postgres type, e.g. "varchar[]".
121
+ */
122
+ pg_type: t.IdentityCodec<t.CodecType.String>;
123
+ }>>;
124
+ }>>;
125
+ }>;
126
+ export type DatabaseSchema = t.Encoded<typeof DatabaseSchema>;
127
+ export declare const InstanceSchema: t.ObjectCodec<{
128
+ connections: t.ArrayCodec<t.ObjectCodec<{
129
+ id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
130
+ tag: t.IdentityCodec<t.CodecType.String>;
131
+ schemas: t.ArrayCodec<t.ObjectCodec<{
132
+ name: t.IdentityCodec<t.CodecType.String>;
133
+ tables: t.ArrayCodec<t.ObjectCodec<{
134
+ name: t.IdentityCodec<t.CodecType.String>;
135
+ columns: t.ArrayCodec<t.ObjectCodec<{
136
+ name: t.IdentityCodec<t.CodecType.String>;
137
+ /**
138
+ * Full type name, e.g. "character varying(255)[]"
139
+ */
140
+ type: t.IdentityCodec<t.CodecType.String>;
141
+ /**
142
+ * Internal postgres type, e.g. "varchar[]".
143
+ */
144
+ pg_type: t.IdentityCodec<t.CodecType.String>;
145
+ }>>;
146
+ }>>;
147
+ }>>;
148
+ }>>;
149
+ }>;
150
+ export type InstanceSchema = t.Encoded<typeof InstanceSchema>;