@powersync/service-core 0.2.2 → 0.3.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.
- package/CHANGELOG.md +13 -0
- package/dist/api/diagnostics.js +2 -2
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/api/schema.js.map +1 -1
- package/dist/auth/CachedKeyCollector.js.map +1 -1
- package/dist/auth/KeySpec.js.map +1 -1
- package/dist/auth/KeyStore.js +2 -2
- package/dist/auth/KeyStore.js.map +1 -1
- package/dist/auth/LeakyBucket.js.map +1 -1
- package/dist/auth/RemoteJWKSCollector.js.map +1 -1
- package/dist/auth/SupabaseKeyCollector.js.map +1 -1
- package/dist/db/mongo.js.map +1 -1
- package/dist/entry/cli-entry.js +2 -2
- package/dist/entry/cli-entry.js.map +1 -1
- package/dist/entry/commands/config-command.js.map +1 -1
- package/dist/entry/commands/migrate-action.js.map +1 -1
- package/dist/entry/commands/start-action.js.map +1 -1
- package/dist/entry/commands/teardown-action.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/locks/LockManager.d.ts +10 -0
- package/dist/locks/LockManager.js +7 -0
- package/dist/locks/LockManager.js.map +1 -0
- package/dist/locks/MongoLocks.d.ts +36 -0
- package/dist/locks/MongoLocks.js +81 -0
- package/dist/locks/MongoLocks.js.map +1 -0
- package/dist/locks/locks-index.d.ts +2 -0
- package/dist/locks/locks-index.js +3 -0
- package/dist/locks/locks-index.js.map +1 -0
- package/dist/metrics/Metrics.js +6 -6
- package/dist/metrics/Metrics.js.map +1 -1
- package/dist/migrations/db/migrations/1684951997326-init.js.map +1 -1
- package/dist/migrations/db/migrations/1702295701188-sync-rule-state.js.map +1 -1
- package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.js.map +1 -1
- package/dist/migrations/definitions.d.ts +18 -0
- package/dist/migrations/definitions.js +6 -0
- package/dist/migrations/definitions.js.map +1 -0
- package/dist/migrations/executor.d.ts +16 -0
- package/dist/migrations/executor.js +64 -0
- package/dist/migrations/executor.js.map +1 -0
- package/dist/migrations/migrations-index.d.ts +3 -0
- package/dist/migrations/migrations-index.js +4 -0
- package/dist/migrations/migrations-index.js.map +1 -0
- package/dist/migrations/migrations.d.ts +1 -1
- package/dist/migrations/migrations.js +4 -8
- package/dist/migrations/migrations.js.map +1 -1
- package/dist/migrations/store/migration-store.d.ts +11 -0
- package/dist/migrations/store/migration-store.js +46 -0
- package/dist/migrations/store/migration-store.js.map +1 -0
- package/dist/replication/ErrorRateLimiter.js.map +1 -1
- package/dist/replication/PgRelation.js.map +1 -1
- package/dist/replication/WalConnection.js.map +1 -1
- package/dist/replication/WalStream.d.ts +0 -1
- package/dist/replication/WalStream.js +21 -25
- package/dist/replication/WalStream.js.map +1 -1
- package/dist/replication/WalStreamManager.js +12 -13
- package/dist/replication/WalStreamManager.js.map +1 -1
- package/dist/replication/WalStreamRunner.js +8 -8
- package/dist/replication/WalStreamRunner.js.map +1 -1
- package/dist/replication/util.js.map +1 -1
- package/dist/routes/auth.d.ts +8 -10
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/endpoints/admin.d.ts +1011 -0
- package/dist/routes/{admin.js → endpoints/admin.js} +33 -18
- package/dist/routes/endpoints/admin.js.map +1 -0
- package/dist/routes/endpoints/checkpointing.d.ts +76 -0
- package/dist/routes/endpoints/checkpointing.js +36 -0
- package/dist/routes/endpoints/checkpointing.js.map +1 -0
- package/dist/routes/endpoints/dev.d.ts +312 -0
- package/dist/routes/{dev.js → endpoints/dev.js} +25 -16
- package/dist/routes/endpoints/dev.js.map +1 -0
- package/dist/routes/endpoints/route-endpoints-index.d.ts +6 -0
- package/dist/routes/endpoints/route-endpoints-index.js +7 -0
- package/dist/routes/endpoints/route-endpoints-index.js.map +1 -0
- package/dist/routes/endpoints/socket-route.d.ts +2 -0
- package/dist/routes/{socket-route.js → endpoints/socket-route.js} +10 -10
- package/dist/routes/endpoints/socket-route.js.map +1 -0
- package/dist/routes/endpoints/sync-rules.d.ts +174 -0
- package/dist/routes/{sync-rules.js → endpoints/sync-rules.js} +44 -24
- package/dist/routes/endpoints/sync-rules.js.map +1 -0
- package/dist/routes/endpoints/sync-stream.d.ts +132 -0
- package/dist/routes/{sync-stream.js → endpoints/sync-stream.js} +26 -17
- package/dist/routes/endpoints/sync-stream.js.map +1 -0
- package/dist/routes/hooks.d.ts +10 -0
- package/dist/routes/hooks.js +31 -0
- package/dist/routes/hooks.js.map +1 -0
- package/dist/routes/route-register.d.ts +10 -0
- package/dist/routes/route-register.js +87 -0
- package/dist/routes/route-register.js.map +1 -0
- package/dist/routes/router.d.ts +16 -4
- package/dist/routes/router.js +6 -1
- package/dist/routes/router.js.map +1 -1
- package/dist/routes/routes-index.d.ts +5 -3
- package/dist/routes/routes-index.js +5 -3
- package/dist/routes/routes-index.js.map +1 -1
- package/dist/runner/teardown.js +9 -9
- package/dist/runner/teardown.js.map +1 -1
- package/dist/storage/BucketStorage.d.ts +3 -0
- package/dist/storage/BucketStorage.js.map +1 -1
- package/dist/storage/ChecksumCache.js.map +1 -1
- package/dist/storage/MongoBucketStorage.js +5 -5
- package/dist/storage/MongoBucketStorage.js.map +1 -1
- package/dist/storage/SourceTable.js.map +1 -1
- package/dist/storage/mongo/MongoBucketBatch.js +23 -18
- package/dist/storage/mongo/MongoBucketBatch.js.map +1 -1
- package/dist/storage/mongo/MongoIdSequence.js.map +1 -1
- package/dist/storage/mongo/MongoSyncBucketStorage.js.map +1 -1
- package/dist/storage/mongo/MongoSyncRulesLock.js +3 -3
- package/dist/storage/mongo/MongoSyncRulesLock.js.map +1 -1
- package/dist/storage/mongo/OperationBatch.js.map +1 -1
- package/dist/storage/mongo/PersistedBatch.js +2 -2
- package/dist/storage/mongo/PersistedBatch.js.map +1 -1
- package/dist/storage/mongo/db.d.ts +2 -2
- package/dist/storage/mongo/db.js.map +1 -1
- package/dist/storage/mongo/util.js.map +1 -1
- package/dist/sync/BroadcastIterable.js.map +1 -1
- package/dist/sync/LastValueSink.js.map +1 -1
- package/dist/sync/merge.js.map +1 -1
- package/dist/sync/safeRace.js.map +1 -1
- package/dist/sync/sync.js +4 -4
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/util.js.map +1 -1
- package/dist/system/CorePowerSyncSystem.d.ts +12 -7
- package/dist/system/CorePowerSyncSystem.js +26 -2
- package/dist/system/CorePowerSyncSystem.js.map +1 -1
- package/dist/system/system-index.d.ts +1 -0
- package/dist/system/system-index.js +2 -0
- package/dist/system/system-index.js.map +1 -0
- package/dist/util/Mutex.js.map +1 -1
- package/dist/util/PgManager.js.map +1 -1
- package/dist/util/alerting.d.ts +0 -2
- package/dist/util/alerting.js +0 -6
- package/dist/util/alerting.js.map +1 -1
- package/dist/util/config/collectors/config-collector.js +3 -3
- package/dist/util/config/collectors/config-collector.js.map +1 -1
- package/dist/util/config/collectors/impl/base64-config-collector.js.map +1 -1
- package/dist/util/config/collectors/impl/filesystem-config-collector.js +7 -5
- package/dist/util/config/collectors/impl/filesystem-config-collector.js.map +1 -1
- package/dist/util/config/compound-config-collector.js +4 -4
- package/dist/util/config/compound-config-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js.map +1 -1
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.js.map +1 -1
- package/dist/util/config.js.map +1 -1
- package/dist/util/env.d.ts +1 -2
- package/dist/util/env.js +3 -2
- package/dist/util/env.js.map +1 -1
- package/dist/util/memory-tracking.js +2 -2
- package/dist/util/memory-tracking.js.map +1 -1
- package/dist/util/migration_lib.js.map +1 -1
- package/dist/util/pgwire_utils.js +2 -2
- package/dist/util/pgwire_utils.js.map +1 -1
- package/dist/util/populate_test_data.js.map +1 -1
- package/dist/util/secs.js.map +1 -1
- package/dist/util/utils.js +4 -4
- package/dist/util/utils.js.map +1 -1
- package/package.json +12 -9
- package/src/api/diagnostics.ts +5 -5
- package/src/api/schema.ts +1 -1
- package/src/auth/KeyStore.ts +2 -2
- package/src/entry/cli-entry.ts +3 -4
- package/src/entry/commands/config-command.ts +1 -1
- package/src/entry/commands/migrate-action.ts +2 -2
- package/src/entry/commands/start-action.ts +1 -1
- package/src/entry/commands/teardown-action.ts +1 -1
- package/src/index.ts +5 -2
- package/src/locks/LockManager.ts +16 -0
- package/src/locks/MongoLocks.ts +142 -0
- package/src/locks/locks-index.ts +2 -0
- package/src/metrics/Metrics.ts +8 -8
- package/src/migrations/db/migrations/1684951997326-init.ts +3 -3
- package/src/migrations/db/migrations/1702295701188-sync-rule-state.ts +3 -3
- package/src/migrations/db/migrations/1711543888062-write-checkpoint-index.ts +2 -2
- package/src/migrations/definitions.ts +21 -0
- package/src/migrations/executor.ts +87 -0
- package/src/migrations/migrations-index.ts +3 -0
- package/src/migrations/migrations.ts +7 -11
- package/src/migrations/store/migration-store.ts +63 -0
- package/src/replication/WalConnection.ts +2 -2
- package/src/replication/WalStream.ts +24 -29
- package/src/replication/WalStreamManager.ts +14 -15
- package/src/replication/WalStreamRunner.ts +10 -10
- package/src/replication/util.ts +1 -1
- package/src/routes/auth.ts +22 -16
- package/src/routes/endpoints/admin.ts +237 -0
- package/src/routes/endpoints/checkpointing.ts +41 -0
- package/src/routes/endpoints/dev.ts +199 -0
- package/src/routes/endpoints/route-endpoints-index.ts +6 -0
- package/src/routes/{socket-route.ts → endpoints/socket-route.ts} +11 -11
- package/src/routes/endpoints/sync-rules.ts +227 -0
- package/src/routes/endpoints/sync-stream.ts +101 -0
- package/src/routes/hooks.ts +45 -0
- package/src/routes/route-register.ts +104 -0
- package/src/routes/router.ts +34 -6
- package/src/routes/routes-index.ts +5 -4
- package/src/runner/teardown.ts +9 -9
- package/src/storage/BucketStorage.ts +7 -2
- package/src/storage/ChecksumCache.ts +2 -2
- package/src/storage/MongoBucketStorage.ts +8 -8
- package/src/storage/SourceTable.ts +2 -2
- package/src/storage/mongo/MongoBucketBatch.ts +29 -22
- package/src/storage/mongo/MongoSyncBucketStorage.ts +3 -3
- package/src/storage/mongo/MongoSyncRulesLock.ts +3 -3
- package/src/storage/mongo/OperationBatch.ts +1 -1
- package/src/storage/mongo/PersistedBatch.ts +3 -3
- package/src/storage/mongo/db.ts +3 -4
- package/src/sync/sync.ts +8 -8
- package/src/sync/util.ts +2 -2
- package/src/system/CorePowerSyncSystem.ts +31 -10
- package/src/system/system-index.ts +1 -0
- package/src/util/alerting.ts +0 -8
- package/src/util/config/collectors/config-collector.ts +5 -3
- package/src/util/config/collectors/impl/filesystem-config-collector.ts +8 -6
- package/src/util/config/compound-config-collector.ts +4 -4
- package/src/util/env.ts +4 -2
- package/src/util/memory-tracking.ts +2 -2
- package/src/util/pgwire_utils.ts +3 -3
- package/src/util/utils.ts +5 -5
- package/test/src/auth.test.ts +4 -2
- package/test/src/data_storage.test.ts +177 -0
- package/test/src/env.ts +6 -6
- package/test/src/setup.ts +7 -0
- package/test/src/slow_tests.test.ts +45 -6
- package/test/tsconfig.json +1 -1
- package/tsconfig.json +5 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +1 -3
- package/dist/migrations/db/store.d.ts +0 -3
- package/dist/migrations/db/store.js +0 -10
- package/dist/migrations/db/store.js.map +0 -1
- package/dist/routes/admin.d.ts +0 -7
- package/dist/routes/admin.js.map +0 -1
- package/dist/routes/checkpointing.d.ts +0 -3
- package/dist/routes/checkpointing.js +0 -30
- package/dist/routes/checkpointing.js.map +0 -1
- package/dist/routes/dev.d.ts +0 -6
- package/dist/routes/dev.js.map +0 -1
- package/dist/routes/route-generators.d.ts +0 -15
- package/dist/routes/route-generators.js +0 -32
- package/dist/routes/route-generators.js.map +0 -1
- package/dist/routes/socket-route.d.ts +0 -2
- package/dist/routes/socket-route.js.map +0 -1
- package/dist/routes/sync-rules.d.ts +0 -6
- package/dist/routes/sync-rules.js.map +0 -1
- package/dist/routes/sync-stream.d.ts +0 -5
- package/dist/routes/sync-stream.js.map +0 -1
- package/src/migrations/db/store.ts +0 -11
- package/src/routes/admin.ts +0 -229
- package/src/routes/checkpointing.ts +0 -38
- package/src/routes/dev.ts +0 -194
- package/src/routes/route-generators.ts +0 -39
- package/src/routes/sync-rules.ts +0 -210
- package/src/routes/sync-stream.ts +0 -95
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { errors, router, schema } from '@powersync/lib-services-framework';
|
|
2
2
|
import { SqlSyncRules, StaticSchema, isJsonValue, toSyncRulesValue } from '@powersync/service-sync-rules';
|
|
3
3
|
import { internal_routes } from '@powersync/service-types';
|
|
4
|
-
import * as api from '
|
|
5
|
-
import * as util from '
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import * as api from '../../api/api-index.js';
|
|
5
|
+
import * as util from '../../util/util-index.js';
|
|
6
|
+
import { routeDefinition } from '../router.js';
|
|
7
|
+
import { authApi } from '../auth.js';
|
|
8
|
+
const demoCredentials = routeDefinition({
|
|
9
|
+
path: '/api/admin/v1/demo-credentials',
|
|
10
|
+
method: router.HTTPMethod.POST,
|
|
8
11
|
authorize: authApi,
|
|
9
|
-
validator:
|
|
12
|
+
validator: schema.createTsCodecValidator(internal_routes.DemoCredentialsRequest, {
|
|
13
|
+
allowAdditional: true
|
|
14
|
+
}),
|
|
10
15
|
handler: async (payload) => {
|
|
11
16
|
const connection = payload.context.system.config.connection;
|
|
12
17
|
if (connection == null || !connection.demo_database) {
|
|
@@ -20,9 +25,11 @@ const demoCredentials = (router) => router.post('/api/admin/v1/demo-credentials'
|
|
|
20
25
|
});
|
|
21
26
|
}
|
|
22
27
|
});
|
|
23
|
-
export const executeSql = (
|
|
28
|
+
export const executeSql = routeDefinition({
|
|
29
|
+
path: '/api/admin/v1/execute-sql',
|
|
30
|
+
method: router.HTTPMethod.POST,
|
|
24
31
|
authorize: authApi,
|
|
25
|
-
validator:
|
|
32
|
+
validator: schema.createTsCodecValidator(internal_routes.ExecuteSqlRequest, { allowAdditional: true }),
|
|
26
33
|
handler: async (payload) => {
|
|
27
34
|
const connection = payload.context.system.config.connection;
|
|
28
35
|
if (connection == null || !connection.debug_api) {
|
|
@@ -64,9 +71,11 @@ export const executeSql = (router) => router.post('/api/admin/v1/execute-sql', {
|
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
});
|
|
67
|
-
export const diagnostics = (
|
|
74
|
+
export const diagnostics = routeDefinition({
|
|
75
|
+
path: '/api/admin/v1/diagnostics',
|
|
76
|
+
method: router.HTTPMethod.POST,
|
|
68
77
|
authorize: authApi,
|
|
69
|
-
validator:
|
|
78
|
+
validator: schema.createTsCodecValidator(internal_routes.DiagnosticsRequest, { allowAdditional: true }),
|
|
70
79
|
handler: async (payload) => {
|
|
71
80
|
const include_content = payload.params.sync_rules_content ?? false;
|
|
72
81
|
const system = payload.context.system;
|
|
@@ -96,17 +105,21 @@ export const diagnostics = (router) => router.post('/api/admin/v1/diagnostics',
|
|
|
96
105
|
});
|
|
97
106
|
}
|
|
98
107
|
});
|
|
99
|
-
export const getSchema = (
|
|
108
|
+
export const getSchema = routeDefinition({
|
|
109
|
+
path: '/api/admin/v1/schema',
|
|
110
|
+
method: router.HTTPMethod.POST,
|
|
100
111
|
authorize: authApi,
|
|
101
|
-
validator:
|
|
112
|
+
validator: schema.createTsCodecValidator(internal_routes.GetSchemaRequest, { allowAdditional: true }),
|
|
102
113
|
handler: async (payload) => {
|
|
103
114
|
const system = payload.context.system;
|
|
104
115
|
return internal_routes.GetSchemaResponse.encode(await api.getConnectionsSchema(system));
|
|
105
116
|
}
|
|
106
117
|
});
|
|
107
|
-
export const reprocess = (
|
|
118
|
+
export const reprocess = routeDefinition({
|
|
119
|
+
path: '/api/admin/v1/reprocess',
|
|
120
|
+
method: router.HTTPMethod.POST,
|
|
108
121
|
authorize: authApi,
|
|
109
|
-
validator:
|
|
122
|
+
validator: schema.createTsCodecValidator(internal_routes.ReprocessRequest, { allowAdditional: true }),
|
|
110
123
|
handler: async (payload) => {
|
|
111
124
|
const system = payload.context.system;
|
|
112
125
|
const storage = system.storage;
|
|
@@ -116,7 +129,7 @@ export const reprocess = (router) => router.post('/api/admin/v1/reprocess', {
|
|
|
116
129
|
}
|
|
117
130
|
const active = await storage.getActiveSyncRules();
|
|
118
131
|
if (active == null) {
|
|
119
|
-
throw new
|
|
132
|
+
throw new errors.JourneyError({
|
|
120
133
|
status: 422,
|
|
121
134
|
code: 'NO_SYNC_RULES',
|
|
122
135
|
description: 'No active sync rules'
|
|
@@ -136,9 +149,11 @@ export const reprocess = (router) => router.post('/api/admin/v1/reprocess', {
|
|
|
136
149
|
});
|
|
137
150
|
}
|
|
138
151
|
});
|
|
139
|
-
export const validate = (
|
|
152
|
+
export const validate = routeDefinition({
|
|
153
|
+
path: '/api/admin/v1/validate',
|
|
154
|
+
method: router.HTTPMethod.POST,
|
|
140
155
|
authorize: authApi,
|
|
141
|
-
validator:
|
|
156
|
+
validator: schema.createTsCodecValidator(internal_routes.ValidateRequest, { allowAdditional: true }),
|
|
142
157
|
handler: async (payload) => {
|
|
143
158
|
const system = payload.context.system;
|
|
144
159
|
const content = payload.params.sync_rules;
|
|
@@ -188,5 +203,5 @@ function mapColumnValue(value) {
|
|
|
188
203
|
return null;
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
|
-
export const
|
|
206
|
+
export const ADMIN_ROUTES = [demoCredentials, executeSql, diagnostics, getSchema, reprocess, validate];
|
|
192
207
|
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/routes/endpoints/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAe,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACvH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OA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;IACzD,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,KAAkB;IACxC,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE;QAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;SAAM,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { router, schema } from '@powersync/lib-services-framework';
|
|
2
|
+
export declare const writeCheckpoint: router.Endpoint<{}, {
|
|
3
|
+
checkpoint: string;
|
|
4
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
5
|
+
checkpoint: string;
|
|
6
|
+
}>> & {
|
|
7
|
+
path: string;
|
|
8
|
+
method: router.HTTPMethod.GET;
|
|
9
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
10
|
+
authorized: boolean;
|
|
11
|
+
errors: any[];
|
|
12
|
+
} | {
|
|
13
|
+
authorized: boolean;
|
|
14
|
+
errors?: undefined;
|
|
15
|
+
}>;
|
|
16
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
17
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
18
|
+
checkpoint: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare const writeCheckpoint2: router.Endpoint<{}, {
|
|
22
|
+
write_checkpoint: string;
|
|
23
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
24
|
+
write_checkpoint: string;
|
|
25
|
+
}>> & {
|
|
26
|
+
path: string;
|
|
27
|
+
method: router.HTTPMethod.GET;
|
|
28
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
29
|
+
authorized: boolean;
|
|
30
|
+
errors: any[];
|
|
31
|
+
} | {
|
|
32
|
+
authorized: boolean;
|
|
33
|
+
errors?: undefined;
|
|
34
|
+
}>;
|
|
35
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
36
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
37
|
+
write_checkpoint: string;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
export declare const CHECKPOINT_ROUTES: ((router.Endpoint<{}, {
|
|
41
|
+
checkpoint: string;
|
|
42
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
43
|
+
checkpoint: string;
|
|
44
|
+
}>> & {
|
|
45
|
+
path: string;
|
|
46
|
+
method: router.HTTPMethod.GET;
|
|
47
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
48
|
+
authorized: boolean;
|
|
49
|
+
errors: any[];
|
|
50
|
+
} | {
|
|
51
|
+
authorized: boolean;
|
|
52
|
+
errors?: undefined;
|
|
53
|
+
}>;
|
|
54
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
55
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
56
|
+
checkpoint: string;
|
|
57
|
+
}>;
|
|
58
|
+
}) | (router.Endpoint<{}, {
|
|
59
|
+
write_checkpoint: string;
|
|
60
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
61
|
+
write_checkpoint: string;
|
|
62
|
+
}>> & {
|
|
63
|
+
path: string;
|
|
64
|
+
method: router.HTTPMethod.GET;
|
|
65
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
66
|
+
authorized: boolean;
|
|
67
|
+
errors: any[];
|
|
68
|
+
} | {
|
|
69
|
+
authorized: boolean;
|
|
70
|
+
errors?: undefined;
|
|
71
|
+
}>;
|
|
72
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
73
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
74
|
+
write_checkpoint: string;
|
|
75
|
+
}>;
|
|
76
|
+
}))[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as t from 'ts-codec';
|
|
2
|
+
import { router, schema } from '@powersync/lib-services-framework';
|
|
3
|
+
import * as util from '../../util/util-index.js';
|
|
4
|
+
import { authUser } from '../auth.js';
|
|
5
|
+
import { routeDefinition } from '../router.js';
|
|
6
|
+
const WriteCheckpointRequest = t.object({});
|
|
7
|
+
export const writeCheckpoint = routeDefinition({
|
|
8
|
+
path: '/write-checkpoint.json',
|
|
9
|
+
method: router.HTTPMethod.GET,
|
|
10
|
+
authorize: authUser,
|
|
11
|
+
validator: schema.createTsCodecValidator(WriteCheckpointRequest, { allowAdditional: true }),
|
|
12
|
+
handler: async (payload) => {
|
|
13
|
+
const system = payload.context.system;
|
|
14
|
+
const storage = system.storage;
|
|
15
|
+
const checkpoint = await util.getClientCheckpoint(system.requirePgPool(), storage);
|
|
16
|
+
return {
|
|
17
|
+
checkpoint
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export const writeCheckpoint2 = routeDefinition({
|
|
22
|
+
path: '/write-checkpoint2.json',
|
|
23
|
+
method: router.HTTPMethod.GET,
|
|
24
|
+
authorize: authUser,
|
|
25
|
+
validator: schema.createTsCodecValidator(WriteCheckpointRequest, { allowAdditional: true }),
|
|
26
|
+
handler: async (payload) => {
|
|
27
|
+
const { user_id, system } = payload.context;
|
|
28
|
+
const storage = system.storage;
|
|
29
|
+
const write_checkpoint = await util.createWriteCheckpoint(system.requirePgPool(), storage, user_id);
|
|
30
|
+
return {
|
|
31
|
+
write_checkpoint: String(write_checkpoint)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export const CHECKPOINT_ROUTES = [writeCheckpoint, writeCheckpoint2];
|
|
36
|
+
//# sourceMappingURL=checkpointing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpointing.js","sourceRoot":"","sources":["../../../src/routes/endpoints/checkpointing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,wBAAwB;IAC9B,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG;IAC7B,SAAS,EAAE,Q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th: router.Endpoint<{
|
|
3
|
+
password: string;
|
|
4
|
+
user: string;
|
|
5
|
+
}, {
|
|
6
|
+
token: string;
|
|
7
|
+
user_id: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
10
|
+
password: string;
|
|
11
|
+
user: string;
|
|
12
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
13
|
+
password: string;
|
|
14
|
+
user: string;
|
|
15
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
16
|
+
token: string;
|
|
17
|
+
user_id: string;
|
|
18
|
+
endpoint: string;
|
|
19
|
+
}>> & {
|
|
20
|
+
path: string;
|
|
21
|
+
method: router.HTTPMethod.POST;
|
|
22
|
+
validator: schema.MicroValidator<{
|
|
23
|
+
password: string;
|
|
24
|
+
user: string;
|
|
25
|
+
}, string[]>;
|
|
26
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
27
|
+
password: string;
|
|
28
|
+
user: string;
|
|
29
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
30
|
+
token: string;
|
|
31
|
+
user_id: string;
|
|
32
|
+
endpoint: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
export declare const auth2: router.Endpoint<{
|
|
36
|
+
password: string;
|
|
37
|
+
user: string;
|
|
38
|
+
}, {
|
|
39
|
+
token: string;
|
|
40
|
+
user_id: string;
|
|
41
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
42
|
+
password: string;
|
|
43
|
+
user: string;
|
|
44
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
45
|
+
password: string;
|
|
46
|
+
user: string;
|
|
47
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
48
|
+
token: string;
|
|
49
|
+
user_id: string;
|
|
50
|
+
}>> & {
|
|
51
|
+
path: string;
|
|
52
|
+
method: router.HTTPMethod.POST;
|
|
53
|
+
validator: schema.MicroValidator<{
|
|
54
|
+
password: string;
|
|
55
|
+
user: string;
|
|
56
|
+
}, string[]>;
|
|
57
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
58
|
+
password: string;
|
|
59
|
+
user: string;
|
|
60
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
61
|
+
token: string;
|
|
62
|
+
user_id: string;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
export declare const token: router.Endpoint<{}, {
|
|
66
|
+
token: string;
|
|
67
|
+
user_id: string | undefined;
|
|
68
|
+
endpoint: string;
|
|
69
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
70
|
+
token: string;
|
|
71
|
+
user_id: string | undefined;
|
|
72
|
+
endpoint: string;
|
|
73
|
+
}>> & {
|
|
74
|
+
path: string;
|
|
75
|
+
method: router.HTTPMethod.POST;
|
|
76
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
77
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
78
|
+
authorized: boolean;
|
|
79
|
+
errors: any[];
|
|
80
|
+
} | {
|
|
81
|
+
authorized: boolean;
|
|
82
|
+
errors?: undefined;
|
|
83
|
+
}>;
|
|
84
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
85
|
+
token: string;
|
|
86
|
+
user_id: string | undefined;
|
|
87
|
+
endpoint: string;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
export declare const crud: router.Endpoint<{
|
|
91
|
+
data: {
|
|
92
|
+
type: string;
|
|
93
|
+
id: string;
|
|
94
|
+
op: string;
|
|
95
|
+
data?: any;
|
|
96
|
+
op_id?: number | undefined;
|
|
97
|
+
}[];
|
|
98
|
+
write_checkpoint?: boolean | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
write_checkpoint: string;
|
|
101
|
+
checkpoint?: undefined;
|
|
102
|
+
} | {
|
|
103
|
+
write_checkpoint?: undefined;
|
|
104
|
+
checkpoint?: undefined;
|
|
105
|
+
} | {
|
|
106
|
+
checkpoint: string;
|
|
107
|
+
write_checkpoint?: undefined;
|
|
108
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
109
|
+
data: {
|
|
110
|
+
type: string;
|
|
111
|
+
id: string;
|
|
112
|
+
op: string;
|
|
113
|
+
data?: any;
|
|
114
|
+
op_id?: number | undefined;
|
|
115
|
+
}[];
|
|
116
|
+
write_checkpoint?: boolean | undefined;
|
|
117
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
118
|
+
data: {
|
|
119
|
+
type: string;
|
|
120
|
+
id: string;
|
|
121
|
+
op: string;
|
|
122
|
+
data?: any;
|
|
123
|
+
op_id?: number | undefined;
|
|
124
|
+
}[];
|
|
125
|
+
write_checkpoint?: boolean | undefined;
|
|
126
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
127
|
+
write_checkpoint: string;
|
|
128
|
+
checkpoint?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
write_checkpoint?: undefined;
|
|
131
|
+
checkpoint?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
checkpoint: string;
|
|
134
|
+
write_checkpoint?: undefined;
|
|
135
|
+
}>> & {
|
|
136
|
+
path: string;
|
|
137
|
+
method: router.HTTPMethod.POST;
|
|
138
|
+
validator: schema.MicroValidator<{
|
|
139
|
+
data: {
|
|
140
|
+
type: string;
|
|
141
|
+
id: string;
|
|
142
|
+
op: string;
|
|
143
|
+
data?: any;
|
|
144
|
+
op_id?: number | undefined;
|
|
145
|
+
}[];
|
|
146
|
+
write_checkpoint?: boolean | undefined;
|
|
147
|
+
}, string[]>;
|
|
148
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
149
|
+
authorized: boolean;
|
|
150
|
+
errors: any[];
|
|
151
|
+
} | {
|
|
152
|
+
authorized: boolean;
|
|
153
|
+
errors?: undefined;
|
|
154
|
+
}>;
|
|
155
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
156
|
+
data: {
|
|
157
|
+
type: string;
|
|
158
|
+
id: string;
|
|
159
|
+
op: string;
|
|
160
|
+
data?: any;
|
|
161
|
+
op_id?: number | undefined;
|
|
162
|
+
}[];
|
|
163
|
+
write_checkpoint?: boolean | undefined;
|
|
164
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
165
|
+
write_checkpoint: string;
|
|
166
|
+
checkpoint?: undefined;
|
|
167
|
+
} | {
|
|
168
|
+
write_checkpoint?: undefined;
|
|
169
|
+
checkpoint?: undefined;
|
|
170
|
+
} | {
|
|
171
|
+
checkpoint: string;
|
|
172
|
+
write_checkpoint?: undefined;
|
|
173
|
+
}>;
|
|
174
|
+
};
|
|
175
|
+
export declare const DEV_ROUTES: ((router.Endpoint<{
|
|
176
|
+
password: string;
|
|
177
|
+
user: string;
|
|
178
|
+
}, {
|
|
179
|
+
token: string;
|
|
180
|
+
user_id: string;
|
|
181
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
182
|
+
password: string;
|
|
183
|
+
user: string;
|
|
184
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
185
|
+
password: string;
|
|
186
|
+
user: string;
|
|
187
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
188
|
+
token: string;
|
|
189
|
+
user_id: string;
|
|
190
|
+
}>> & {
|
|
191
|
+
path: string;
|
|
192
|
+
method: router.HTTPMethod.POST;
|
|
193
|
+
validator: schema.MicroValidator<{
|
|
194
|
+
password: string;
|
|
195
|
+
user: string;
|
|
196
|
+
}, string[]>;
|
|
197
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
198
|
+
password: string;
|
|
199
|
+
user: string;
|
|
200
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
201
|
+
token: string;
|
|
202
|
+
user_id: string;
|
|
203
|
+
}>;
|
|
204
|
+
}) | (router.Endpoint<{}, {
|
|
205
|
+
token: string;
|
|
206
|
+
user_id: string | undefined;
|
|
207
|
+
endpoint: string;
|
|
208
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
209
|
+
token: string;
|
|
210
|
+
user_id: string | undefined;
|
|
211
|
+
endpoint: string;
|
|
212
|
+
}>> & {
|
|
213
|
+
path: string;
|
|
214
|
+
method: router.HTTPMethod.POST;
|
|
215
|
+
validator: schema.MicroValidator<{}, string[]>;
|
|
216
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
217
|
+
authorized: boolean;
|
|
218
|
+
errors: any[];
|
|
219
|
+
} | {
|
|
220
|
+
authorized: boolean;
|
|
221
|
+
errors?: undefined;
|
|
222
|
+
}>;
|
|
223
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
224
|
+
token: string;
|
|
225
|
+
user_id: string | undefined;
|
|
226
|
+
endpoint: string;
|
|
227
|
+
}>;
|
|
228
|
+
}) | (router.Endpoint<{
|
|
229
|
+
data: {
|
|
230
|
+
type: string;
|
|
231
|
+
id: string;
|
|
232
|
+
op: string;
|
|
233
|
+
data?: any;
|
|
234
|
+
op_id?: number | undefined;
|
|
235
|
+
}[];
|
|
236
|
+
write_checkpoint?: boolean | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
write_checkpoint: string;
|
|
239
|
+
checkpoint?: undefined;
|
|
240
|
+
} | {
|
|
241
|
+
write_checkpoint?: undefined;
|
|
242
|
+
checkpoint?: undefined;
|
|
243
|
+
} | {
|
|
244
|
+
checkpoint: string;
|
|
245
|
+
write_checkpoint?: undefined;
|
|
246
|
+
}, import("../router.js").Context, import("../router.js").RequestEndpointHandlerPayload<{
|
|
247
|
+
data: {
|
|
248
|
+
type: string;
|
|
249
|
+
id: string;
|
|
250
|
+
op: string;
|
|
251
|
+
data?: any;
|
|
252
|
+
op_id?: number | undefined;
|
|
253
|
+
}[];
|
|
254
|
+
write_checkpoint?: boolean | undefined;
|
|
255
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, router.EndpointHandler<import("../router.js").RequestEndpointHandlerPayload<{
|
|
256
|
+
data: {
|
|
257
|
+
type: string;
|
|
258
|
+
id: string;
|
|
259
|
+
op: string;
|
|
260
|
+
data?: any;
|
|
261
|
+
op_id?: number | undefined;
|
|
262
|
+
}[];
|
|
263
|
+
write_checkpoint?: boolean | undefined;
|
|
264
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>, {
|
|
265
|
+
write_checkpoint: string;
|
|
266
|
+
checkpoint?: undefined;
|
|
267
|
+
} | {
|
|
268
|
+
write_checkpoint?: undefined;
|
|
269
|
+
checkpoint?: undefined;
|
|
270
|
+
} | {
|
|
271
|
+
checkpoint: string;
|
|
272
|
+
write_checkpoint?: undefined;
|
|
273
|
+
}>> & {
|
|
274
|
+
path: string;
|
|
275
|
+
method: router.HTTPMethod.POST;
|
|
276
|
+
validator: schema.MicroValidator<{
|
|
277
|
+
data: {
|
|
278
|
+
type: string;
|
|
279
|
+
id: string;
|
|
280
|
+
op: string;
|
|
281
|
+
data?: any;
|
|
282
|
+
op_id?: number | undefined;
|
|
283
|
+
}[];
|
|
284
|
+
write_checkpoint?: boolean | undefined;
|
|
285
|
+
}, string[]>;
|
|
286
|
+
authorize: (payload: import("../router.js").RequestEndpointHandlerPayload) => Promise<{
|
|
287
|
+
authorized: boolean;
|
|
288
|
+
errors: any[];
|
|
289
|
+
} | {
|
|
290
|
+
authorized: boolean;
|
|
291
|
+
errors?: undefined;
|
|
292
|
+
}>;
|
|
293
|
+
handler: (payload: import("../router.js").RequestEndpointHandlerPayload<{
|
|
294
|
+
data: {
|
|
295
|
+
type: string;
|
|
296
|
+
id: string;
|
|
297
|
+
op: string;
|
|
298
|
+
data?: any;
|
|
299
|
+
op_id?: number | undefined;
|
|
300
|
+
}[];
|
|
301
|
+
write_checkpoint?: boolean | undefined;
|
|
302
|
+
}, import("../router.js").Context, import("../router.js").BasicRouterRequest>) => Promise<{
|
|
303
|
+
write_checkpoint: string;
|
|
304
|
+
checkpoint?: undefined;
|
|
305
|
+
} | {
|
|
306
|
+
write_checkpoint?: undefined;
|
|
307
|
+
checkpoint?: undefined;
|
|
308
|
+
} | {
|
|
309
|
+
checkpoint: string;
|
|
310
|
+
write_checkpoint?: undefined;
|
|
311
|
+
}>;
|
|
312
|
+
}))[];
|
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
import * as t from 'ts-codec';
|
|
2
|
-
import
|
|
3
|
-
import * as util from '
|
|
4
|
-
import { authDevUser, authUser, endpoint, issueDevToken, issueLegacyDevToken, issuePowerSyncToken } from '
|
|
2
|
+
import { errors, router, schema } from '@powersync/lib-services-framework';
|
|
3
|
+
import * as util from '../../util/util-index.js';
|
|
4
|
+
import { authDevUser, authUser, endpoint, issueDevToken, issueLegacyDevToken, issuePowerSyncToken } from '../auth.js';
|
|
5
|
+
import { routeDefinition } from '../router.js';
|
|
5
6
|
const AuthParams = t.object({
|
|
6
7
|
user: t.string,
|
|
7
8
|
password: t.string
|
|
8
9
|
});
|
|
9
10
|
// For legacy web client only. Remove soon.
|
|
10
|
-
export const auth = (
|
|
11
|
-
|
|
11
|
+
export const auth = routeDefinition({
|
|
12
|
+
path: '/auth.json',
|
|
13
|
+
method: router.HTTPMethod.POST,
|
|
14
|
+
validator: schema.createTsCodecValidator(AuthParams, { allowAdditional: true }),
|
|
12
15
|
handler: async (payload) => {
|
|
13
16
|
const { user, password } = payload.params;
|
|
14
17
|
const config = payload.context.system.config;
|
|
15
18
|
if (config.dev.demo_auth == false || config.dev.demo_password == null) {
|
|
16
|
-
throw new
|
|
19
|
+
throw new errors.AuthorizationError(['Demo auth disabled']);
|
|
17
20
|
}
|
|
18
21
|
if (password == config.dev.demo_password) {
|
|
19
22
|
const token = await issueLegacyDevToken(payload.request, user, payload.context.system.config);
|
|
20
23
|
return { token, user_id: user, endpoint: endpoint(payload.request) };
|
|
21
24
|
}
|
|
22
25
|
else {
|
|
23
|
-
throw new
|
|
26
|
+
throw new errors.AuthorizationError(['Authentication failed']);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
|
-
export const auth2 = (
|
|
28
|
-
|
|
30
|
+
export const auth2 = routeDefinition({
|
|
31
|
+
path: '/dev/auth.json',
|
|
32
|
+
method: router.HTTPMethod.POST,
|
|
33
|
+
validator: schema.createTsCodecValidator(AuthParams, { allowAdditional: true }),
|
|
29
34
|
handler: async (payload) => {
|
|
30
35
|
const { user, password } = payload.params;
|
|
31
36
|
const config = payload.context.system.config;
|
|
32
37
|
if (config.dev.demo_auth == false || config.dev.demo_password == null) {
|
|
33
|
-
throw new
|
|
38
|
+
throw new errors.AuthorizationError(['Demo auth disabled']);
|
|
34
39
|
}
|
|
35
40
|
if (password == config.dev.demo_password) {
|
|
36
41
|
const token = await issueDevToken(payload.request, user, payload.context.system.config);
|
|
37
42
|
return { token, user_id: user };
|
|
38
43
|
}
|
|
39
44
|
else {
|
|
40
|
-
throw new
|
|
45
|
+
throw new errors.AuthorizationError(['Authentication failed']);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
});
|
|
44
49
|
const TokenParams = t.object({});
|
|
45
|
-
export const token = (
|
|
46
|
-
|
|
50
|
+
export const token = routeDefinition({
|
|
51
|
+
path: '/dev/token.json',
|
|
52
|
+
method: router.HTTPMethod.POST,
|
|
53
|
+
validator: schema.createTsCodecValidator(TokenParams, { allowAdditional: true }),
|
|
47
54
|
authorize: authDevUser,
|
|
48
55
|
handler: async (payload) => {
|
|
49
56
|
const { user_id } = payload.context;
|
|
@@ -67,8 +74,10 @@ const CrudRequest = t.object({
|
|
|
67
74
|
data: t.array(CrudEntry),
|
|
68
75
|
write_checkpoint: t.boolean.optional()
|
|
69
76
|
});
|
|
70
|
-
export const crud = (
|
|
71
|
-
|
|
77
|
+
export const crud = routeDefinition({
|
|
78
|
+
path: '/crud.json',
|
|
79
|
+
method: router.HTTPMethod.POST,
|
|
80
|
+
validator: schema.createTsCodecValidator(CrudRequest, { allowAdditional: true }),
|
|
72
81
|
authorize: authUser,
|
|
73
82
|
handler: async (payload) => {
|
|
74
83
|
const { user_id, system } = payload.context;
|
|
@@ -159,5 +168,5 @@ export const crud = (router) => router.post('/crud.json', {
|
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
170
|
});
|
|
162
|
-
export const
|
|
171
|
+
export const DEV_ROUTES = [auth, auth2, token, crud];
|
|
163
172
|
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/routes/endpoints/dev.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa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