@jaepil/usqldb 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/LICENSE +661 -0
- package/README.md +225 -0
- package/dist/types/cli/command-handler.d.ts +52 -0
- package/dist/types/cli/command-handler.d.ts.map +1 -0
- package/dist/types/cli/completer.d.ts +23 -0
- package/dist/types/cli/completer.d.ts.map +1 -0
- package/dist/types/cli/formatter.d.ts +39 -0
- package/dist/types/cli/formatter.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +4 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/cli/shell-cli.d.ts +5 -0
- package/dist/types/cli/shell-cli.d.ts.map +1 -0
- package/dist/types/cli/shell.d.ts +41 -0
- package/dist/types/cli/shell.d.ts.map +1 -0
- package/dist/types/core/compiler.d.ts +4 -0
- package/dist/types/core/compiler.d.ts.map +1 -0
- package/dist/types/core/engine.d.ts +14 -0
- package/dist/types/core/engine.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/net/pgwire/auth.d.ts +46 -0
- package/dist/types/net/pgwire/auth.d.ts.map +1 -0
- package/dist/types/net/pgwire/config.d.ts +24 -0
- package/dist/types/net/pgwire/config.d.ts.map +1 -0
- package/dist/types/net/pgwire/connection.d.ts +84 -0
- package/dist/types/net/pgwire/connection.d.ts.map +1 -0
- package/dist/types/net/pgwire/constants.d.ts +73 -0
- package/dist/types/net/pgwire/constants.d.ts.map +1 -0
- package/dist/types/net/pgwire/errors.d.ts +210 -0
- package/dist/types/net/pgwire/errors.d.ts.map +1 -0
- package/dist/types/net/pgwire/index.d.ts +5 -0
- package/dist/types/net/pgwire/index.d.ts.map +1 -0
- package/dist/types/net/pgwire/message-codec.d.ts +65 -0
- package/dist/types/net/pgwire/message-codec.d.ts.map +1 -0
- package/dist/types/net/pgwire/messages.d.ts +126 -0
- package/dist/types/net/pgwire/messages.d.ts.map +1 -0
- package/dist/types/net/pgwire/query-executor.d.ts +34 -0
- package/dist/types/net/pgwire/query-executor.d.ts.map +1 -0
- package/dist/types/net/pgwire/read-buffer.d.ts +24 -0
- package/dist/types/net/pgwire/read-buffer.d.ts.map +1 -0
- package/dist/types/net/pgwire/server-cli.d.ts +2 -0
- package/dist/types/net/pgwire/server-cli.d.ts.map +1 -0
- package/dist/types/net/pgwire/server.d.ts +23 -0
- package/dist/types/net/pgwire/server.d.ts.map +1 -0
- package/dist/types/net/pgwire/type-codec.d.ts +9 -0
- package/dist/types/net/pgwire/type-codec.d.ts.map +1 -0
- package/dist/types/net/pgwire/write-buffer.d.ts +34 -0
- package/dist/types/net/pgwire/write-buffer.d.ts.map +1 -0
- package/dist/types/pg-compat/connection-registry.d.ts +19 -0
- package/dist/types/pg-compat/connection-registry.d.ts.map +1 -0
- package/dist/types/pg-compat/information-schema.d.ts +34 -0
- package/dist/types/pg-compat/information-schema.d.ts.map +1 -0
- package/dist/types/pg-compat/oid.d.ts +48 -0
- package/dist/types/pg-compat/oid.d.ts.map +1 -0
- package/dist/types/pg-compat/pg-catalog.d.ts +45 -0
- package/dist/types/pg-compat/pg-catalog.d.ts.map +1 -0
- package/dist/usqldb.es.js +3598 -0
- package/dist/usqldb.es.js.map +1 -0
- package/dist/usqldb.umd.js +2 -0
- package/dist/usqldb.umd.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# usqldb-js
|
|
2
|
+
|
|
3
|
+
PostgreSQL 17-compatible layer for [UQA](https://github.com/cognica-io/uqa-js) — system catalogs, psql-style CLI, and wire protocol server.
|
|
4
|
+
|
|
5
|
+
usqldb-js extends the UQA SQL engine with a comprehensive set of PostgreSQL system catalog views so that standard PostgreSQL tools — psql, SQLAlchemy, DBeaver, DataGrip, Django, and others — can introspect the database as if it were a real PostgreSQL 17 instance.
|
|
6
|
+
|
|
7
|
+
TypeScript port of [usqldb](https://github.com/cognica-io/usqldb) that runs in **web browsers** and Node.js.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **23 information_schema views** — schemata, tables, columns, constraints, views, sequences, routines, foreign tables, triggers, and more.
|
|
12
|
+
- **35 pg_catalog tables** — pg_class, pg_attribute, pg_type, pg_constraint, pg_index, pg_proc, pg_settings, statistics views, and more, with consistent OID cross-references across all of them.
|
|
13
|
+
- **PostgreSQL v3 wire protocol server** — full Simple Query and Extended Query support with SCRAM-SHA-256 / MD5 / trust authentication. Connect with psql, DBeaver, DataGrip, JDBC, psycopg, asyncpg, node-postgres, and any other PostgreSQL client.
|
|
14
|
+
- **Interactive SQL shell** — psql-style REPL with backslash commands (`\d`, `\dt`, `\di`, `\dv`, `\ds`, `\df`, `\dn`, `\du`, `\l`, `\det`, `\des`, `\dew`, `\x`, `\timing`, `\o`, `\i`, `\e`), tab-completion, expanded display, query timing, multi-line editing, and ANSI color output (automatically disabled when piped).
|
|
15
|
+
- **Drop-in engine** — `USQLEngine` is a drop-in replacement for `Engine` from `@jaepil/uqa`. Import it, and every query gets full catalog support.
|
|
16
|
+
- **Persistent storage** — file-based SQLite databases that survive across process restarts.
|
|
17
|
+
- **Browser-compatible** — ESM and UMD builds with no Node.js-specific APIs.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Node.js 20+ (for development and testing)
|
|
22
|
+
- `@jaepil/uqa` >= 0.3.7
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @jaepil/usqldb
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### As a library
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { USQLEngine } from "@jaepil/usqldb";
|
|
36
|
+
|
|
37
|
+
const engine = new USQLEngine();
|
|
38
|
+
await engine.sql("CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT)");
|
|
39
|
+
await engine.sql("INSERT INTO users (name) VALUES ('Alice')");
|
|
40
|
+
|
|
41
|
+
// information_schema
|
|
42
|
+
const cols = await engine.sql(
|
|
43
|
+
"SELECT column_name, data_type " +
|
|
44
|
+
"FROM information_schema.columns " +
|
|
45
|
+
"WHERE table_name = 'users'"
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
// pg_catalog with OID joins
|
|
49
|
+
const types = await engine.sql(
|
|
50
|
+
"SELECT c.relname, a.attname, t.typname " +
|
|
51
|
+
"FROM pg_catalog.pg_class c " +
|
|
52
|
+
"JOIN pg_catalog.pg_attribute a ON c.oid = a.attrelid " +
|
|
53
|
+
"JOIN pg_catalog.pg_type t ON a.atttypid = t.oid " +
|
|
54
|
+
"WHERE c.relname = 'users' AND a.attnum > 0"
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Wire protocol server
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { PGWireServer, createConfig, AuthMethod } from "@jaepil/usqldb/net/pgwire";
|
|
62
|
+
|
|
63
|
+
const config = createConfig({
|
|
64
|
+
host: "0.0.0.0",
|
|
65
|
+
port: 5432,
|
|
66
|
+
authMethod: AuthMethod.SCRAM_SHA_256,
|
|
67
|
+
credentials: { admin: "secret123" },
|
|
68
|
+
});
|
|
69
|
+
const server = new PGWireServer(config);
|
|
70
|
+
await server.start();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then connect with any PostgreSQL client:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
psql -h localhost -p 5432 -U admin
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### As a CLI
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# In-memory database
|
|
83
|
+
npx usqldb
|
|
84
|
+
|
|
85
|
+
# Persistent storage
|
|
86
|
+
npx usqldb --db mydata.db
|
|
87
|
+
|
|
88
|
+
# Execute a single command and exit
|
|
89
|
+
npx usqldb -c "SELECT 1"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Backslash Commands
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
General
|
|
96
|
+
\q Quit
|
|
97
|
+
\? [commands] Show help
|
|
98
|
+
\conninfo Display connection info
|
|
99
|
+
\encoding Show client encoding
|
|
100
|
+
\! [COMMAND] Execute shell command
|
|
101
|
+
|
|
102
|
+
Informational
|
|
103
|
+
\d [NAME] Describe table/view/index or list all
|
|
104
|
+
\dt[+] [PATTERN] List tables
|
|
105
|
+
\di[+] [PATTERN] List indexes
|
|
106
|
+
\dv[+] [PATTERN] List views
|
|
107
|
+
\ds[+] [PATTERN] List sequences
|
|
108
|
+
\df[+] [PATTERN] List functions
|
|
109
|
+
\dn[+] List schemas
|
|
110
|
+
\du List roles
|
|
111
|
+
\l[+] List databases
|
|
112
|
+
\det List foreign tables
|
|
113
|
+
\des List foreign servers
|
|
114
|
+
\dew List foreign data wrappers
|
|
115
|
+
|
|
116
|
+
Formatting
|
|
117
|
+
\x Toggle expanded display
|
|
118
|
+
\timing Toggle timing of commands
|
|
119
|
+
|
|
120
|
+
Input/Output
|
|
121
|
+
\o [FILE] Send output to file or stdout
|
|
122
|
+
\i FILE Execute commands from file
|
|
123
|
+
\e [FILE] Edit query or file with $EDITOR
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Browser Usage
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<script src="https://cdn.jsdelivr.net/npm/@jaepil/uqa/dist/uqa.umd.js"></script>
|
|
130
|
+
<script src="https://cdn.jsdelivr.net/npm/@jaepil/usqldb/dist/usqldb.umd.js"></script>
|
|
131
|
+
<script>
|
|
132
|
+
const engine = new usqldb.USQLEngine();
|
|
133
|
+
// ... use engine.sql() as above
|
|
134
|
+
</script>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Project Structure
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
src/
|
|
141
|
+
index.ts Public API exports
|
|
142
|
+
core/
|
|
143
|
+
engine.ts USQLEngine — drop-in replacement for Engine
|
|
144
|
+
compiler.ts Row normalization utilities
|
|
145
|
+
pg-compat/
|
|
146
|
+
oid.ts OID allocation and PostgreSQL type mapping
|
|
147
|
+
information-schema.ts 23 information_schema view builders
|
|
148
|
+
pg-catalog.ts 35 pg_catalog table builders
|
|
149
|
+
net/
|
|
150
|
+
pgwire/
|
|
151
|
+
index.ts Wire protocol public API
|
|
152
|
+
server.ts TCP server with connection management
|
|
153
|
+
connection.ts Per-client connection handler
|
|
154
|
+
query-executor.ts Simple Query and Extended Query executor
|
|
155
|
+
server-cli.ts Standalone server entry point
|
|
156
|
+
auth.ts SCRAM-SHA-256 / MD5 / trust authentication
|
|
157
|
+
config.ts Server configuration
|
|
158
|
+
message-codec.ts Frontend/backend message encoding/decoding
|
|
159
|
+
messages.ts Message type definitions
|
|
160
|
+
type-codec.ts PostgreSQL type serialization/deserialization
|
|
161
|
+
read-buffer.ts Streaming TCP read buffer
|
|
162
|
+
write-buffer.ts Binary write buffer
|
|
163
|
+
constants.ts Protocol constants and format codes
|
|
164
|
+
errors.ts PostgreSQL error response builder
|
|
165
|
+
cli/
|
|
166
|
+
index.ts CLI public API
|
|
167
|
+
shell.ts Interactive SQL shell
|
|
168
|
+
shell-cli.ts CLI entry point
|
|
169
|
+
command-handler.ts Backslash command handlers
|
|
170
|
+
completer.ts Context-aware SQL tab-completion
|
|
171
|
+
formatter.ts psql-compatible tabular and expanded output
|
|
172
|
+
tests/
|
|
173
|
+
pg-compat.test.ts 74 tests covering all catalog views
|
|
174
|
+
catalog-completeness.test.ts 94 tests for catalog query correctness
|
|
175
|
+
cli/
|
|
176
|
+
cli.test.ts 38 tests for CLI and backslash commands
|
|
177
|
+
net/pgwire/
|
|
178
|
+
server.test.ts 17 tests for wire protocol server
|
|
179
|
+
auth.test.ts 12 tests for authentication
|
|
180
|
+
message-codec.test.ts 35 tests for message encoding/decoding
|
|
181
|
+
type-codec.test.ts 53 tests for type serialization
|
|
182
|
+
buffer.test.ts 20 tests for read/write buffers
|
|
183
|
+
errors.test.ts 13 tests for error responses
|
|
184
|
+
examples/
|
|
185
|
+
01_basic_usage.ts Basic SQL operations
|
|
186
|
+
02_persistent_storage.ts File-based persistent database
|
|
187
|
+
03_catalog_introspection.ts information_schema and pg_catalog queries
|
|
188
|
+
04_pgwire_server.ts Wire protocol server
|
|
189
|
+
05_pgwire_auth.ts SCRAM-SHA-256 authentication
|
|
190
|
+
06_pgwire_client.ts Connecting with node-postgres
|
|
191
|
+
07_pgwire_persistent.ts Wire protocol with persistent storage
|
|
192
|
+
08_pgwire_shared_engine.ts Shared engine across connections
|
|
193
|
+
09_advanced_schema.ts Complex schema with constraints
|
|
194
|
+
10_usqldb_server_cli.sh Server CLI usage
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Install dependencies
|
|
201
|
+
npm install
|
|
202
|
+
|
|
203
|
+
# Type check
|
|
204
|
+
npm run check
|
|
205
|
+
|
|
206
|
+
# Run tests
|
|
207
|
+
npm test
|
|
208
|
+
|
|
209
|
+
# Build (type check + Vite bundle + type declarations)
|
|
210
|
+
npm run build
|
|
211
|
+
|
|
212
|
+
# Lint
|
|
213
|
+
npm run lint
|
|
214
|
+
|
|
215
|
+
# Format
|
|
216
|
+
npm run format
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
AGPL-3.0-only
|
|
222
|
+
|
|
223
|
+
## Author
|
|
224
|
+
|
|
225
|
+
Jaepil Jeong (jaepil@cognica.io) — [Cognica, Inc.](https://github.com/cognica-io)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Formatter } from "./formatter.js";
|
|
2
|
+
import type { USQLEngine } from "../core/engine.js";
|
|
3
|
+
/**
|
|
4
|
+
* Dispatches and executes backslash commands.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CommandHandler {
|
|
7
|
+
readonly engine: USQLEngine;
|
|
8
|
+
readonly formatter: Formatter;
|
|
9
|
+
private readonly _output;
|
|
10
|
+
showTiming: boolean;
|
|
11
|
+
outputFile: string | null;
|
|
12
|
+
dbPath: string | null;
|
|
13
|
+
executeFileFn: ((filePath: string) => void) | null;
|
|
14
|
+
constructor(engine: USQLEngine, formatter: Formatter, outputFn: (text: string) => void);
|
|
15
|
+
handle(cmdLine: string): Promise<boolean>;
|
|
16
|
+
output(text: string): void;
|
|
17
|
+
private _query;
|
|
18
|
+
private _printRows;
|
|
19
|
+
private _cmdDescribe;
|
|
20
|
+
private _cmdListRelations;
|
|
21
|
+
private _describeRelation;
|
|
22
|
+
private _describeTable;
|
|
23
|
+
private _buildFKLines;
|
|
24
|
+
private _buildReferencedBy;
|
|
25
|
+
private _describeView;
|
|
26
|
+
private _describeIndex;
|
|
27
|
+
private _describeSequence;
|
|
28
|
+
private _describeForeignTable;
|
|
29
|
+
private _cmdListTables;
|
|
30
|
+
private _cmdListTablesPlus;
|
|
31
|
+
private _cmdListIndexes;
|
|
32
|
+
private _cmdListViews;
|
|
33
|
+
private _cmdListSequences;
|
|
34
|
+
private _cmdListFunctions;
|
|
35
|
+
private _cmdListSchemas;
|
|
36
|
+
private _cmdListRoles;
|
|
37
|
+
private _cmdListDatabases;
|
|
38
|
+
private _cmdListForeignTables;
|
|
39
|
+
private _cmdListForeignServers;
|
|
40
|
+
private _cmdListForeignDataWrappers;
|
|
41
|
+
private _cmdListGraphs;
|
|
42
|
+
private _cmdToggleExpanded;
|
|
43
|
+
private _cmdToggleTiming;
|
|
44
|
+
private _cmdOutput;
|
|
45
|
+
private _cmdInclude;
|
|
46
|
+
private _cmdEdit;
|
|
47
|
+
private _cmdConninfo;
|
|
48
|
+
private _cmdEncoding;
|
|
49
|
+
private _cmdShell;
|
|
50
|
+
private _cmdHelp;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=command-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AAgB;IAUxB,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,QAAQ;IAqChB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,QAAQ;CAkCjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { USQLEngine } from "../core/engine.js";
|
|
2
|
+
/**
|
|
3
|
+
* Context-aware SQL completer with dynamic table/column names.
|
|
4
|
+
*
|
|
5
|
+
* Adapts to Node.js readline's completer interface, returning
|
|
6
|
+
* [completions, original] tuples.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Completer {
|
|
9
|
+
private readonly _engine;
|
|
10
|
+
constructor(engine: USQLEngine);
|
|
11
|
+
/**
|
|
12
|
+
* Node.js readline-compatible completer function.
|
|
13
|
+
*
|
|
14
|
+
* Returns [matchingCompletions, originalSubstring].
|
|
15
|
+
*/
|
|
16
|
+
complete(line: string): [string[], string];
|
|
17
|
+
private _tableCompletions;
|
|
18
|
+
private _getWordBeforeCursor;
|
|
19
|
+
private _getCompiler;
|
|
20
|
+
private _getMap;
|
|
21
|
+
private _getColumnNames;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=completer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completer.d.ts","sourceRoot":"","sources":["../../../src/cli/completer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAgPpD;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEzB,MAAM,EAAE,UAAU;IAI9B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC;IA2H1C,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,eAAe;CAcxB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type Row = Record<string, unknown>;
|
|
2
|
+
interface SQLResult {
|
|
3
|
+
readonly columns: string[];
|
|
4
|
+
readonly rows: Row[];
|
|
5
|
+
}
|
|
6
|
+
export declare const ANSI: {
|
|
7
|
+
reset: string;
|
|
8
|
+
bold: string;
|
|
9
|
+
dim: string;
|
|
10
|
+
red: string;
|
|
11
|
+
cyan: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Stateful output formatter matching psql display conventions.
|
|
15
|
+
*
|
|
16
|
+
* Supports two modes:
|
|
17
|
+
* - aligned (default): columnar table with | separators
|
|
18
|
+
* - expanded (\x): vertical, one column per line
|
|
19
|
+
*/
|
|
20
|
+
export declare class Formatter {
|
|
21
|
+
expanded: boolean;
|
|
22
|
+
nullDisplay: string;
|
|
23
|
+
useColor: boolean;
|
|
24
|
+
private _wrap;
|
|
25
|
+
/**
|
|
26
|
+
* Format a SQLResult for terminal display.
|
|
27
|
+
*/
|
|
28
|
+
formatResult(result: SQLResult, title?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Format raw column/row data for terminal display.
|
|
31
|
+
*/
|
|
32
|
+
formatRows(columns: string[], rows: Row[], title?: string): string;
|
|
33
|
+
private _formatAligned;
|
|
34
|
+
private _formatExpanded;
|
|
35
|
+
private _colorizeCell;
|
|
36
|
+
private _formatValue;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../src/cli/formatter.ts"],"names":[],"mappings":"AAOA,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,UAAU,SAAS;IACjB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,IAAI;;;;;;CAMhB,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,QAAQ,EAAE,OAAO,CAAS;IAC1B,WAAW,EAAE,MAAM,CAAM;IACzB,QAAQ,EAAE,OAAO,CAAQ;IAEzB,OAAO,CAAC,KAAK;IAWb;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAWvD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAWlE,OAAO,CAAC,cAAc;IA8EtB,OAAO,CAAC,eAAe;IAyCvB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,YAAY;CAarB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-cli.d.ts","sourceRoot":"","sources":["../../../src/cli/shell-cli.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,wBAAsB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EzD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive SQL shell backed by a USQLEngine.
|
|
3
|
+
*/
|
|
4
|
+
export declare class USQLShell {
|
|
5
|
+
private readonly _dbPath;
|
|
6
|
+
private readonly _engine;
|
|
7
|
+
private readonly _formatter;
|
|
8
|
+
private readonly _commands;
|
|
9
|
+
private readonly _completer;
|
|
10
|
+
private readonly _useColor;
|
|
11
|
+
private _rl;
|
|
12
|
+
constructor(opts?: {
|
|
13
|
+
dbPath?: string;
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Execute every statement in a SQL script file.
|
|
17
|
+
*/
|
|
18
|
+
runFile(filePath: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Execute every statement in a SQL script file (async version).
|
|
21
|
+
*/
|
|
22
|
+
runFileAsync(filePath: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Enter the read-eval-print loop.
|
|
25
|
+
*/
|
|
26
|
+
run(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Close the engine and clean up.
|
|
29
|
+
*/
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
_executeText(text: string): Promise<void>;
|
|
32
|
+
private _executeSQL;
|
|
33
|
+
private _printResult;
|
|
34
|
+
private _print;
|
|
35
|
+
private _colorError;
|
|
36
|
+
private _colorDim;
|
|
37
|
+
private static _historyPath;
|
|
38
|
+
private _ensureReadline;
|
|
39
|
+
private _printBanner;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/cli/shell.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,GAAG,CAAmC;gBAElC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAoBtC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ/B;;OAEG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnD;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAwE1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAiBjC,WAAW;IAiBzB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,MAAM,CAAC,YAAY;IAM3B,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../src/core/compiler.ts"],"names":[],"mappings":"AAYA,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAoBhD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Engine } from "@jaepil/uqa";
|
|
2
|
+
import type { SQLResult } from "@jaepil/uqa";
|
|
3
|
+
export declare class USQLEngine extends Engine {
|
|
4
|
+
private _oidAllocator;
|
|
5
|
+
constructor(opts?: {
|
|
6
|
+
dbPath?: string;
|
|
7
|
+
parallelWorkers?: number;
|
|
8
|
+
spillThreshold?: number;
|
|
9
|
+
});
|
|
10
|
+
private _patchCompiler;
|
|
11
|
+
private _getOids;
|
|
12
|
+
sql(query: string, params?: unknown[]): Promise<SQLResult | null>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/core/engine.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAyD7C,qBAAa,UAAW,SAAQ,MAAM;IACpC,OAAO,CAAC,aAAa,CAA6B;gBAEtC,IAAI,CAAC,EAAE;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IAKD,OAAO,CAAC,cAAc;IA4StB,OAAO,CAAC,QAAQ;IAQD,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;CAWjF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { USQLEngine } from "./core/engine.js";
|
|
2
|
+
export { normalizeRows } from "./core/compiler.js";
|
|
3
|
+
export { OIDAllocator } from "./pg-compat/oid.js";
|
|
4
|
+
export { InformationSchemaProvider } from "./pg-compat/information-schema.js";
|
|
5
|
+
export { PGCatalogProvider } from "./pg-compat/pg-catalog.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare enum AuthMethod {
|
|
2
|
+
TRUST = "trust",
|
|
3
|
+
CLEARTEXT = "password",
|
|
4
|
+
MD5 = "md5",
|
|
5
|
+
SCRAM_SHA_256 = "scram-sha-256"
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class Authenticator {
|
|
8
|
+
protected readonly _username: string;
|
|
9
|
+
protected readonly _password: string | null;
|
|
10
|
+
constructor(username: string, password: string | null);
|
|
11
|
+
/** Produce the first server authentication message. */
|
|
12
|
+
abstract initial(): [Buffer, boolean];
|
|
13
|
+
/** Process a client authentication message. */
|
|
14
|
+
abstract step(data: Buffer): [Buffer, boolean];
|
|
15
|
+
}
|
|
16
|
+
export declare class TrustAuthenticator extends Authenticator {
|
|
17
|
+
initial(): [Buffer, boolean];
|
|
18
|
+
step(_data: Buffer): [Buffer, boolean];
|
|
19
|
+
}
|
|
20
|
+
export declare class CleartextAuthenticator extends Authenticator {
|
|
21
|
+
initial(): [Buffer, boolean];
|
|
22
|
+
step(data: Buffer): [Buffer, boolean];
|
|
23
|
+
}
|
|
24
|
+
export declare class MD5Authenticator extends Authenticator {
|
|
25
|
+
private readonly _salt;
|
|
26
|
+
constructor(username: string, password: string | null);
|
|
27
|
+
initial(): [Buffer, boolean];
|
|
28
|
+
step(data: Buffer): [Buffer, boolean];
|
|
29
|
+
}
|
|
30
|
+
export declare class ScramSHA256Authenticator extends Authenticator {
|
|
31
|
+
private static readonly _ITERATIONS;
|
|
32
|
+
private _serverNonce;
|
|
33
|
+
private _combinedNonce;
|
|
34
|
+
private _salt;
|
|
35
|
+
private _clientFirstBare;
|
|
36
|
+
private _serverFirst;
|
|
37
|
+
private _storedKey;
|
|
38
|
+
private _serverKey;
|
|
39
|
+
_phase: number;
|
|
40
|
+
initial(): [Buffer, boolean];
|
|
41
|
+
step(data: Buffer): [Buffer, boolean];
|
|
42
|
+
private _handleClientFirst;
|
|
43
|
+
private _handleClientFinal;
|
|
44
|
+
}
|
|
45
|
+
export declare function createAuthenticator(method: string, username: string, credentials: Record<string, string> | null): Authenticator;
|
|
46
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/auth.ts"],"names":[],"mappings":"AA6BA,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,SAAS,aAAa;IACtB,GAAG,QAAQ;IACX,aAAa,kBAAkB;CAChC;AAMD,8BAAsB,aAAa;IACjC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IACrC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEhC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKrD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAErC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;CAC/C;AAMD,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAI5B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;CAGvC;AAMD,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;CAiBtC;AAMD,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKrD,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;CAiCtC;AAMD,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAE3C,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,UAAU,CAA2B;IAC7C,MAAM,SAAK;IAEX,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAI5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAYrC,OAAO,CAAC,kBAAkB;IA8E1B,OAAO,CAAC,kBAAkB;CAoE3B;AA8CD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GACzC,aAAa,CAiBf"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Configuration for a PGWireServer instance. */
|
|
2
|
+
export interface PGWireConfig {
|
|
3
|
+
/** Bind address for the TCP listener. */
|
|
4
|
+
readonly host: string;
|
|
5
|
+
/** Bind port. Use 0 for an OS-assigned ephemeral port. */
|
|
6
|
+
readonly port: number;
|
|
7
|
+
/** Path passed to USQLEngine for persistent storage. null creates an in-memory engine per connection. */
|
|
8
|
+
readonly dbPath: string | null;
|
|
9
|
+
/** Authentication method name: "trust", "password", "md5", or "scram-sha-256". */
|
|
10
|
+
readonly authMethod: string;
|
|
11
|
+
/** Mapping of {username: password} for password-based auth. */
|
|
12
|
+
readonly credentials: Record<string, string> | null;
|
|
13
|
+
/** Path to an SSL certificate file (PEM). When set together with sslKeyfile, the server accepts SSL connections. */
|
|
14
|
+
readonly sslCertfile: string | null;
|
|
15
|
+
/** Path to an SSL private key file (PEM). */
|
|
16
|
+
readonly sslKeyfile: string | null;
|
|
17
|
+
/** Maximum number of concurrent client connections. */
|
|
18
|
+
readonly maxConnections: number;
|
|
19
|
+
/** Optional callable that returns a USQLEngine instance. When provided, this overrides dbPath. */
|
|
20
|
+
readonly engineFactory: (() => unknown) | null;
|
|
21
|
+
}
|
|
22
|
+
/** Create a PGWireConfig with defaults for omitted fields. */
|
|
23
|
+
export declare function createConfig(overrides?: Partial<PGWireConfig>): PGWireConfig;
|
|
24
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/config.ts"],"names":[],"mappings":"AAKA,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACpD,oHAAoH;IACpH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uDAAuD;IACvD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kGAAkG;IAClG,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC;CAChD;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAY5E"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type * as net from "node:net";
|
|
2
|
+
import * as tls from "node:tls";
|
|
3
|
+
import type { USQLEngine } from "../../core/engine.js";
|
|
4
|
+
export declare class SocketReader {
|
|
5
|
+
private _socket;
|
|
6
|
+
private _buffer;
|
|
7
|
+
private _pendingResolve;
|
|
8
|
+
private _pendingReject;
|
|
9
|
+
private _pendingBytes;
|
|
10
|
+
private _closed;
|
|
11
|
+
private _error;
|
|
12
|
+
constructor(socket: net.Socket);
|
|
13
|
+
/** Replace the underlying socket (e.g. after TLS upgrade). */
|
|
14
|
+
replaceSocket(socket: net.Socket): void;
|
|
15
|
+
/** Read exactly n bytes, returning a Promise that resolves when enough data is available. */
|
|
16
|
+
readExactly(n: number): Promise<Buffer>;
|
|
17
|
+
private _tryResolve;
|
|
18
|
+
}
|
|
19
|
+
export declare class PGWireConnection {
|
|
20
|
+
private _reader;
|
|
21
|
+
private _socket;
|
|
22
|
+
private readonly _engine;
|
|
23
|
+
private readonly _executor;
|
|
24
|
+
private readonly _authMethod;
|
|
25
|
+
private readonly _credentials;
|
|
26
|
+
private readonly _processId;
|
|
27
|
+
private readonly _secretKey;
|
|
28
|
+
private readonly _cancelCallback;
|
|
29
|
+
private readonly _secureContext;
|
|
30
|
+
private _txStatus;
|
|
31
|
+
private _statements;
|
|
32
|
+
private _portals;
|
|
33
|
+
private _sessionParams;
|
|
34
|
+
private _username;
|
|
35
|
+
private _database;
|
|
36
|
+
private _closed;
|
|
37
|
+
private _canceled;
|
|
38
|
+
private _backendStart;
|
|
39
|
+
private _queryStart;
|
|
40
|
+
private _stateChange;
|
|
41
|
+
private _currentQuery;
|
|
42
|
+
private _state;
|
|
43
|
+
private _clientAddr;
|
|
44
|
+
private _clientPort;
|
|
45
|
+
private _applicationName;
|
|
46
|
+
private _registryInfo;
|
|
47
|
+
constructor(socket: net.Socket, engine: USQLEngine, options?: {
|
|
48
|
+
authMethod?: string;
|
|
49
|
+
credentials?: Record<string, string> | null;
|
|
50
|
+
processId?: number;
|
|
51
|
+
secretKey?: number;
|
|
52
|
+
cancelCallback?: ((processId: number, secretKey: number) => void) | null;
|
|
53
|
+
secureContext?: tls.SecureContext | null;
|
|
54
|
+
});
|
|
55
|
+
get processId(): number;
|
|
56
|
+
get secretKey(): number;
|
|
57
|
+
/** Mark this connection's current query as canceled. */
|
|
58
|
+
cancel(): void;
|
|
59
|
+
run(): Promise<void>;
|
|
60
|
+
private _handleStartup;
|
|
61
|
+
private _authenticate;
|
|
62
|
+
private _sendStartupParameters;
|
|
63
|
+
private _mainLoop;
|
|
64
|
+
private _handleQuery;
|
|
65
|
+
private _sendQueryResult;
|
|
66
|
+
private _handleParse;
|
|
67
|
+
private _handleBind;
|
|
68
|
+
private _handleDescribe;
|
|
69
|
+
private _handleExecute;
|
|
70
|
+
private _handleClose;
|
|
71
|
+
private _handleSync;
|
|
72
|
+
private _handleFlush;
|
|
73
|
+
private _readMessage;
|
|
74
|
+
private _sendError;
|
|
75
|
+
private _sendReadyForQuery;
|
|
76
|
+
private _invalidatePortalsForStatement;
|
|
77
|
+
private static _applyFormatCodes;
|
|
78
|
+
/** Await the socket 'drain' event when backpressure occurs. */
|
|
79
|
+
private _drain;
|
|
80
|
+
private _close;
|
|
81
|
+
private _registerWithRegistry;
|
|
82
|
+
private _updateRegistryState;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/connection.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAqChC,OAAO,KAAK,EAAE,UAA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