feat(connection): 新增生产连接只读保护

This commit is contained in:
Syngnat
2026-06-23 15:33:11 +08:00
parent 3205d131c9
commit b0a9a995fb
30 changed files with 776 additions and 19 deletions

View File

@@ -240,6 +240,27 @@ describe('dataSourceCapabilities', () => {
});
});
it('forces supported SQL connections marked read-only into query-only mode', () => {
expect(getDataSourceCapabilities({ type: 'postgres', readOnly: true })).toMatchObject({
type: 'postgres',
supportsCreateDatabase: false,
supportsRenameDatabase: false,
supportsDropDatabase: false,
supportsMessagePublish: false,
forceReadOnlyQueryResult: true,
});
});
it('ignores readOnly for datasource types that do not support connection-level production guard', () => {
expect(getDataSourceCapabilities({ type: 'redis', readOnly: true })).toMatchObject({
type: 'redis',
supportsQueryEditor: false,
supportsCreateDatabase: false,
supportsDropDatabase: false,
forceReadOnlyQueryResult: false,
});
});
it('treats RabbitMQ as a queryable messaging datasource with publish support', () => {
expect(getDataSourceCapabilities({ type: 'rabbitmq' })).toMatchObject({
type: 'rabbitmq',