@powersync/service-core 0.0.0-dev-20240620165206
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/.probes/.gitkeep +0 -0
- package/CHANGELOG.md +82 -0
- package/LICENSE +67 -0
- package/README.md +3 -0
- package/dist/api/api-index.d.ts +2 -0
- package/dist/api/api-index.js +3 -0
- package/dist/api/api-index.js.map +1 -0
- package/dist/api/diagnostics.d.ts +21 -0
- package/dist/api/diagnostics.js +183 -0
- package/dist/api/diagnostics.js.map +1 -0
- package/dist/api/schema.d.ts +5 -0
- package/dist/api/schema.js +88 -0
- package/dist/api/schema.js.map +1 -0
- package/dist/auth/CachedKeyCollector.d.ts +46 -0
- package/dist/auth/CachedKeyCollector.js +116 -0
- package/dist/auth/CachedKeyCollector.js.map +1 -0
- package/dist/auth/CompoundKeyCollector.d.ts +8 -0
- package/dist/auth/CompoundKeyCollector.js +23 -0
- package/dist/auth/CompoundKeyCollector.js.map +1 -0
- package/dist/auth/JwtPayload.d.ts +10 -0
- package/dist/auth/JwtPayload.js +2 -0
- package/dist/auth/JwtPayload.js.map +1 -0
- package/dist/auth/KeyCollector.d.ts +24 -0
- package/dist/auth/KeyCollector.js +2 -0
- package/dist/auth/KeyCollector.js.map +1 -0
- package/dist/auth/KeySpec.d.ts +26 -0
- package/dist/auth/KeySpec.js +49 -0
- package/dist/auth/KeySpec.js.map +1 -0
- package/dist/auth/KeyStore.d.ts +39 -0
- package/dist/auth/KeyStore.js +131 -0
- package/dist/auth/KeyStore.js.map +1 -0
- package/dist/auth/LeakyBucket.d.ts +39 -0
- package/dist/auth/LeakyBucket.js +57 -0
- package/dist/auth/LeakyBucket.js.map +1 -0
- package/dist/auth/RemoteJWKSCollector.d.ts +24 -0
- package/dist/auth/RemoteJWKSCollector.js +106 -0
- package/dist/auth/RemoteJWKSCollector.js.map +1 -0
- package/dist/auth/StaticKeyCollector.d.ts +14 -0
- package/dist/auth/StaticKeyCollector.js +19 -0
- package/dist/auth/StaticKeyCollector.js.map +1 -0
- package/dist/auth/SupabaseKeyCollector.d.ts +22 -0
- package/dist/auth/SupabaseKeyCollector.js +61 -0
- package/dist/auth/SupabaseKeyCollector.js.map +1 -0
- package/dist/auth/auth-index.d.ts +10 -0
- package/dist/auth/auth-index.js +11 -0
- package/dist/auth/auth-index.js.map +1 -0
- package/dist/db/db-index.d.ts +1 -0
- package/dist/db/db-index.js +2 -0
- package/dist/db/db-index.js.map +1 -0
- package/dist/db/mongo.d.ts +29 -0
- package/dist/db/mongo.js +65 -0
- package/dist/db/mongo.js.map +1 -0
- package/dist/entry/cli-entry.d.ts +15 -0
- package/dist/entry/cli-entry.js +36 -0
- package/dist/entry/cli-entry.js.map +1 -0
- package/dist/entry/commands/config-command.d.ts +10 -0
- package/dist/entry/commands/config-command.js +21 -0
- package/dist/entry/commands/config-command.js.map +1 -0
- package/dist/entry/commands/migrate-action.d.ts +2 -0
- package/dist/entry/commands/migrate-action.js +18 -0
- package/dist/entry/commands/migrate-action.js.map +1 -0
- package/dist/entry/commands/start-action.d.ts +3 -0
- package/dist/entry/commands/start-action.js +15 -0
- package/dist/entry/commands/start-action.js.map +1 -0
- package/dist/entry/commands/teardown-action.d.ts +2 -0
- package/dist/entry/commands/teardown-action.js +17 -0
- package/dist/entry/commands/teardown-action.js.map +1 -0
- package/dist/entry/entry-index.d.ts +5 -0
- package/dist/entry/entry-index.js +6 -0
- package/dist/entry/entry-index.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- 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.d.ts +30 -0
- package/dist/metrics/Metrics.js +176 -0
- package/dist/metrics/Metrics.js.map +1 -0
- package/dist/migrations/db/migrations/1684951997326-init.d.ts +3 -0
- package/dist/migrations/db/migrations/1684951997326-init.js +31 -0
- package/dist/migrations/db/migrations/1684951997326-init.js.map +1 -0
- package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.d.ts +2 -0
- package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.js +5 -0
- package/dist/migrations/db/migrations/1688556755264-initial-sync-rules.js.map +1 -0
- package/dist/migrations/db/migrations/1702295701188-sync-rule-state.d.ts +3 -0
- package/dist/migrations/db/migrations/1702295701188-sync-rule-state.js +54 -0
- package/dist/migrations/db/migrations/1702295701188-sync-rule-state.js.map +1 -0
- package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.d.ts +3 -0
- package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.js +27 -0
- package/dist/migrations/db/migrations/1711543888062-write-checkpoint-index.js.map +1 -0
- 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 +10 -0
- package/dist/migrations/migrations.js +90 -0
- package/dist/migrations/migrations.js.map +1 -0
- 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.d.ts +17 -0
- package/dist/replication/ErrorRateLimiter.js +43 -0
- package/dist/replication/ErrorRateLimiter.js.map +1 -0
- package/dist/replication/PgRelation.d.ts +16 -0
- package/dist/replication/PgRelation.js +26 -0
- package/dist/replication/PgRelation.js.map +1 -0
- package/dist/replication/WalConnection.d.ts +34 -0
- package/dist/replication/WalConnection.js +190 -0
- package/dist/replication/WalConnection.js.map +1 -0
- package/dist/replication/WalStream.d.ts +57 -0
- package/dist/replication/WalStream.js +515 -0
- package/dist/replication/WalStream.js.map +1 -0
- package/dist/replication/WalStreamManager.d.ts +30 -0
- package/dist/replication/WalStreamManager.js +198 -0
- package/dist/replication/WalStreamManager.js.map +1 -0
- package/dist/replication/WalStreamRunner.d.ts +38 -0
- package/dist/replication/WalStreamRunner.js +155 -0
- package/dist/replication/WalStreamRunner.js.map +1 -0
- package/dist/replication/replication-index.d.ts +7 -0
- package/dist/replication/replication-index.js +8 -0
- package/dist/replication/replication-index.js.map +1 -0
- package/dist/replication/util.d.ts +9 -0
- package/dist/replication/util.js +62 -0
- package/dist/replication/util.js.map +1 -0
- package/dist/routes/auth.d.ts +56 -0
- package/dist/routes/auth.js +182 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/endpoints/admin.d.ts +1011 -0
- package/dist/routes/endpoints/admin.js +207 -0
- 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/endpoints/dev.js +172 -0
- 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/endpoints/socket-route.js +119 -0
- package/dist/routes/endpoints/socket-route.js.map +1 -0
- package/dist/routes/endpoints/sync-rules.d.ts +174 -0
- package/dist/routes/endpoints/sync-rules.js +202 -0
- package/dist/routes/endpoints/sync-rules.js.map +1 -0
- package/dist/routes/endpoints/sync-stream.d.ts +132 -0
- package/dist/routes/endpoints/sync-stream.js +83 -0
- package/dist/routes/endpoints/sync-stream.js.map +1 -0
- package/dist/routes/hooks.d.ts +10 -0
- package/dist/routes/hooks.js +32 -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-socket.d.ts +10 -0
- package/dist/routes/router-socket.js +5 -0
- package/dist/routes/router-socket.js.map +1 -0
- package/dist/routes/router.d.ts +26 -0
- package/dist/routes/router.js +7 -0
- package/dist/routes/router.js.map +1 -0
- package/dist/routes/routes-index.d.ts +6 -0
- package/dist/routes/routes-index.js +7 -0
- package/dist/routes/routes-index.js.map +1 -0
- package/dist/runner/teardown.d.ts +2 -0
- package/dist/runner/teardown.js +94 -0
- package/dist/runner/teardown.js.map +1 -0
- package/dist/storage/BucketStorage.d.ts +307 -0
- package/dist/storage/BucketStorage.js +25 -0
- package/dist/storage/BucketStorage.js.map +1 -0
- package/dist/storage/ChecksumCache.d.ts +50 -0
- package/dist/storage/ChecksumCache.js +234 -0
- package/dist/storage/ChecksumCache.js.map +1 -0
- package/dist/storage/MongoBucketStorage.d.ts +52 -0
- package/dist/storage/MongoBucketStorage.js +409 -0
- package/dist/storage/MongoBucketStorage.js.map +1 -0
- package/dist/storage/SourceTable.d.ts +39 -0
- package/dist/storage/SourceTable.js +50 -0
- package/dist/storage/SourceTable.js.map +1 -0
- package/dist/storage/mongo/MongoBucketBatch.d.ts +48 -0
- package/dist/storage/mongo/MongoBucketBatch.js +581 -0
- package/dist/storage/mongo/MongoBucketBatch.js.map +1 -0
- package/dist/storage/mongo/MongoIdSequence.d.ts +12 -0
- package/dist/storage/mongo/MongoIdSequence.js +21 -0
- package/dist/storage/mongo/MongoIdSequence.js.map +1 -0
- package/dist/storage/mongo/MongoPersistedSyncRules.d.ts +9 -0
- package/dist/storage/mongo/MongoPersistedSyncRules.js +9 -0
- package/dist/storage/mongo/MongoPersistedSyncRules.js.map +1 -0
- package/dist/storage/mongo/MongoPersistedSyncRulesContent.d.ts +20 -0
- package/dist/storage/mongo/MongoPersistedSyncRulesContent.js +26 -0
- package/dist/storage/mongo/MongoPersistedSyncRulesContent.js.map +1 -0
- package/dist/storage/mongo/MongoSyncBucketStorage.d.ts +29 -0
- package/dist/storage/mongo/MongoSyncBucketStorage.js +391 -0
- package/dist/storage/mongo/MongoSyncBucketStorage.js.map +1 -0
- package/dist/storage/mongo/MongoSyncRulesLock.d.ts +16 -0
- package/dist/storage/mongo/MongoSyncRulesLock.js +65 -0
- package/dist/storage/mongo/MongoSyncRulesLock.js.map +1 -0
- package/dist/storage/mongo/OperationBatch.d.ts +26 -0
- package/dist/storage/mongo/OperationBatch.js +101 -0
- package/dist/storage/mongo/OperationBatch.js.map +1 -0
- package/dist/storage/mongo/PersistedBatch.d.ts +46 -0
- package/dist/storage/mongo/PersistedBatch.js +213 -0
- package/dist/storage/mongo/PersistedBatch.js.map +1 -0
- package/dist/storage/mongo/db.d.ts +26 -0
- package/dist/storage/mongo/db.js +35 -0
- package/dist/storage/mongo/db.js.map +1 -0
- package/dist/storage/mongo/models.d.ts +140 -0
- package/dist/storage/mongo/models.js +27 -0
- package/dist/storage/mongo/models.js.map +1 -0
- package/dist/storage/mongo/util.d.ts +26 -0
- package/dist/storage/mongo/util.js +81 -0
- package/dist/storage/mongo/util.js.map +1 -0
- package/dist/storage/storage-index.d.ts +14 -0
- package/dist/storage/storage-index.js +15 -0
- package/dist/storage/storage-index.js.map +1 -0
- package/dist/sync/BroadcastIterable.d.ts +38 -0
- package/dist/sync/BroadcastIterable.js +153 -0
- package/dist/sync/BroadcastIterable.js.map +1 -0
- package/dist/sync/LastValueSink.d.ts +25 -0
- package/dist/sync/LastValueSink.js +84 -0
- package/dist/sync/LastValueSink.js.map +1 -0
- package/dist/sync/merge.d.ts +39 -0
- package/dist/sync/merge.js +175 -0
- package/dist/sync/merge.js.map +1 -0
- package/dist/sync/safeRace.d.ts +1 -0
- package/dist/sync/safeRace.js +91 -0
- package/dist/sync/safeRace.js.map +1 -0
- package/dist/sync/sync-index.d.ts +6 -0
- package/dist/sync/sync-index.js +7 -0
- package/dist/sync/sync-index.js.map +1 -0
- package/dist/sync/sync.d.ts +18 -0
- package/dist/sync/sync.js +259 -0
- package/dist/sync/sync.js.map +1 -0
- package/dist/sync/util.d.ts +26 -0
- package/dist/sync/util.js +73 -0
- package/dist/sync/util.js.map +1 -0
- package/dist/system/CorePowerSyncSystem.d.ts +23 -0
- package/dist/system/CorePowerSyncSystem.js +52 -0
- package/dist/system/CorePowerSyncSystem.js.map +1 -0
- 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.d.ts +47 -0
- package/dist/util/Mutex.js +132 -0
- package/dist/util/Mutex.js.map +1 -0
- package/dist/util/PgManager.d.ts +24 -0
- package/dist/util/PgManager.js +55 -0
- package/dist/util/PgManager.js.map +1 -0
- package/dist/util/alerting.d.ts +2 -0
- package/dist/util/alerting.js +8 -0
- package/dist/util/alerting.js.map +1 -0
- package/dist/util/config/collectors/config-collector.d.ts +29 -0
- package/dist/util/config/collectors/config-collector.js +116 -0
- package/dist/util/config/collectors/config-collector.js.map +1 -0
- package/dist/util/config/collectors/impl/base64-config-collector.d.ts +6 -0
- package/dist/util/config/collectors/impl/base64-config-collector.js +15 -0
- package/dist/util/config/collectors/impl/base64-config-collector.js.map +1 -0
- package/dist/util/config/collectors/impl/fallback-config-collector.d.ts +11 -0
- package/dist/util/config/collectors/impl/fallback-config-collector.js +19 -0
- package/dist/util/config/collectors/impl/fallback-config-collector.js.map +1 -0
- package/dist/util/config/collectors/impl/filesystem-config-collector.d.ts +6 -0
- package/dist/util/config/collectors/impl/filesystem-config-collector.js +37 -0
- package/dist/util/config/collectors/impl/filesystem-config-collector.js.map +1 -0
- package/dist/util/config/compound-config-collector.d.ts +32 -0
- package/dist/util/config/compound-config-collector.js +130 -0
- package/dist/util/config/compound-config-collector.js.map +1 -0
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.d.ts +7 -0
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.js +17 -0
- package/dist/util/config/sync-rules/impl/base64-sync-rules-collector.js.map +1 -0
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.d.ts +7 -0
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js +21 -0
- package/dist/util/config/sync-rules/impl/filesystem-sync-rules-collector.js.map +1 -0
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.d.ts +7 -0
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.js +17 -0
- package/dist/util/config/sync-rules/impl/inline-sync-rules-collector.js.map +1 -0
- package/dist/util/config/sync-rules/sync-collector.d.ts +6 -0
- package/dist/util/config/sync-rules/sync-collector.js +3 -0
- package/dist/util/config/sync-rules/sync-collector.js.map +1 -0
- package/dist/util/config/types.d.ts +57 -0
- package/dist/util/config/types.js +7 -0
- package/dist/util/config/types.js.map +1 -0
- package/dist/util/config.d.ts +7 -0
- package/dist/util/config.js +35 -0
- package/dist/util/config.js.map +1 -0
- package/dist/util/env.d.ts +9 -0
- package/dist/util/env.js +26 -0
- package/dist/util/env.js.map +1 -0
- package/dist/util/memory-tracking.d.ts +7 -0
- package/dist/util/memory-tracking.js +58 -0
- package/dist/util/memory-tracking.js.map +1 -0
- package/dist/util/migration_lib.d.ts +11 -0
- package/dist/util/migration_lib.js +64 -0
- package/dist/util/migration_lib.js.map +1 -0
- package/dist/util/pgwire_utils.d.ts +24 -0
- package/dist/util/pgwire_utils.js +117 -0
- package/dist/util/pgwire_utils.js.map +1 -0
- package/dist/util/populate_test_data.d.ts +8 -0
- package/dist/util/populate_test_data.js +65 -0
- package/dist/util/populate_test_data.js.map +1 -0
- package/dist/util/protocol-types.d.ts +182 -0
- package/dist/util/protocol-types.js +42 -0
- package/dist/util/protocol-types.js.map +1 -0
- package/dist/util/secs.d.ts +2 -0
- package/dist/util/secs.js +49 -0
- package/dist/util/secs.js.map +1 -0
- package/dist/util/util-index.d.ts +22 -0
- package/dist/util/util-index.js +23 -0
- package/dist/util/util-index.js.map +1 -0
- package/dist/util/utils.d.ts +17 -0
- package/dist/util/utils.js +92 -0
- package/dist/util/utils.js.map +1 -0
- package/package.json +59 -0
- package/src/api/api-index.ts +2 -0
- package/src/api/diagnostics.ts +221 -0
- package/src/api/schema.ts +99 -0
- package/src/auth/CachedKeyCollector.ts +132 -0
- package/src/auth/CompoundKeyCollector.ts +33 -0
- package/src/auth/JwtPayload.ts +11 -0
- package/src/auth/KeyCollector.ts +27 -0
- package/src/auth/KeySpec.ts +67 -0
- package/src/auth/KeyStore.ts +156 -0
- package/src/auth/LeakyBucket.ts +66 -0
- package/src/auth/RemoteJWKSCollector.ts +130 -0
- package/src/auth/StaticKeyCollector.ts +21 -0
- package/src/auth/SupabaseKeyCollector.ts +67 -0
- package/src/auth/auth-index.ts +10 -0
- package/src/db/db-index.ts +1 -0
- package/src/db/mongo.ts +72 -0
- package/src/entry/cli-entry.ts +40 -0
- package/src/entry/commands/config-command.ts +36 -0
- package/src/entry/commands/migrate-action.ts +25 -0
- package/src/entry/commands/start-action.ts +24 -0
- package/src/entry/commands/teardown-action.ts +23 -0
- package/src/entry/entry-index.ts +5 -0
- package/src/index.ts +40 -0
- 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 +265 -0
- package/src/migrations/db/migrations/1684951997326-init.ts +33 -0
- package/src/migrations/db/migrations/1688556755264-initial-sync-rules.ts +5 -0
- package/src/migrations/db/migrations/1702295701188-sync-rule-state.ts +99 -0
- package/src/migrations/db/migrations/1711543888062-write-checkpoint-index.ts +32 -0
- 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 +118 -0
- package/src/migrations/store/migration-store.ts +63 -0
- package/src/replication/ErrorRateLimiter.ts +50 -0
- package/src/replication/PgRelation.ts +42 -0
- package/src/replication/WalConnection.ts +227 -0
- package/src/replication/WalStream.ts +624 -0
- package/src/replication/WalStreamManager.ts +213 -0
- package/src/replication/WalStreamRunner.ts +180 -0
- package/src/replication/replication-index.ts +7 -0
- package/src/replication/util.ts +76 -0
- package/src/routes/auth.ts +215 -0
- 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/endpoints/socket-route.ts +135 -0
- package/src/routes/endpoints/sync-rules.ts +227 -0
- package/src/routes/endpoints/sync-stream.ts +101 -0
- package/src/routes/hooks.ts +46 -0
- package/src/routes/route-register.ts +104 -0
- package/src/routes/router-socket.ts +13 -0
- package/src/routes/router.ts +46 -0
- package/src/routes/routes-index.ts +6 -0
- package/src/runner/teardown.ts +108 -0
- package/src/storage/BucketStorage.ts +396 -0
- package/src/storage/ChecksumCache.ts +294 -0
- package/src/storage/MongoBucketStorage.ts +519 -0
- package/src/storage/SourceTable.ts +60 -0
- package/src/storage/mongo/MongoBucketBatch.ts +752 -0
- package/src/storage/mongo/MongoIdSequence.ts +24 -0
- package/src/storage/mongo/MongoPersistedSyncRules.ts +16 -0
- package/src/storage/mongo/MongoPersistedSyncRulesContent.ts +47 -0
- package/src/storage/mongo/MongoSyncBucketStorage.ts +533 -0
- package/src/storage/mongo/MongoSyncRulesLock.ts +81 -0
- package/src/storage/mongo/OperationBatch.ts +115 -0
- package/src/storage/mongo/PersistedBatch.ts +268 -0
- package/src/storage/mongo/db.ts +73 -0
- package/src/storage/mongo/models.ts +162 -0
- package/src/storage/mongo/util.ts +88 -0
- package/src/storage/storage-index.ts +15 -0
- package/src/sync/BroadcastIterable.ts +161 -0
- package/src/sync/LastValueSink.ts +100 -0
- package/src/sync/merge.ts +200 -0
- package/src/sync/safeRace.ts +99 -0
- package/src/sync/sync-index.ts +6 -0
- package/src/sync/sync.ts +319 -0
- package/src/sync/util.ts +98 -0
- package/src/system/CorePowerSyncSystem.ts +64 -0
- package/src/system/system-index.ts +1 -0
- package/src/util/Mutex.ts +159 -0
- package/src/util/PgManager.ts +64 -0
- package/src/util/alerting.ts +9 -0
- package/src/util/config/collectors/config-collector.ts +143 -0
- package/src/util/config/collectors/impl/base64-config-collector.ts +18 -0
- package/src/util/config/collectors/impl/fallback-config-collector.ts +22 -0
- package/src/util/config/collectors/impl/filesystem-config-collector.ts +43 -0
- package/src/util/config/compound-config-collector.ts +176 -0
- package/src/util/config/sync-rules/impl/base64-sync-rules-collector.ts +21 -0
- package/src/util/config/sync-rules/impl/filesystem-sync-rules-collector.ts +26 -0
- package/src/util/config/sync-rules/impl/inline-sync-rules-collector.ts +21 -0
- package/src/util/config/sync-rules/sync-collector.ts +8 -0
- package/src/util/config/types.ts +66 -0
- package/src/util/config.ts +39 -0
- package/src/util/env.ts +30 -0
- package/src/util/memory-tracking.ts +67 -0
- package/src/util/migration_lib.ts +79 -0
- package/src/util/pgwire_utils.ts +139 -0
- package/src/util/populate_test_data.ts +78 -0
- package/src/util/protocol-types.ts +228 -0
- package/src/util/secs.ts +54 -0
- package/src/util/util-index.ts +25 -0
- package/src/util/utils.ts +122 -0
- package/test/src/__snapshots__/pg_test.test.ts.snap +256 -0
- package/test/src/__snapshots__/sync.test.ts.snap +247 -0
- package/test/src/auth.test.ts +342 -0
- package/test/src/broadcast_iterable.test.ts +156 -0
- package/test/src/checksum_cache.test.ts +436 -0
- package/test/src/data_storage.test.ts +1176 -0
- package/test/src/env.ts +8 -0
- package/test/src/large_batch.test.ts +194 -0
- package/test/src/merge_iterable.test.ts +355 -0
- package/test/src/pg_test.test.ts +450 -0
- package/test/src/schema_changes.test.ts +545 -0
- package/test/src/setup.ts +7 -0
- package/test/src/slow_tests.test.ts +257 -0
- package/test/src/sql_functions.test.ts +254 -0
- package/test/src/sql_operators.test.ts +132 -0
- package/test/src/sync.test.ts +293 -0
- package/test/src/sync_rules.test.ts +1053 -0
- package/test/src/util.ts +76 -0
- package/test/src/validation.test.ts +63 -0
- package/test/src/wal_stream.test.ts +319 -0
- package/test/src/wal_stream_utils.ts +147 -0
- package/test/tsconfig.json +20 -0
- package/tsconfig.json +31 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { errors, router, schema } from '@powersync/lib-services-framework';
|
|
2
|
+
import { SqlSyncRules, StaticSchema, isJsonValue, toSyncRulesValue } from '@powersync/service-sync-rules';
|
|
3
|
+
import { internal_routes } from '@powersync/service-types';
|
|
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,
|
|
11
|
+
authorize: authApi,
|
|
12
|
+
validator: schema.createTsCodecValidator(internal_routes.DemoCredentialsRequest, {
|
|
13
|
+
allowAdditional: true
|
|
14
|
+
}),
|
|
15
|
+
handler: async (payload) => {
|
|
16
|
+
const connection = payload.context.system.config.connection;
|
|
17
|
+
if (connection == null || !connection.demo_database) {
|
|
18
|
+
return internal_routes.DemoCredentialsResponse.encode({});
|
|
19
|
+
}
|
|
20
|
+
const uri = util.buildDemoPgUri(connection);
|
|
21
|
+
return internal_routes.DemoCredentialsResponse.encode({
|
|
22
|
+
credentials: {
|
|
23
|
+
postgres_uri: uri
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export const executeSql = routeDefinition({
|
|
29
|
+
path: '/api/admin/v1/execute-sql',
|
|
30
|
+
method: router.HTTPMethod.POST,
|
|
31
|
+
authorize: authApi,
|
|
32
|
+
validator: schema.createTsCodecValidator(internal_routes.ExecuteSqlRequest, { allowAdditional: true }),
|
|
33
|
+
handler: async (payload) => {
|
|
34
|
+
const connection = payload.context.system.config.connection;
|
|
35
|
+
if (connection == null || !connection.debug_api) {
|
|
36
|
+
return internal_routes.ExecuteSqlResponse.encode({
|
|
37
|
+
results: {
|
|
38
|
+
columns: [],
|
|
39
|
+
rows: []
|
|
40
|
+
},
|
|
41
|
+
success: false,
|
|
42
|
+
error: 'SQL querying is not enabled'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const pool = payload.context.system.requirePgPool();
|
|
46
|
+
const { query, args } = payload.params.sql;
|
|
47
|
+
try {
|
|
48
|
+
const result = await pool.query({
|
|
49
|
+
statement: query,
|
|
50
|
+
params: args.map(util.autoParameter)
|
|
51
|
+
});
|
|
52
|
+
return internal_routes.ExecuteSqlResponse.encode({
|
|
53
|
+
success: true,
|
|
54
|
+
results: {
|
|
55
|
+
columns: result.columns.map((c) => c.name),
|
|
56
|
+
rows: result.rows.map((row) => {
|
|
57
|
+
return row.map((value) => mapColumnValue(toSyncRulesValue(value)));
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
return internal_routes.ExecuteSqlResponse.encode({
|
|
64
|
+
results: {
|
|
65
|
+
columns: [],
|
|
66
|
+
rows: []
|
|
67
|
+
},
|
|
68
|
+
success: false,
|
|
69
|
+
error: e.message
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export const diagnostics = routeDefinition({
|
|
75
|
+
path: '/api/admin/v1/diagnostics',
|
|
76
|
+
method: router.HTTPMethod.POST,
|
|
77
|
+
authorize: authApi,
|
|
78
|
+
validator: schema.createTsCodecValidator(internal_routes.DiagnosticsRequest, { allowAdditional: true }),
|
|
79
|
+
handler: async (payload) => {
|
|
80
|
+
const include_content = payload.params.sync_rules_content ?? false;
|
|
81
|
+
const system = payload.context.system;
|
|
82
|
+
const status = await api.getConnectionStatus(system);
|
|
83
|
+
if (status == null) {
|
|
84
|
+
return internal_routes.DiagnosticsResponse.encode({
|
|
85
|
+
connections: []
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const { storage } = system;
|
|
89
|
+
const active = await storage.getActiveSyncRulesContent();
|
|
90
|
+
const next = await storage.getNextSyncRulesContent();
|
|
91
|
+
const active_status = await api.getSyncRulesStatus(active, system, {
|
|
92
|
+
include_content,
|
|
93
|
+
check_connection: status.connected,
|
|
94
|
+
live_status: true
|
|
95
|
+
});
|
|
96
|
+
const next_status = await api.getSyncRulesStatus(next, system, {
|
|
97
|
+
include_content,
|
|
98
|
+
check_connection: status.connected,
|
|
99
|
+
live_status: true
|
|
100
|
+
});
|
|
101
|
+
return internal_routes.DiagnosticsResponse.encode({
|
|
102
|
+
connections: [status],
|
|
103
|
+
active_sync_rules: active_status,
|
|
104
|
+
deploying_sync_rules: next_status
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export const getSchema = routeDefinition({
|
|
109
|
+
path: '/api/admin/v1/schema',
|
|
110
|
+
method: router.HTTPMethod.POST,
|
|
111
|
+
authorize: authApi,
|
|
112
|
+
validator: schema.createTsCodecValidator(internal_routes.GetSchemaRequest, { allowAdditional: true }),
|
|
113
|
+
handler: async (payload) => {
|
|
114
|
+
const system = payload.context.system;
|
|
115
|
+
return internal_routes.GetSchemaResponse.encode(await api.getConnectionsSchema(system));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
export const reprocess = routeDefinition({
|
|
119
|
+
path: '/api/admin/v1/reprocess',
|
|
120
|
+
method: router.HTTPMethod.POST,
|
|
121
|
+
authorize: authApi,
|
|
122
|
+
validator: schema.createTsCodecValidator(internal_routes.ReprocessRequest, { allowAdditional: true }),
|
|
123
|
+
handler: async (payload) => {
|
|
124
|
+
const system = payload.context.system;
|
|
125
|
+
const storage = system.storage;
|
|
126
|
+
const next = await storage.getNextSyncRules();
|
|
127
|
+
if (next != null) {
|
|
128
|
+
throw new Error(`Busy processing sync rules - cannot reprocess`);
|
|
129
|
+
}
|
|
130
|
+
const active = await storage.getActiveSyncRules();
|
|
131
|
+
if (active == null) {
|
|
132
|
+
throw new errors.JourneyError({
|
|
133
|
+
status: 422,
|
|
134
|
+
code: 'NO_SYNC_RULES',
|
|
135
|
+
description: 'No active sync rules'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const new_rules = await storage.updateSyncRules({
|
|
139
|
+
content: active.sync_rules.content
|
|
140
|
+
});
|
|
141
|
+
return internal_routes.ReprocessResponse.encode({
|
|
142
|
+
connections: [
|
|
143
|
+
{
|
|
144
|
+
tag: system.config.connection.tag,
|
|
145
|
+
id: system.config.connection.id,
|
|
146
|
+
slot_name: new_rules.slot_name
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
export const validate = routeDefinition({
|
|
153
|
+
path: '/api/admin/v1/validate',
|
|
154
|
+
method: router.HTTPMethod.POST,
|
|
155
|
+
authorize: authApi,
|
|
156
|
+
validator: schema.createTsCodecValidator(internal_routes.ValidateRequest, { allowAdditional: true }),
|
|
157
|
+
handler: async (payload) => {
|
|
158
|
+
const system = payload.context.system;
|
|
159
|
+
const content = payload.params.sync_rules;
|
|
160
|
+
const schemaData = await api.getConnectionsSchema(system);
|
|
161
|
+
const schema = new StaticSchema(schemaData.connections);
|
|
162
|
+
const sync_rules = {
|
|
163
|
+
// Dummy values
|
|
164
|
+
id: 0,
|
|
165
|
+
slot_name: '',
|
|
166
|
+
parsed() {
|
|
167
|
+
return {
|
|
168
|
+
...this,
|
|
169
|
+
sync_rules: SqlSyncRules.fromYaml(content, { throwOnError: false, schema })
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
sync_rules_content: content,
|
|
173
|
+
async lock() {
|
|
174
|
+
throw new Error('Lock not implemented');
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const connectionStatus = await api.getConnectionStatus(system);
|
|
178
|
+
if (connectionStatus == null) {
|
|
179
|
+
return internal_routes.ValidateResponse.encode({
|
|
180
|
+
errors: [{ level: 'fatal', message: 'No connection configured' }],
|
|
181
|
+
connections: []
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const status = (await api.getSyncRulesStatus(sync_rules, system, {
|
|
185
|
+
include_content: false,
|
|
186
|
+
check_connection: connectionStatus?.connected,
|
|
187
|
+
live_status: false
|
|
188
|
+
}));
|
|
189
|
+
if (connectionStatus == null) {
|
|
190
|
+
status.errors.push({ level: 'fatal', message: 'No connection configured' });
|
|
191
|
+
}
|
|
192
|
+
return internal_routes.ValidateResponse.encode(status);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
function mapColumnValue(value) {
|
|
196
|
+
if (typeof value == 'bigint') {
|
|
197
|
+
return Number(value);
|
|
198
|
+
}
|
|
199
|
+
else if (isJsonValue(value)) {
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
export const ADMIN_ROUTES = [demoCredentials, executeSql, diagnostics, getSchema, reprocess, validate];
|
|
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,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,0BAA0B,C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O,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,QAAQ;IACnB,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,sBAAsB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAC3F,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;QACtC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAE/B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;QACnF,OAAO;YACL,UAAU;SACX,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;IAC9C,IAAI,EAAE,yBAAyB;IAC/B,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG;IAC7B,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,sBAAsB,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IAC3F,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACzB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,OAAQ,CAAC,CAAC;QACrG,OAAO;YACL,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,CAAC;SAC3C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { router, schema } from '@powersync/lib-services-framework';
|
|
2
|
+
export declare const auth: 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
|
+
}))[];
|