dsh-database-view 0.6.0 → 0.7.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/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dsh.plugin.json +1 -1
- package/lib/client.js +15814 -10078
- package/lib/host/db/engines/mssql.js +96 -12
- package/lib/host/db/engines/mssql.js.map +1 -1
- package/lib/host/db/engines/mysql.js +108 -30
- package/lib/host/db/engines/mysql.js.map +1 -1
- package/lib/host/db/engines/oracle.js +139 -17
- package/lib/host/db/engines/oracle.js.map +1 -1
- package/lib/host/db/engines/postgres.js +100 -26
- package/lib/host/db/engines/postgres.js.map +1 -1
- package/lib/host/db/engines/sqlite.js +40 -2
- package/lib/host/db/engines/sqlite.js.map +1 -1
- package/lib/host/db/types.js.map +1 -1
- package/lib/host/descriptioncache.js +17 -14
- package/lib/host/descriptioncache.js.map +1 -1
- package/lib/host/native.js +26 -14
- package/lib/host/native.js.map +1 -1
- package/lib/host/redis.js +6 -64
- package/lib/host/redis.js.map +1 -1
- package/lib/host/structure.js +2 -2
- package/lib/host/structure.js.map +1 -1
- package/lib/shared/dialect.js +12 -0
- package/lib/shared/dialect.js.map +1 -0
- package/lib/shared/redisread.js +110 -0
- package/lib/shared/redisread.js.map +1 -0
- package/lib/shared/sqlcomment.js +29 -0
- package/lib/shared/sqlcomment.js.map +1 -0
- package/lib/shared/toolbaractions.js +1 -1
- package/lib/shared/toolbaractions.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redis commands that only read data.
|
|
3
|
+
*
|
|
4
|
+
* The host uses this to decide whether a read-only connection may run a
|
|
5
|
+
* command; the client uses the same list to decide whether a writable
|
|
6
|
+
* connection needs a write confirmation. Keeping one list avoids the two
|
|
7
|
+
* layers drifting apart (a pure read would otherwise ask for confirmation on
|
|
8
|
+
* one side and be rejected on the other).
|
|
9
|
+
*/
|
|
10
|
+
export const REDIS_READ_COMMANDS = new Set([
|
|
11
|
+
'get',
|
|
12
|
+
'mget',
|
|
13
|
+
'strlen',
|
|
14
|
+
'type',
|
|
15
|
+
'ttl',
|
|
16
|
+
'pttl',
|
|
17
|
+
'exists',
|
|
18
|
+
'scan',
|
|
19
|
+
'keys',
|
|
20
|
+
'dbsize',
|
|
21
|
+
'info',
|
|
22
|
+
'ping',
|
|
23
|
+
'echo',
|
|
24
|
+
'time',
|
|
25
|
+
'randomkey',
|
|
26
|
+
'lrange',
|
|
27
|
+
'llen',
|
|
28
|
+
'lpos',
|
|
29
|
+
'smembers',
|
|
30
|
+
'scard',
|
|
31
|
+
'sismember',
|
|
32
|
+
'sscan',
|
|
33
|
+
'hget',
|
|
34
|
+
'hmget',
|
|
35
|
+
'hgetall',
|
|
36
|
+
'hlen',
|
|
37
|
+
'hscan',
|
|
38
|
+
'hkeys',
|
|
39
|
+
'hvals',
|
|
40
|
+
'zrange',
|
|
41
|
+
'zrevrange',
|
|
42
|
+
'zrangebyscore',
|
|
43
|
+
'zcard',
|
|
44
|
+
'zscan',
|
|
45
|
+
'zscore',
|
|
46
|
+
'xrange',
|
|
47
|
+
'xrevrange',
|
|
48
|
+
'xlen',
|
|
49
|
+
'getrange',
|
|
50
|
+
'object',
|
|
51
|
+
'memory',
|
|
52
|
+
'bitcount',
|
|
53
|
+
'geopos',
|
|
54
|
+
'xread',
|
|
55
|
+
'xinfo',
|
|
56
|
+
'lindex',
|
|
57
|
+
'zcount',
|
|
58
|
+
'zlexcount',
|
|
59
|
+
'zrank',
|
|
60
|
+
'zrevrank',
|
|
61
|
+
'zmscore',
|
|
62
|
+
'hstrlen',
|
|
63
|
+
'hexists',
|
|
64
|
+
'hrandfield',
|
|
65
|
+
'getbit',
|
|
66
|
+
'bitpos',
|
|
67
|
+
'geodist',
|
|
68
|
+
'geohash',
|
|
69
|
+
'geosearch',
|
|
70
|
+
'pfcount',
|
|
71
|
+
'dump',
|
|
72
|
+
'pubsub',
|
|
73
|
+
'srandmember',
|
|
74
|
+
'sinter',
|
|
75
|
+
'sunion',
|
|
76
|
+
'sdiff',
|
|
77
|
+
'smismember',
|
|
78
|
+
// Pure reads added in Redis 6/7.
|
|
79
|
+
'zrandmember',
|
|
80
|
+
'zunion',
|
|
81
|
+
'zinter',
|
|
82
|
+
'zintercard',
|
|
83
|
+
'sintercard',
|
|
84
|
+
'zdiff',
|
|
85
|
+
'sort_ro',
|
|
86
|
+
'lcs',
|
|
87
|
+
'expiretime',
|
|
88
|
+
'pexpiretime',
|
|
89
|
+
'georadius_ro',
|
|
90
|
+
'georadiusbymember_ro',
|
|
91
|
+
// Sorted-set range variants and metadata reads.
|
|
92
|
+
'zrangebylex',
|
|
93
|
+
'zrevrangebylex',
|
|
94
|
+
'zrevrangebyscore',
|
|
95
|
+
'bitfield_ro',
|
|
96
|
+
'xpending',
|
|
97
|
+
'lolwut',
|
|
98
|
+
'lastsave',
|
|
99
|
+
'role',
|
|
100
|
+
'command',
|
|
101
|
+
'substr',
|
|
102
|
+
// Redis 7 read-only script/function entry points.
|
|
103
|
+
'eval_ro',
|
|
104
|
+
'evalsha_ro',
|
|
105
|
+
'fcall_ro',
|
|
106
|
+
]);
|
|
107
|
+
export function isRedisReadCommand(command) {
|
|
108
|
+
return REDIS_READ_COMMANDS.has(command.toLowerCase());
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=redisread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redisread.js","sourceRoot":"","sources":["../../src/shared/redisread.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IAC9D,KAAK;IACL,MAAM;IACN,QAAQ;IACR,MAAM;IACN,KAAK;IACL,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,WAAW;IACX,QAAQ;IACR,MAAM;IACN,MAAM;IACN,UAAU;IACV,OAAO;IACP,WAAW;IACX,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,WAAW;IACX,eAAe;IACf,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IACT,WAAW;IACX,SAAS;IACT,MAAM;IACN,QAAQ;IACR,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,iCAAiC;IACjC,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,SAAS;IACT,KAAK;IACL,YAAY;IACZ,aAAa;IACb,cAAc;IACd,sBAAsB;IACtB,gDAAgD;IAChD,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,aAAa;IACb,UAAU;IACV,QAAQ;IACR,UAAU;IACV,MAAM;IACN,SAAS;IACT,QAAQ;IACR,kDAAkD;IAClD,SAAS;IACT,YAAY;IACZ,UAAU;CACX,CAAC,CAAA;AAEF,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End (exclusive) of the block comment starting at `index`, or -1 when it is
|
|
3
|
+
* not closed. PostgreSQL and SQL Server nest block comments, so an inner
|
|
4
|
+
* opener must be balanced before the outer comment ends. Other dialects stop
|
|
5
|
+
* at the first closer.
|
|
6
|
+
*/
|
|
7
|
+
export function blockCommentEnd(text, index, dialect) {
|
|
8
|
+
const nesting = dialect === 'postgres' || dialect === 'mssql';
|
|
9
|
+
let depth = 1;
|
|
10
|
+
let cursor = index + 2;
|
|
11
|
+
while (cursor < text.length) {
|
|
12
|
+
if (text[cursor] === '/' && text[cursor + 1] === '*') {
|
|
13
|
+
if (nesting)
|
|
14
|
+
depth += 1;
|
|
15
|
+
cursor += 2;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (text[cursor] === '*' && text[cursor + 1] === '/') {
|
|
19
|
+
depth -= 1;
|
|
20
|
+
cursor += 2;
|
|
21
|
+
if (depth === 0)
|
|
22
|
+
return cursor;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
cursor += 1;
|
|
26
|
+
}
|
|
27
|
+
return -1;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=sqlcomment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlcomment.js","sourceRoot":"","sources":["../../src/shared/sqlcomment.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa,EAAE,OAAsB;IACjF,MAAM,OAAO,GAAG,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,OAAO,CAAA;IAC7D,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,MAAM,GAAG,KAAK,GAAG,CAAC,CAAA;IACtB,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACrD,IAAI,OAAO;gBAAE,KAAK,IAAI,CAAC,CAAA;YACvB,MAAM,IAAI,CAAC,CAAA;YACX,SAAQ;QACV,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACrD,KAAK,IAAI,CAAC,CAAA;YACV,MAAM,IAAI,CAAC,CAAA;YACX,IAAI,KAAK,KAAK,CAAC;gBAAE,OAAO,MAAM,CAAA;YAC9B,SAAQ;QACV,CAAC;QACD,MAAM,IAAI,CAAC,CAAA;IACb,CAAC;IACD,OAAO,CAAC,CAAC,CAAA;AACX,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* restart; both halves need the same id list to validate and to fall back to
|
|
6
6
|
* the default order, so it lives here instead of in the client bundle.
|
|
7
7
|
*/
|
|
8
|
-
export const TOOLBAR_ACTION_IDS = ['add', 'edit', 'duplicate', 'refresh', 'delete', 'console', 'trash'];
|
|
8
|
+
export const TOOLBAR_ACTION_IDS = ['add', 'edit', 'duplicate', 'refresh', 'disconnect', 'delete', 'console', 'trash'];
|
|
9
9
|
const TOOLBAR_ACTION_SET = new Set(TOOLBAR_ACTION_IDS);
|
|
10
10
|
export function isToolbarActionId(value) {
|
|
11
11
|
return typeof value === 'string' && TOOLBAR_ACTION_SET.has(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbaractions.js","sourceRoot":"","sources":["../../src/shared/toolbaractions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"toolbaractions.js","sourceRoot":"","sources":["../../src/shared/toolbaractions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,O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