@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.
Files changed (61) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +225 -0
  3. package/dist/types/cli/command-handler.d.ts +52 -0
  4. package/dist/types/cli/command-handler.d.ts.map +1 -0
  5. package/dist/types/cli/completer.d.ts +23 -0
  6. package/dist/types/cli/completer.d.ts.map +1 -0
  7. package/dist/types/cli/formatter.d.ts +39 -0
  8. package/dist/types/cli/formatter.d.ts.map +1 -0
  9. package/dist/types/cli/index.d.ts +4 -0
  10. package/dist/types/cli/index.d.ts.map +1 -0
  11. package/dist/types/cli/shell-cli.d.ts +5 -0
  12. package/dist/types/cli/shell-cli.d.ts.map +1 -0
  13. package/dist/types/cli/shell.d.ts +41 -0
  14. package/dist/types/cli/shell.d.ts.map +1 -0
  15. package/dist/types/core/compiler.d.ts +4 -0
  16. package/dist/types/core/compiler.d.ts.map +1 -0
  17. package/dist/types/core/engine.d.ts +14 -0
  18. package/dist/types/core/engine.d.ts.map +1 -0
  19. package/dist/types/index.d.ts +6 -0
  20. package/dist/types/index.d.ts.map +1 -0
  21. package/dist/types/net/pgwire/auth.d.ts +46 -0
  22. package/dist/types/net/pgwire/auth.d.ts.map +1 -0
  23. package/dist/types/net/pgwire/config.d.ts +24 -0
  24. package/dist/types/net/pgwire/config.d.ts.map +1 -0
  25. package/dist/types/net/pgwire/connection.d.ts +84 -0
  26. package/dist/types/net/pgwire/connection.d.ts.map +1 -0
  27. package/dist/types/net/pgwire/constants.d.ts +73 -0
  28. package/dist/types/net/pgwire/constants.d.ts.map +1 -0
  29. package/dist/types/net/pgwire/errors.d.ts +210 -0
  30. package/dist/types/net/pgwire/errors.d.ts.map +1 -0
  31. package/dist/types/net/pgwire/index.d.ts +5 -0
  32. package/dist/types/net/pgwire/index.d.ts.map +1 -0
  33. package/dist/types/net/pgwire/message-codec.d.ts +65 -0
  34. package/dist/types/net/pgwire/message-codec.d.ts.map +1 -0
  35. package/dist/types/net/pgwire/messages.d.ts +126 -0
  36. package/dist/types/net/pgwire/messages.d.ts.map +1 -0
  37. package/dist/types/net/pgwire/query-executor.d.ts +34 -0
  38. package/dist/types/net/pgwire/query-executor.d.ts.map +1 -0
  39. package/dist/types/net/pgwire/read-buffer.d.ts +24 -0
  40. package/dist/types/net/pgwire/read-buffer.d.ts.map +1 -0
  41. package/dist/types/net/pgwire/server-cli.d.ts +2 -0
  42. package/dist/types/net/pgwire/server-cli.d.ts.map +1 -0
  43. package/dist/types/net/pgwire/server.d.ts +23 -0
  44. package/dist/types/net/pgwire/server.d.ts.map +1 -0
  45. package/dist/types/net/pgwire/type-codec.d.ts +9 -0
  46. package/dist/types/net/pgwire/type-codec.d.ts.map +1 -0
  47. package/dist/types/net/pgwire/write-buffer.d.ts +34 -0
  48. package/dist/types/net/pgwire/write-buffer.d.ts.map +1 -0
  49. package/dist/types/pg-compat/connection-registry.d.ts +19 -0
  50. package/dist/types/pg-compat/connection-registry.d.ts.map +1 -0
  51. package/dist/types/pg-compat/information-schema.d.ts +34 -0
  52. package/dist/types/pg-compat/information-schema.d.ts.map +1 -0
  53. package/dist/types/pg-compat/oid.d.ts +48 -0
  54. package/dist/types/pg-compat/oid.d.ts.map +1 -0
  55. package/dist/types/pg-compat/pg-catalog.d.ts +45 -0
  56. package/dist/types/pg-compat/pg-catalog.d.ts.map +1 -0
  57. package/dist/usqldb.es.js +3598 -0
  58. package/dist/usqldb.es.js.map +1 -0
  59. package/dist/usqldb.umd.js +2 -0
  60. package/dist/usqldb.umd.js.map +1 -0
  61. package/package.json +65 -0
@@ -0,0 +1,73 @@
1
+ export declare const PROTOCOL_VERSION = 196608;
2
+ export declare const SSL_REQUEST_CODE = 80877103;
3
+ export declare const CANCEL_REQUEST_CODE = 80877102;
4
+ export declare const GSSENC_REQUEST_CODE = 80877104;
5
+ export declare const QUERY: number;
6
+ export declare const PARSE: number;
7
+ export declare const BIND: number;
8
+ export declare const DESCRIBE: number;
9
+ export declare const EXECUTE: number;
10
+ export declare const CLOSE: number;
11
+ export declare const SYNC: number;
12
+ export declare const FLUSH: number;
13
+ export declare const TERMINATE: number;
14
+ export declare const COPY_DATA: number;
15
+ export declare const COPY_DONE: number;
16
+ export declare const COPY_FAIL: number;
17
+ export declare const PASSWORD: number;
18
+ export declare const FUNCTION_CALL: number;
19
+ export declare const AUTH: number;
20
+ export declare const PARAMETER_STATUS: number;
21
+ export declare const BACKEND_KEY_DATA: number;
22
+ export declare const READY_FOR_QUERY: number;
23
+ export declare const ROW_DESCRIPTION: number;
24
+ export declare const DATA_ROW: number;
25
+ export declare const COMMAND_COMPLETE: number;
26
+ export declare const ERROR_RESPONSE: number;
27
+ export declare const NOTICE_RESPONSE: number;
28
+ export declare const EMPTY_QUERY: number;
29
+ export declare const PARSE_COMPLETE: number;
30
+ export declare const BIND_COMPLETE: number;
31
+ export declare const CLOSE_COMPLETE: number;
32
+ export declare const NO_DATA: number;
33
+ export declare const PARAMETER_DESCRIPTION: number;
34
+ export declare const PORTAL_SUSPENDED: number;
35
+ export declare const COPY_IN_RESPONSE: number;
36
+ export declare const COPY_OUT_RESPONSE: number;
37
+ export declare const NOTIFICATION: number;
38
+ export declare const AUTH_OK = 0;
39
+ export declare const AUTH_KERBEROS_V5 = 2;
40
+ export declare const AUTH_CLEARTEXT = 3;
41
+ export declare const AUTH_MD5 = 5;
42
+ export declare const AUTH_SCM_CREDENTIAL = 6;
43
+ export declare const AUTH_GSS = 7;
44
+ export declare const AUTH_GSS_CONTINUE = 8;
45
+ export declare const AUTH_SSPI = 9;
46
+ export declare const AUTH_SASL = 10;
47
+ export declare const AUTH_SASL_CONTINUE = 11;
48
+ export declare const AUTH_SASL_FINAL = 12;
49
+ export declare const FIELD_SEVERITY: number;
50
+ export declare const FIELD_SEVERITY_V: number;
51
+ export declare const FIELD_SQLSTATE: number;
52
+ export declare const FIELD_MESSAGE: number;
53
+ export declare const FIELD_DETAIL: number;
54
+ export declare const FIELD_HINT: number;
55
+ export declare const FIELD_POSITION: number;
56
+ export declare const FIELD_INTERNAL_POSITION: number;
57
+ export declare const FIELD_INTERNAL_QUERY: number;
58
+ export declare const FIELD_WHERE: number;
59
+ export declare const FIELD_SCHEMA: number;
60
+ export declare const FIELD_TABLE: number;
61
+ export declare const FIELD_COLUMN: number;
62
+ export declare const FIELD_DATA_TYPE: number;
63
+ export declare const FIELD_CONSTRAINT: number;
64
+ export declare const FIELD_FILE: number;
65
+ export declare const FIELD_LINE: number;
66
+ export declare const FIELD_ROUTINE: number;
67
+ export declare const TX_IDLE: number;
68
+ export declare const TX_IN_TRANSACTION: number;
69
+ export declare const TX_FAILED: number;
70
+ export declare const FORMAT_TEXT = 0;
71
+ export declare const FORMAT_BINARY = 1;
72
+ export declare const DEFAULT_SERVER_PARAMS: Readonly<Record<string, string>>;
73
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/constants.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,gBAAgB,SAAS,CAAC;AACvC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAM5C,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,IAAI,QAAoB,CAAC;AACtC,eAAO,MAAM,QAAQ,QAAoB,CAAC;AAC1C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,IAAI,QAAoB,CAAC;AACtC,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAC3C,eAAO,MAAM,SAAS,QAAoB,CAAC;AAC3C,eAAO,MAAM,SAAS,QAAoB,C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AACrC,eAAO,MAAM,eAAe,KAAK,CAAC;AAMlC,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAClD,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,aAAa,QAAoB,CAAC;AAC/C,eAAO,MAAM,YAAY,QAAoB,CAAC;AAC9C,eAAO,MAAM,UAAU,QAAoB,CAAC;AAC5C,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AACzD,eAAO,MAAM,oBAAoB,QAAoB,CAAC;AACtD,eAAO,MAAM,WAAW,QAAoB,CAAC;AAC7C,eAAO,MAAM,YAAY,QAAoB,CAAC;AAC9C,eAAO,MAAM,WAAW,QAAoB,CAAC;AAC7C,eAAO,MAAM,YAAY,QAAoB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAoB,CAAC;AACjD,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAClD,eAAO,MAAM,UAAU,QAAoB,CAAC;AAC5C,eAAO,MAAM,UAAU,QAAoB,CAAC;AAC5C,eAAO,MAAM,aAAa,QAAoB,CAAC;AAM/C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,iBAAiB,QAAoB,CAAC;AACnD,eAAO,MAAM,SAAS,QAAoB,CAAC;AAM3C,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,aAAa,IAAI,CAAC;AAM/B,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAclE,CAAC"}
@@ -0,0 +1,210 @@
1
+ export declare class PGWireError extends Error {
2
+ /** Static severity for class-level access. */
3
+ static readonly severity: string;
4
+ /** Static sqlstate for class-level access. */
5
+ static readonly sqlstate: string;
6
+ readonly detail: string | null;
7
+ readonly hint: string | null;
8
+ readonly position: number | null;
9
+ constructor(message: string, options?: {
10
+ detail?: string | null;
11
+ hint?: string | null;
12
+ position?: number | null;
13
+ });
14
+ /** Instance accessor for severity (delegates to the subclass static). */
15
+ getSeverity(): string;
16
+ /** Instance accessor for sqlstate (delegates to the subclass static). */
17
+ getSqlstate(): string;
18
+ /** Build the ErrorResponse field map for wire encoding. */
19
+ toFields(): Map<number, string>;
20
+ }
21
+ export declare class SQLSyntaxError extends PGWireError {
22
+ static readonly sqlstate = "42601";
23
+ constructor(message: string, options?: {
24
+ detail?: string | null;
25
+ hint?: string | null;
26
+ position?: number | null;
27
+ });
28
+ }
29
+ export declare class UndefinedTable extends PGWireError {
30
+ static readonly sqlstate = "42P01";
31
+ constructor(message: string, options?: {
32
+ detail?: string | null;
33
+ hint?: string | null;
34
+ position?: number | null;
35
+ });
36
+ }
37
+ export declare class UndefinedColumn extends PGWireError {
38
+ static readonly sqlstate = "42703";
39
+ constructor(message: string, options?: {
40
+ detail?: string | null;
41
+ hint?: string | null;
42
+ position?: number | null;
43
+ });
44
+ }
45
+ export declare class DuplicateTable extends PGWireError {
46
+ static readonly sqlstate = "42P07";
47
+ constructor(message: string, options?: {
48
+ detail?: string | null;
49
+ hint?: string | null;
50
+ position?: number | null;
51
+ });
52
+ }
53
+ export declare class DuplicateColumn extends PGWireError {
54
+ static readonly sqlstate = "42701";
55
+ constructor(message: string, options?: {
56
+ detail?: string | null;
57
+ hint?: string | null;
58
+ position?: number | null;
59
+ });
60
+ }
61
+ export declare class UndefinedFunction extends PGWireError {
62
+ static readonly sqlstate = "42883";
63
+ constructor(message: string, options?: {
64
+ detail?: string | null;
65
+ hint?: string | null;
66
+ position?: number | null;
67
+ });
68
+ }
69
+ export declare class InvalidSchemaName extends PGWireError {
70
+ static readonly sqlstate = "3F000";
71
+ constructor(message: string, options?: {
72
+ detail?: string | null;
73
+ hint?: string | null;
74
+ position?: number | null;
75
+ });
76
+ }
77
+ export declare class IntegrityConstraintViolation extends PGWireError {
78
+ static readonly sqlstate = "23000";
79
+ constructor(message: string, options?: {
80
+ detail?: string | null;
81
+ hint?: string | null;
82
+ position?: number | null;
83
+ });
84
+ }
85
+ export declare class UniqueViolation extends PGWireError {
86
+ static readonly sqlstate = "23505";
87
+ constructor(message: string, options?: {
88
+ detail?: string | null;
89
+ hint?: string | null;
90
+ position?: number | null;
91
+ });
92
+ }
93
+ export declare class ForeignKeyViolation extends PGWireError {
94
+ static readonly sqlstate = "23503";
95
+ constructor(message: string, options?: {
96
+ detail?: string | null;
97
+ hint?: string | null;
98
+ position?: number | null;
99
+ });
100
+ }
101
+ export declare class NotNullViolation extends PGWireError {
102
+ static readonly sqlstate = "23502";
103
+ constructor(message: string, options?: {
104
+ detail?: string | null;
105
+ hint?: string | null;
106
+ position?: number | null;
107
+ });
108
+ }
109
+ export declare class CheckViolation extends PGWireError {
110
+ static readonly sqlstate = "23514";
111
+ constructor(message: string, options?: {
112
+ detail?: string | null;
113
+ hint?: string | null;
114
+ position?: number | null;
115
+ });
116
+ }
117
+ export declare class FeatureNotSupported extends PGWireError {
118
+ static readonly sqlstate = "0A000";
119
+ constructor(message: string, options?: {
120
+ detail?: string | null;
121
+ hint?: string | null;
122
+ position?: number | null;
123
+ });
124
+ }
125
+ export declare class InvalidParameterValue extends PGWireError {
126
+ static readonly sqlstate = "22023";
127
+ constructor(message: string, options?: {
128
+ detail?: string | null;
129
+ hint?: string | null;
130
+ position?: number | null;
131
+ });
132
+ }
133
+ export declare class DivisionByZero extends PGWireError {
134
+ static readonly sqlstate = "22012";
135
+ constructor(message: string, options?: {
136
+ detail?: string | null;
137
+ hint?: string | null;
138
+ position?: number | null;
139
+ });
140
+ }
141
+ export declare class InvalidTextRepresentation extends PGWireError {
142
+ static readonly sqlstate = "22P02";
143
+ constructor(message: string, options?: {
144
+ detail?: string | null;
145
+ hint?: string | null;
146
+ position?: number | null;
147
+ });
148
+ }
149
+ export declare class ProtocolViolation extends PGWireError {
150
+ static readonly sqlstate = "08P01";
151
+ constructor(message: string, options?: {
152
+ detail?: string | null;
153
+ hint?: string | null;
154
+ position?: number | null;
155
+ });
156
+ }
157
+ export declare class InvalidAuthorizationSpecification extends PGWireError {
158
+ static readonly sqlstate = "28000";
159
+ static readonly severity = "FATAL";
160
+ constructor(message: string, options?: {
161
+ detail?: string | null;
162
+ hint?: string | null;
163
+ position?: number | null;
164
+ });
165
+ }
166
+ export declare class InvalidPassword extends PGWireError {
167
+ static readonly sqlstate = "28P01";
168
+ static readonly severity = "FATAL";
169
+ constructor(message: string, options?: {
170
+ detail?: string | null;
171
+ hint?: string | null;
172
+ position?: number | null;
173
+ });
174
+ }
175
+ export declare class QueryCanceled extends PGWireError {
176
+ static readonly sqlstate = "57014";
177
+ constructor(message: string, options?: {
178
+ detail?: string | null;
179
+ hint?: string | null;
180
+ position?: number | null;
181
+ });
182
+ }
183
+ export declare class AdminShutdown extends PGWireError {
184
+ static readonly sqlstate = "57P01";
185
+ static readonly severity = "FATAL";
186
+ constructor(message: string, options?: {
187
+ detail?: string | null;
188
+ hint?: string | null;
189
+ position?: number | null;
190
+ });
191
+ }
192
+ export declare class InvalidTransactionState extends PGWireError {
193
+ static readonly sqlstate = "25000";
194
+ constructor(message: string, options?: {
195
+ detail?: string | null;
196
+ hint?: string | null;
197
+ position?: number | null;
198
+ });
199
+ }
200
+ export declare class InFailedSQLTransaction extends PGWireError {
201
+ static readonly sqlstate = "25P02";
202
+ constructor(message: string, options?: {
203
+ detail?: string | null;
204
+ hint?: string | null;
205
+ position?: number | null;
206
+ });
207
+ }
208
+ /** Convert a USQLEngine exception to a PGWireError. */
209
+ export declare function mapEngineException(exc: unknown): PGWireError;
210
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/errors.ts"],"names":[],"mappings":"AAuBA,qBAAa,WAAY,SAAQ,KAAK;IACpC,8CAA8C;IAC9C,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAW;IAC3C,8CAA8C;IAC9C,MAAM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,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B;CAKJ;AAED,qBAAa,uBAAwB,SAAQ,WAAW;IACtD,gBAAyB,QAAQ,WAAW;gBAE1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B;CAKJ;AAED,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,gBAAyB,QAAQ,WAAW;gBAE1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B;CAKJ;AAuBD,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CA2B5D"}
@@ -0,0 +1,5 @@
1
+ export { AuthMethod } from "./auth.js";
2
+ export type { PGWireConfig } from "./config.js";
3
+ export { createConfig } from "./config.js";
4
+ export { PGWireServer } from "./server.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/index.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,65 @@
1
+ import type { ColumnDescription, FrontendMessage, SASLInitialResponse, SASLResponse, StartupPhaseMessage } from "./messages.js";
2
+ export declare class MessageCodec {
3
+ /**
4
+ * Decode an un-typed startup-phase message.
5
+ *
6
+ * The caller has already read the 4-byte length and the full
7
+ * payload; data is the payload after the length field.
8
+ */
9
+ static decodeStartup(data: Buffer): StartupPhaseMessage;
10
+ /** Decode a typed frontend message. */
11
+ static decodeFrontend(msgType: number, payload: Buffer): FrontendMessage;
12
+ /** Re-parse a 'p' message payload as SASLInitialResponse. */
13
+ static decodeSASLInitialResponse(payload: Buffer): SASLInitialResponse;
14
+ /** Re-parse a 'p' message payload as SASLResponse. */
15
+ static decodeSASLResponse(payload: Buffer): SASLResponse;
16
+ /** AuthenticationOk (R, type=0). */
17
+ static encodeAuthOk(): Buffer;
18
+ /** AuthenticationCleartextPassword (R, type=3). */
19
+ static encodeAuthCleartext(): Buffer;
20
+ /** AuthenticationMD5Password (R, type=5) with 4-byte salt. */
21
+ static encodeAuthMD5(salt: Buffer): Buffer;
22
+ /** AuthenticationSASL (R, type=10) listing mechanisms. */
23
+ static encodeAuthSASL(mechanisms: string[]): Buffer;
24
+ /** AuthenticationSASLContinue (R, type=11). */
25
+ static encodeAuthSASLContinue(data: Buffer): Buffer;
26
+ /** AuthenticationSASLFinal (R, type=12). */
27
+ static encodeAuthSASLFinal(data: Buffer): Buffer;
28
+ /** ParameterStatus (S). */
29
+ static encodeParameterStatus(name: string, value: string): Buffer;
30
+ /** BackendKeyData (K). */
31
+ static encodeBackendKeyData(pid: number, secret: number): Buffer;
32
+ /** ReadyForQuery (Z) with transaction status byte. */
33
+ static encodeReadyForQuery(txStatus: number): Buffer;
34
+ /** RowDescription (T) with full column metadata. */
35
+ static encodeRowDescription(columns: ColumnDescription[]): Buffer;
36
+ /** DataRow (D) with column values. */
37
+ static encodeDataRow(values: (Buffer | null)[]): Buffer;
38
+ /** CommandComplete (C) with command tag string. */
39
+ static encodeCommandComplete(tag: string): Buffer;
40
+ /** EmptyQueryResponse (I). */
41
+ static encodeEmptyQueryResponse(): Buffer;
42
+ /** ErrorResponse (E) with typed fields. */
43
+ static encodeErrorResponse(fields: Map<number, string>): Buffer;
44
+ /** NoticeResponse (N) with typed fields. */
45
+ static encodeNoticeResponse(fields: Map<number, string>): Buffer;
46
+ /** ParseComplete (1). */
47
+ static encodeParseComplete(): Buffer;
48
+ /** BindComplete (2). */
49
+ static encodeBindComplete(): Buffer;
50
+ /** CloseComplete (3). */
51
+ static encodeCloseComplete(): Buffer;
52
+ /** NoData (n). */
53
+ static encodeNoData(): Buffer;
54
+ /** ParameterDescription (t). */
55
+ static encodeParameterDescription(oids: readonly number[]): Buffer;
56
+ /** PortalSuspended (s). */
57
+ static encodePortalSuspended(): Buffer;
58
+ /** CopyInResponse (G). */
59
+ static encodeCopyInResponse(overallFormat: number, columnFormats: number[]): Buffer;
60
+ /** CopyOutResponse (H). */
61
+ static encodeCopyOutResponse(overallFormat: number, columnFormats: number[]): Buffer;
62
+ /** NotificationResponse (A). */
63
+ static encodeNotification(pid: number, channel: string, payload: string): Buffer;
64
+ }
65
+ //# sourceMappingURL=message-codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-codec.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/message-codec.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAIV,iBAAiB,EAOjB,eAAe,EAMf,mBAAmB,EACnB,YAAY,EAGZ,mBAAmB,EAGpB,MAAM,eAAe,CAAC;AAGvB,qBAAa,YAAY;IAKvB;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB;IAiCvD,uCAAuC;IACvC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IAwJxE,6DAA6D;IAC7D,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB;IAQtE,sD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5C,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAUhE,yBAAyB;IACzB,MAAM,CAAC,mBAAmB,IAAI,MAAM;IAOpC,wBAAwB;IACxB,MAAM,CAAC,kBAAkB,IAAI,MAAM;IAOnC,yBAAyB;IACzB,MAAM,CAAC,mBAAmB,IAAI,MAAM;IAOpC,kBAAkB;IAClB,MAAM,CAAC,YAAY,IAAI,MAAM;IAO7B,gCAAgC;IAChC,MAAM,CAAC,0BAA0B,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM;IASlE,2BAA2B;IAC3B,MAAM,CAAC,qBAAqB,IAAI,MAAM;IAOtC,0BAA0B;IAC1B,MAAM,CAAC,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM;IAUnF,2BAA2B;IAC3B,MAAM,CAAC,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM;IAUpF,gCAAgC;IAChC,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAOjF"}
@@ -0,0 +1,126 @@
1
+ /** Metadata for a single column in a RowDescription message. */
2
+ export interface ColumnDescription {
3
+ readonly name: string;
4
+ readonly tableOid: number;
5
+ readonly columnNumber: number;
6
+ readonly typeOid: number;
7
+ readonly typeSize: number;
8
+ readonly typeModifier: number;
9
+ readonly formatCode: number;
10
+ }
11
+ /** Create a ColumnDescription with a replaced formatCode. */
12
+ export declare function columnDescriptionWithFormatCode(col: ColumnDescription, formatCode: number): ColumnDescription;
13
+ /** Initial connection handshake with protocol version and parameters. */
14
+ export interface StartupMessage {
15
+ readonly kind: "StartupMessage";
16
+ readonly protocolVersion: number;
17
+ readonly parameters: Readonly<Record<string, string>>;
18
+ }
19
+ /** Client requests SSL/TLS upgrade. */
20
+ export interface SSLRequest {
21
+ readonly kind: "SSLRequest";
22
+ }
23
+ /** Client requests GSSAPI encryption. */
24
+ export interface GSSENCRequest {
25
+ readonly kind: "GSSENCRequest";
26
+ }
27
+ /** Client requests cancellation of a running query. */
28
+ export interface CancelRequest {
29
+ readonly kind: "CancelRequest";
30
+ readonly processId: number;
31
+ readonly secretKey: number;
32
+ }
33
+ /** Cleartext or MD5-hashed password from client. */
34
+ export interface PasswordMessage {
35
+ readonly kind: "PasswordMessage";
36
+ readonly password: string;
37
+ }
38
+ /** First SASL message from client (mechanism selection + data). */
39
+ export interface SASLInitialResponse {
40
+ readonly kind: "SASLInitialResponse";
41
+ readonly mechanism: string;
42
+ readonly data: Buffer;
43
+ }
44
+ /** Subsequent SASL message from client. */
45
+ export interface SASLResponse {
46
+ readonly kind: "SASLResponse";
47
+ readonly data: Buffer;
48
+ }
49
+ /** Simple query containing one or more SQL statements. */
50
+ export interface Query {
51
+ readonly kind: "Query";
52
+ readonly sql: string;
53
+ }
54
+ /** Create a prepared statement. */
55
+ export interface Parse {
56
+ readonly kind: "Parse";
57
+ readonly statementName: string;
58
+ readonly query: string;
59
+ readonly paramTypeOids: readonly number[];
60
+ }
61
+ /** Bind parameters to a prepared statement, creating a portal. */
62
+ export interface Bind {
63
+ readonly kind: "Bind";
64
+ readonly portalName: string;
65
+ readonly statementName: string;
66
+ readonly paramFormatCodes: readonly number[];
67
+ readonly paramValues: readonly (Buffer | null)[];
68
+ readonly resultFormatCodes: readonly number[];
69
+ }
70
+ /** Request description of a statement ('S') or portal ('P'). */
71
+ export interface Describe {
72
+ readonly kind: "Describe";
73
+ readonly target: string;
74
+ readonly name: string;
75
+ }
76
+ /** Execute a named portal. */
77
+ export interface Execute {
78
+ readonly kind: "Execute";
79
+ readonly portalName: string;
80
+ readonly maxRows: number;
81
+ }
82
+ /** Close a prepared statement ('S') or portal ('P'). */
83
+ export interface Close {
84
+ readonly kind: "Close";
85
+ readonly target: string;
86
+ readonly name: string;
87
+ }
88
+ /** End of an extended-query batch -- server must send ReadyForQuery. */
89
+ export interface Sync {
90
+ readonly kind: "Sync";
91
+ }
92
+ /** Request the server to flush its output buffer. */
93
+ export interface Flush {
94
+ readonly kind: "Flush";
95
+ }
96
+ /** A chunk of COPY data from the client. */
97
+ export interface CopyData {
98
+ readonly kind: "CopyData";
99
+ readonly data: Buffer;
100
+ }
101
+ /** Client signals completion of COPY IN data. */
102
+ export interface CopyDone {
103
+ readonly kind: "CopyDone";
104
+ }
105
+ /** Client signals failure of COPY IN. */
106
+ export interface CopyFail {
107
+ readonly kind: "CopyFail";
108
+ readonly message: string;
109
+ }
110
+ /** Client requests graceful connection close. */
111
+ export interface Terminate {
112
+ readonly kind: "Terminate";
113
+ }
114
+ /** Deprecated function call protocol (PostgreSQL 7.3+). */
115
+ export interface FunctionCall {
116
+ readonly kind: "FunctionCall";
117
+ readonly functionOid: number;
118
+ readonly argFormatCodes: readonly number[];
119
+ readonly arguments: readonly (Buffer | null)[];
120
+ readonly resultFormat: number;
121
+ }
122
+ /** Union of all frontend messages (after startup). */
123
+ export type FrontendMessage = Query | Parse | Bind | Describe | Execute | Close | Sync | Flush | Terminate | CopyData | CopyDone | CopyFail | PasswordMessage | SASLInitialResponse | SASLResponse | FunctionCall;
124
+ /** Union of all startup-phase messages. */
125
+ export type StartupPhaseMessage = StartupMessage | SSLRequest | GSSENCRequest | CancelRequest;
126
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/messages.ts"],"names":[],"mappings":"AAkBA,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,C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AY,GACZ,YAAY,CAAC;AAEjB,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,UAAU,GACV,aAAa,GACb,aAAa,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { ColumnDescription } from "./messages.js";
2
+ import type { USQLEngine } from "../../core/engine.js";
3
+ export declare class QueryResult {
4
+ readonly columns: ColumnDescription[];
5
+ readonly rows: Record<string, unknown>[];
6
+ readonly commandTag: string;
7
+ readonly isSelect: boolean;
8
+ constructor(columns: ColumnDescription[], rows: Record<string, unknown>[], commandTag: string, options?: {
9
+ isSelect?: boolean;
10
+ });
11
+ }
12
+ export declare class QueryExecutor {
13
+ private readonly _engine;
14
+ private _sessionParams;
15
+ constructor(engine: USQLEngine);
16
+ get sessionParams(): Record<string, string>;
17
+ execute(query: string, params?: unknown[] | null): Promise<QueryResult>;
18
+ /**
19
+ * Split a SQL string into individual statements.
20
+ * Semicolon-aware splitter that respects string literals and
21
+ * dollar-quoted strings.
22
+ */
23
+ static splitStatements(sql: string): string[];
24
+ private _tryIntercept;
25
+ private _handleSet;
26
+ private _handleShow;
27
+ private _handleReset;
28
+ private _handleDiscard;
29
+ private _handleTransaction;
30
+ private _buildResult;
31
+ private _buildColumnDescriptions;
32
+ private _detectCommandType;
33
+ }
34
+ //# sourceMappingURL=query-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-executor.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/query-executor.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAmEvD,qBAAa,WAAW;IACtB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;gBAGzB,OAAO,EAAE,iBAAiB,EAAE,EAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;CAOnC;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,OAAO,CAAC,cAAc,CAAyB;gBAEnC,MAAM,EAAE,UAAU;IAK9B,IAAI,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE1C;IAMK,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;IAuB7E;;;;OAIG;IACH,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAoJ7C,OAAO,CAAC,aAAa;IAgDrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,YAAY;IAsDpB,OAAO,CAAC,wBAAwB;IA+DhC,OAAO,CAAC,kBAAkB;CAkB3B"}
@@ -0,0 +1,24 @@
1
+ export declare class ReadBuffer {
2
+ private _data;
3
+ private _pos;
4
+ constructor(data: Buffer);
5
+ /** Number of unread bytes. */
6
+ get remaining(): number;
7
+ /** Read a single unsigned byte. */
8
+ readByte(): number;
9
+ /** Read a signed 16-bit big-endian integer. */
10
+ readInt16(): number;
11
+ /** Read an unsigned 16-bit big-endian integer. */
12
+ readUint16(): number;
13
+ /** Read a signed 32-bit big-endian integer. */
14
+ readInt32(): number;
15
+ /** Read an unsigned 32-bit big-endian integer. */
16
+ readUint32(): number;
17
+ /** Read a null-terminated UTF-8 string. */
18
+ readString(): string;
19
+ /** Read exactly n raw bytes. */
20
+ readBytes(n: number): Buffer;
21
+ /** Read all remaining bytes. */
22
+ readRemaining(): Buffer;
23
+ }
24
+ //# sourceMappingURL=read-buffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-buffer.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/read-buffer.ts"],"names":[],"mappings":"AAQA,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;gBAET,IAAI,EAAE,MAAM;IAKxB,8BAA8B;IAC9B,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,mCAAmC;IACnC,QAAQ,IAAI,MAAM;IAMlB,+CAA+C;IAC/C,SAAS,IAAI,MAAM;IAMnB,kDAAkD;IAClD,UAAU,IAAI,MAAM;IAMpB,+CAA+C;IAC/C,SAAS,IAAI,MAAM;IAMnB,kDAAkD;IAClD,UAAU,IAAI,MAAM;IAMpB,2CAA2C;IAC3C,UAAU,IAAI,MAAM;IAOpB,gCAAgC;IAChC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAM5B,gCAAgC;IAChC,aAAa,IAAI,MAAM;CAKxB"}
@@ -0,0 +1,2 @@
1
+ export declare function main(argv?: string[]): void;
2
+ //# sourceMappingURL=server-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-cli.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/server-cli.ts"],"names":[],"mappings":"AAyKA,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAkE1C"}
@@ -0,0 +1,23 @@
1
+ import type { PGWireConfig } from "./config.js";
2
+ export declare class PGWireServer {
3
+ private readonly _config;
4
+ private _server;
5
+ private readonly _connections;
6
+ private _nextPid;
7
+ private readonly _secureContext;
8
+ constructor(config: PGWireConfig);
9
+ /** Return the actual listening port (useful when port=0). */
10
+ get port(): number;
11
+ get host(): string;
12
+ /** Start the TCP listener. */
13
+ start(): Promise<void>;
14
+ /** Gracefully shut down the server and all connections. */
15
+ stop(): Promise<void>;
16
+ /** Start the server and run until interrupted. */
17
+ serveForever(): Promise<void>;
18
+ private _handleClient;
19
+ private _allocateProcessId;
20
+ private _createEngine;
21
+ private _cancelQuery;
22
+ }
23
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/server.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgC;IAC7D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;gBAE9C,MAAM,EAAE,YAAY;IAehC,6DAA6D;IAC7D,IAAI,IAAI,IAAI,MAAM,CAQjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAMD,8BAA8B;IACxB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB5B,2DAA2D;IACrD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB3B,kDAAkD;IAC5C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBnC,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,YAAY;CAMrB"}
@@ -0,0 +1,9 @@
1
+ export declare class TypeCodec {
2
+ static encodeText(value: unknown, _typeOid?: number): Buffer | null;
3
+ static encodeBinary(value: unknown, typeOid?: number): Buffer | null;
4
+ static decodeText(data: Buffer, typeOid: number): unknown;
5
+ static decodeBinary(data: Buffer, typeOid: number): unknown;
6
+ static inferTypeOid(value: unknown): number;
7
+ static typeSize(typeOid: number): number;
8
+ }
9
+ //# sourceMappingURL=type-codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-codec.d.ts","sourceRoot":"","sources":["../../../../src/net/pgwire/type-codec.ts"],"names":[],"mappings":"AAqBA,qBAAa,SAAS;IAKpB,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM,GAAG,IAAI;IAsDtE,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,MAAU,GAAG,MAAM,GAAG,IAAI;IAiEvE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IA+CzD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAsE3D,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IA+B3C,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAGzC"}