Skip to content

Commit c9ad713

Browse files
chore: remove unused dev routes (#51)
1 parent 7b74e10 commit c9ad713

File tree

6 files changed

+9
-241
lines changed

6 files changed

+9
-241
lines changed

.changeset/nervous-wasps-drive.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@powersync/service-core': minor
3+
'@powersync/service-types': minor
4+
---
5+
6+
Removed unused development routes

packages/service-core/src/routes/configure-fastify.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as system from '../system/system-index.js';
55

66
import { ADMIN_ROUTES } from './endpoints/admin.js';
77
import { CHECKPOINT_ROUTES } from './endpoints/checkpointing.js';
8-
import { DEV_ROUTES } from './endpoints/dev.js';
98
import { SYNC_RULES_ROUTES } from './endpoints/sync-rules.js';
109
import { SYNC_STREAM_ROUTES } from './endpoints/sync-stream.js';
1110
import { createRequestQueueHook, CreateRequestQueueParams } from './hooks.js';
@@ -36,7 +35,7 @@ export type FastifyServerConfig = {
3635

3736
export const DEFAULT_ROUTE_OPTIONS = {
3837
api: {
39-
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...DEV_ROUTES, ...SYNC_RULES_ROUTES],
38+
routes: [...ADMIN_ROUTES, ...CHECKPOINT_ROUTES, ...SYNC_RULES_ROUTES],
4039
queueOptions: {
4140
concurrency: 10,
4241
max_queue_depth: 20

packages/service-core/src/routes/endpoints/admin.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,9 @@ import { internal_routes } from '@powersync/service-types';
55
import * as api from '../../api/api-index.js';
66
import * as util from '../../util/util-index.js';
77

8-
import { routeDefinition } from '../router.js';
98
import { PersistedSyncRulesContent } from '../../storage/BucketStorage.js';
109
import { authApi } from '../auth.js';
11-
12-
const demoCredentials = routeDefinition({
13-
path: '/api/admin/v1/demo-credentials',
14-
method: router.HTTPMethod.POST,
15-
authorize: authApi,
16-
validator: schema.createTsCodecValidator(internal_routes.DemoCredentialsRequest, {
17-
allowAdditional: true
18-
}),
19-
handler: async (payload) => {
20-
const connection = payload.context.system.config.connection;
21-
if (connection == null || !connection.demo_database) {
22-
return internal_routes.DemoCredentialsResponse.encode({});
23-
}
24-
25-
const uri = util.buildDemoPgUri(connection);
26-
return internal_routes.DemoCredentialsResponse.encode({
27-
credentials: {
28-
postgres_uri: uri
29-
}
30-
});
31-
}
32-
});
10+
import { routeDefinition } from '../router.js';
3311

3412
export const executeSql = routeDefinition({
3513
path: '/api/admin/v1/execute-sql',
@@ -234,4 +212,4 @@ function mapColumnValue(value: SqliteValue) {
234212
}
235213
}
236214

237-
export const ADMIN_ROUTES = [demoCredentials, executeSql, diagnostics, getSchema, reprocess, validate];
215+
export const ADMIN_ROUTES = [executeSql, diagnostics, getSchema, reprocess, validate];

packages/service-core/src/routes/endpoints/dev.ts

Lines changed: 0 additions & 199 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './admin.js';
22
export * from './checkpointing.js';
3-
export * from './dev.js';
43
export * from './socket-route.js';
54
export * from './sync-rules.js';
65
export * from './sync-stream.js';

packages/types/src/routes.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ export const ExecuteSqlResponse = t.object({
2727
});
2828
export type ExecuteSqlResponse = t.Encoded<typeof ExecuteSqlResponse>;
2929

30-
export const DemoCredentialsRequest = t.object({
31-
connection_id: t.string.optional()
32-
});
33-
export type DemoCredentialsRequest = t.Encoded<typeof DemoCredentialsRequest>;
34-
35-
export const DemoCredentialsResponse = t.object({
36-
/** If this instance has a demo database, this contains the credentials. */
37-
credentials: t
38-
.object({
39-
postgres_uri: t.string
40-
})
41-
.optional()
42-
});
43-
export type DemoCredentialsResponse = t.Encoded<typeof DemoCredentialsResponse>;
44-
4530
export const DiagnosticsRequest = t.object({
4631
sync_rules_content: t.boolean.optional()
4732
});

0 commit comments

Comments
 (0)