@m2k-5f/pgtx 2.7.2 → 2.8.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 (46) hide show
  1. package/README.md +65 -37
  2. package/dist/batch.d.ts +4 -1
  3. package/dist/batch.d.ts.map +1 -1
  4. package/dist/batch.js +14 -7
  5. package/dist/clauses/fragment.clause.js +1 -1
  6. package/dist/connection.d.ts +17 -16
  7. package/dist/connection.d.ts.map +1 -1
  8. package/dist/connection.js +231 -175
  9. package/dist/error.d.ts +6 -1
  10. package/dist/error.d.ts.map +1 -1
  11. package/dist/error.js +26 -7
  12. package/dist/pool.d.ts +1 -1
  13. package/dist/pool.d.ts.map +1 -1
  14. package/dist/pool.js +5 -3
  15. package/dist/protocol/connection-request-writer.d.ts +107 -11
  16. package/dist/protocol/connection-request-writer.d.ts.map +1 -1
  17. package/dist/protocol/connection-request-writer.js +442 -48
  18. package/dist/protocol/connection-response-reader.d.ts +75 -30
  19. package/dist/protocol/connection-response-reader.d.ts.map +1 -1
  20. package/dist/protocol/connection-response-reader.js +285 -289
  21. package/dist/protocol/constants.d.ts +37 -30
  22. package/dist/protocol/constants.d.ts.map +1 -1
  23. package/dist/protocol/constants.js +43 -37
  24. package/dist/protocol/socket-authorization.d.ts.map +1 -1
  25. package/dist/protocol/socket-authorization.js +3 -3
  26. package/dist/protocol/socket-connector.d.ts +4 -4
  27. package/dist/protocol/socket-connector.d.ts.map +1 -1
  28. package/dist/protocol/socket-connector.js +2 -2
  29. package/dist/protocol/types.d.ts +14 -0
  30. package/dist/protocol/types.d.ts.map +1 -0
  31. package/dist/protocol/types.js +264 -0
  32. package/dist/query.d.ts +34 -24
  33. package/dist/query.d.ts.map +1 -1
  34. package/dist/query.js +45 -30
  35. package/dist/queue.d.ts +1 -0
  36. package/dist/queue.d.ts.map +1 -1
  37. package/dist/queue.js +1 -0
  38. package/dist/types.d.ts +3 -1
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/utils/template-compiler.d.ts +5 -2
  41. package/dist/utils/template-compiler.d.ts.map +1 -1
  42. package/dist/utils/template-compiler.js +4 -1
  43. package/dist/utils.d.ts +8 -0
  44. package/dist/utils.d.ts.map +1 -0
  45. package/dist/utils.js +73 -0
  46. package/package.json +2 -2
@@ -1,35 +1,36 @@
1
1
  import { ValueOF } from "../types";
2
2
  export declare const RequestTypes: {
3
- readonly SimpleQuery: "Q";
4
- readonly Parse: "P";
5
- readonly Bind: "B";
6
- readonly Execute: "E";
7
- readonly Sync: "S";
8
- readonly Password: "p";
9
- readonly Describe: "D";
10
- readonly Close: "C";
3
+ readonly SimpleQuery: 81;
4
+ readonly Parse: 80;
5
+ readonly Bind: 66;
6
+ readonly Execute: 69;
7
+ readonly Sync: 83;
8
+ readonly Password: 112;
9
+ readonly Describe: 68;
10
+ readonly Close: 67;
11
11
  };
12
12
  export type RequestType = ValueOF<typeof RequestTypes>;
13
13
  export declare const ResponseTypes: {
14
- readonly RowDescription: "T";
15
- readonly DataRow: "D";
16
- readonly ComandComplete: "C";
17
- readonly ReadyForQuery: "Z";
18
- readonly ErrorResponse: "E";
19
- readonly NoticeResponse: "N";
20
- readonly Authentication: "R";
21
- readonly BackendKeyData: "K";
22
- readonly ParamaterStatus: "S";
23
- readonly ParseComplete: "1";
24
- readonly BindComplete: "2";
25
- readonly CloseComplete: "3";
26
- readonly ParameterDescription: "t";
27
- readonly NoData: "n";
28
- readonly Notice: "N";
29
- readonly NotificationResponse: "A";
30
- readonly SSLOk: "S";
31
- readonly SSLDenied: "N";
14
+ readonly RowDescription: 84;
15
+ readonly DataRow: 68;
16
+ readonly ComandComplete: 67;
17
+ readonly ReadyForQuery: 90;
18
+ readonly ErrorResponse: 69;
19
+ readonly NoticeResponse: 78;
20
+ readonly Authentication: 82;
21
+ readonly BackendKeyData: 75;
22
+ readonly ParamaterStatus: 83;
23
+ readonly ParseComplete: 49;
24
+ readonly BindComplete: 50;
25
+ readonly CloseComplete: 51;
26
+ readonly ParameterDescription: 116;
27
+ readonly NoData: 110;
28
+ readonly Notice: 78;
29
+ readonly NotificationResponse: 65;
30
+ readonly SSLOk: 83;
31
+ readonly SSLDenied: 78;
32
32
  };
33
+ export type ResponseType = ValueOF<typeof ResponseTypes>;
33
34
  export declare const DataTypeOids: {
34
35
  readonly Bool: 16;
35
36
  readonly Bytea: 17;
@@ -78,7 +79,7 @@ export declare const DataTypeOids: {
78
79
  readonly NumericArray: 1231;
79
80
  };
80
81
  export type DataTypeOid = typeof DataTypeOids[keyof typeof DataTypeOids];
81
- export type ResponseType = ValueOF<typeof ResponseTypes>;
82
+ export declare const INT4Length = 4;
82
83
  export declare const AuthenticationCodes: {
83
84
  readonly Ok: 0;
84
85
  readonly CleartextPassword: 3;
@@ -89,9 +90,15 @@ export declare const AuthenticationCodes: {
89
90
  };
90
91
  export type AuthenticationCode = ValueOF<typeof AuthenticationCodes>;
91
92
  export declare const TransactionStatuses: {
92
- readonly Idle: "I";
93
- readonly InTransactionBlock: "T";
94
- readonly FailedTransactionBlock: "E";
93
+ readonly Idle: 73;
94
+ readonly InTransactionBlock: 84;
95
+ readonly FailedTransactionBlock: 69;
95
96
  };
96
97
  export type TransactionStatus = ValueOF<typeof TransactionStatuses>;
98
+ export declare const DescribeType: {
99
+ readonly Statement: "S";
100
+ readonly Portal: "P";
101
+ };
102
+ export type DescribeType = ValueOF<typeof DescribeType>;
103
+ export declare const EMPTY_ARRAY: never[];
97
104
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/protocol/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,YAAY,CAAC,CAAA;AAGtD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;CAmBhB,CAAA;AA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,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAGnE,eAAO,MAAM,YAAY;;;CAGf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,YAAY,CAAC,CAAA;AAEvD,eAAO,MAAM,WAAW,EAAwB,KAAK,EAAE,CAAA"}
@@ -1,44 +1,44 @@
1
1
  export const RequestTypes = {
2
- SimpleQuery: "Q",
3
- Parse: "P",
4
- Bind: "B",
5
- Execute: "E",
6
- Sync: "S",
7
- Password: "p",
8
- Describe: 'D',
9
- Close: "C"
2
+ SimpleQuery: 81, // "Q"
3
+ Parse: 80, // "P"
4
+ Bind: 66, // "B"
5
+ Execute: 69, // "E"
6
+ Sync: 83, // "S"
7
+ Password: 112, // "p"
8
+ Describe: 68, // "D"
9
+ Close: 67 // "C"
10
10
  };
11
11
  export const ResponseTypes = {
12
- RowDescription: "T",
13
- DataRow: "D",
14
- ComandComplete: "C",
15
- ReadyForQuery: "Z",
16
- ErrorResponse: "E",
17
- NoticeResponse: "N",
18
- Authentication: "R",
19
- BackendKeyData: "K",
20
- ParamaterStatus: "S",
21
- ParseComplete: "1",
22
- BindComplete: "2",
23
- CloseComplete: "3",
24
- ParameterDescription: "t",
25
- NoData: "n",
26
- Notice: "N",
27
- NotificationResponse: "A",
28
- SSLOk: "S",
29
- SSLDenied: "N"
12
+ RowDescription: 84, // "T"
13
+ DataRow: 68, // "D"
14
+ ComandComplete: 67, // "C"
15
+ ReadyForQuery: 90, // "Z"
16
+ ErrorResponse: 69, // "E"
17
+ NoticeResponse: 78, // "N"
18
+ Authentication: 82, // "R"
19
+ BackendKeyData: 75, // "K"
20
+ ParamaterStatus: 83, // "S"
21
+ ParseComplete: 49, // "1"
22
+ BindComplete: 50, // "2"
23
+ CloseComplete: 51, // "3"
24
+ ParameterDescription: 116, // "t"
25
+ NoData: 110, // "n"
26
+ Notice: 78, // "N"
27
+ NotificationResponse: 65, // "A"
28
+ SSLOk: 83, // "S"
29
+ SSLDenied: 78 // "N"
30
30
  };
31
31
  export const DataTypeOids = {
32
- Bool: 16,
32
+ Bool: 16, // parameter
33
33
  Bytea: 17,
34
- Char: 18,
34
+ Char: 18, // parameter
35
35
  Name: 19,
36
- Text: 25,
37
- Varchar: 1043,
38
- Bpchar: 1042,
39
- Int2: 21,
40
- Int4: 23,
41
- Int8: 20,
36
+ Text: 25, // parameter
37
+ Varchar: 1043, // parameter
38
+ Bpchar: 1042, // parameter
39
+ Int2: 21, // parameter
40
+ Int4: 23, // parameter
41
+ Int8: 20, // parameter
42
42
  Float4: 700,
43
43
  Float8: 701,
44
44
  Numeric: 1700,
@@ -75,6 +75,7 @@ export const DataTypeOids = {
75
75
  UuidArray: 2951,
76
76
  NumericArray: 1231
77
77
  };
78
+ export const INT4Length = 4;
78
79
  export const AuthenticationCodes = {
79
80
  Ok: 0,
80
81
  CleartextPassword: 3,
@@ -84,7 +85,12 @@ export const AuthenticationCodes = {
84
85
  SASLFinal: 12,
85
86
  };
86
87
  export const TransactionStatuses = {
87
- Idle: "I",
88
- InTransactionBlock: "T",
89
- FailedTransactionBlock: "E",
88
+ Idle: 73, // "I"
89
+ InTransactionBlock: 84, // "T"
90
+ FailedTransactionBlock: 69, // "E"
90
91
  };
92
+ export const DescribeType = {
93
+ Statement: "S",
94
+ Portal: "P",
95
+ };
96
+ export const EMPTY_ARRAY = Object.freeze([]);
@@ -1 +1 @@
1
- {"version":3,"file":"socket-authorization.d.ts","sourceRoot":"","sources":["../../src/protocol/socket-authorization.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4J,aAAa,EAAE,MAAM,UAAU,CAAA;AAClM,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAoB,MAAM,EAAE,MAAM,UAAU,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAI3C,eAAO,MAAM,YAAY,GAAI,QAAQ,gBAAgB,kCASpD,CAAA;AAGD,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,QAAQ,gBAAgB,kCA+ErE,CAAA;AAGD,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,QAAQ,gBAAgB,kCAyHvE,CAAA"}
1
+ {"version":3,"file":"socket-authorization.d.ts","sourceRoot":"","sources":["../../src/protocol/socket-authorization.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4J,aAAa,EAAE,MAAM,UAAU,CAAA;AAClM,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAoB,MAAM,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAM3C,eAAO,MAAM,YAAY,GAAI,QAAQ,gBAAgB,kCASpD,CAAA;AAGD,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,QAAQ,gBAAgB,kCA+ErE,CAAA;AAGD,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,EAAE,QAAQ,gBAAgB,kCAyHvE,CAAA"}
@@ -1,4 +1,3 @@
1
- import { ConnectionRequestWriter } from "./connection-request-writer";
2
1
  import { calculateScramAuth, generateNonce } from "../security/sasl";
3
2
  import { SocketConnector } from "./socket-connector";
4
3
  import { AuthenticationCodes, ResponseTypes } from "./constants";
@@ -8,6 +7,7 @@ import { Future } from "fluent-future";
8
7
  import { connect } from "node:tls";
9
8
  import { createConnection } from "node:net";
10
9
  import { readFileSync } from "node:fs";
10
+ import { ConnectionRequestBuffer } from "./connection-request-writer";
11
11
  export const createSocket = (config) => {
12
12
  const { future, resolve, reject } = Future.withResolvers();
13
13
  const socket = createConnection({ host: config.host, port: config.port });
@@ -19,7 +19,7 @@ export const upgradeSocket = (socket, config) => {
19
19
  if (config.ssl === 'disable')
20
20
  return Future.resolve(socket);
21
21
  const { future, reject, resolve } = Future.withResolvers();
22
- const writer = ConnectionRequestWriter.new();
22
+ const writer = ConnectionRequestBuffer.new(2048);
23
23
  const onError = () => {
24
24
  cleanup();
25
25
  reject(ErrSocketFailedDuringAuth);
@@ -84,7 +84,7 @@ export const upgradeSocket = (socket, config) => {
84
84
  };
85
85
  export const authorizeSocket = (socket, config) => {
86
86
  const { future, reject, resolve } = Future.withResolvers();
87
- const writer = ConnectionRequestWriter.new();
87
+ const writer = ConnectionRequestBuffer.new(2048);
88
88
  const nonce = generateNonce();
89
89
  let clientMessage = '';
90
90
  let serverMessage = '';
@@ -1,7 +1,7 @@
1
1
  import { Socket } from 'net';
2
2
  import { ResponseType } from './constants';
3
- import { ConnectionResponseReader } from '../protocol/connection-response-reader';
4
- import { ConnectionRequestWriter } from '../protocol/connection-request-writer';
3
+ import { ConnectionResponseBuffer } from './connection-response-reader';
4
+ import { ConnectionRequestBuffer } from './connection-request-writer';
5
5
  export declare class SocketConnector {
6
6
  private _socket;
7
7
  private residualBuffer;
@@ -9,8 +9,8 @@ export declare class SocketConnector {
9
9
  private _onClose;
10
10
  private _onData;
11
11
  private _destroyed;
12
- constructor(_socket: Socket, onData: (type: ResponseType, length: number, reader: ConnectionResponseReader) => void, onError: (error: unknown) => void);
13
- write(writer: ConnectionRequestWriter): void;
12
+ constructor(_socket: Socket, onData: (type: ResponseType, length: number, reader: ConnectionResponseBuffer) => void, onError: (error: unknown) => void);
13
+ write(writer: ConnectionRequestBuffer): void;
14
14
  unwrapSocket(): Socket;
15
15
  destroy(): void;
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"socket-connector.d.ts","sourceRoot":"","sources":["../../src/protocol/socket-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAE/E,qBAAa,eAAe;IAQpB,OAAO,CAAC,OAAO;IAPnB,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,UAAU,CAAQ;gBAGd,OAAO,EAAE,MAAM,EACvB,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,KAAK,IAAI,EACtF,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IA4CrC,KAAK,CAAC,MAAM,EAAE,uBAAuB;IAKrC,YAAY;IASZ,OAAO;CAGV"}
1
+ {"version":3,"file":"socket-connector.d.ts","sourceRoot":"","sources":["../../src/protocol/socket-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAErE,qBAAa,eAAe;IAQpB,OAAO,CAAC,OAAO;IAPnB,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,UAAU,CAAQ;gBAGd,OAAO,EAAE,MAAM,EACvB,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,KAAK,IAAI,EACtF,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IA4CrC,KAAK,CAAC,MAAM,EAAE,uBAAuB;IAKrC,YAAY;IASZ,OAAO;CAGV"}
@@ -1,4 +1,4 @@
1
- import { ConnectionResponseReader } from '../protocol/connection-response-reader';
1
+ import { ConnectionResponseBuffer } from './connection-response-reader';
2
2
  export class SocketConnector {
3
3
  constructor(_socket, onData, onError) {
4
4
  this._socket = _socket;
@@ -23,7 +23,7 @@ export class SocketConnector {
23
23
  ? Buffer.concat([this.residualBuffer, buffer])
24
24
  : buffer;
25
25
  this.residualBuffer = null;
26
- const reader = ConnectionResponseReader.from(currentBuffer);
26
+ const reader = ConnectionResponseBuffer.from(currentBuffer);
27
27
  while (reader.hasMore()) {
28
28
  if (!reader.hasFullPacket()) {
29
29
  this.residualBuffer = reader.getResidualBuffer();
@@ -0,0 +1,14 @@
1
+ import { ConnectionRequestBuffer } from "./connection-request-writer";
2
+ import { ConnectionResponseBuffer } from "./connection-response-reader";
3
+ import { DataTypeOid } from "./constants";
4
+ type BindValidator = (value: unknown) => boolean;
5
+ type BindWriter = (request: ConnectionRequestBuffer, value: any) => void;
6
+ type FieldReader = (response: ConnectionResponseBuffer, fieldLength: number, int8toBigint: boolean) => unknown;
7
+ interface BindHandler {
8
+ validate: BindValidator;
9
+ write: BindWriter;
10
+ read: FieldReader;
11
+ }
12
+ export declare const handlers: Partial<Record<DataTypeOid, BindHandler>>;
13
+ export {};
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/protocol/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAA;AAEvD,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;AAChD,KAAK,UAAU,GAAG,CAAC,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;AACxE,KAAK,WAAW,GAAG,CACf,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,KACpB,OAAO,CAAA;AAEZ,UAAU,WAAW;IACjB,QAAQ,EAAE,aAAa,CAAA;IACvB,KAAK,EAAE,UAAU,CAAA;IACjB,IAAI,EAAE,WAAW,CAAA;CACpB;AASD,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAsY9D,CAAA"}
@@ -0,0 +1,264 @@
1
+ import { DataTypeOids } from "./constants";
2
+ const isPoint = (value) => value !== null &&
3
+ typeof value === 'object' &&
4
+ 'x' in value && typeof value.x === 'number' &&
5
+ 'y' in value && typeof value.y === 'number';
6
+ export const handlers = {
7
+ [DataTypeOids.Bool]: {
8
+ validate: (v) => typeof v === 'boolean',
9
+ write: (req, v) => req.writeBinaryBool(v),
10
+ read: (res) => res.readBool(),
11
+ },
12
+ [DataTypeOids.Text]: {
13
+ validate: (v) => typeof v === 'string',
14
+ write: (req, v) => req.writeBinaryString(v),
15
+ read: (res, len) => res.readRawString(len),
16
+ },
17
+ [DataTypeOids.Varchar]: {
18
+ validate: (v) => typeof v === 'string',
19
+ write: (req, v) => req.writeBinaryString(v),
20
+ read: (res, len) => res.readRawString(len),
21
+ },
22
+ [DataTypeOids.Char]: {
23
+ validate: (v) => typeof v === 'string',
24
+ write: (req, v) => req.writeBinaryString(v),
25
+ read: (res, len) => res.readRawString(len),
26
+ },
27
+ [DataTypeOids.Bpchar]: {
28
+ validate: (v) => typeof v === 'string',
29
+ write: (req, v) => req.writeBinaryString(v),
30
+ read: (res, len) => res.readRawString(len),
31
+ },
32
+ [DataTypeOids.Name]: {
33
+ validate: (v) => typeof v === 'string' && Buffer.byteLength(v, 'utf-8') <= 63,
34
+ write: (req, v) => req.writeBinaryString(v),
35
+ read: (res, len) => res.readRawString(len),
36
+ },
37
+ [DataTypeOids.Int2]: {
38
+ validate: (v) => typeof v === 'number' &&
39
+ Number.isInteger(v) &&
40
+ v >= -32768 &&
41
+ v <= 32767,
42
+ write: (req, v) => req.writeBinaryInt2(v),
43
+ read: (res) => res.readInt16(),
44
+ },
45
+ [DataTypeOids.Int4]: {
46
+ validate: (v) => typeof v === 'number' &&
47
+ Number.isInteger(v) &&
48
+ v >= -2147483648 &&
49
+ v <= 2147483647,
50
+ write: (req, v) => req.writeBinaryInt4(v),
51
+ read: (res) => res.readInt32(),
52
+ },
53
+ [DataTypeOids.Int8]: {
54
+ validate: (v) => typeof v === 'bigint' ||
55
+ (typeof v === 'number' && Number.isSafeInteger(v)),
56
+ write: (req, v) => typeof v === 'bigint'
57
+ ? req.writeBinaryBigInt8(v)
58
+ : req.writeBinaryInt8(v),
59
+ read: (res, _len, int8toBigint) => int8toBigint ? res.readBigInt64() : res.readInt64(),
60
+ },
61
+ [DataTypeOids.Float4]: {
62
+ validate: (v) => typeof v === 'number' && Number.isFinite(v),
63
+ write: (req, v) => req.writeBinaryFloat4(v),
64
+ read: (res) => res.readFloat32(),
65
+ },
66
+ [DataTypeOids.Float8]: {
67
+ validate: (v) => typeof v === 'number' && Number.isFinite(v),
68
+ write: (req, v) => req.writeBinaryFloat8(v),
69
+ read: (res) => res.readFloat64(),
70
+ },
71
+ [DataTypeOids.Bytea]: {
72
+ validate: (v) => Buffer.isBuffer(v) || v instanceof Uint8Array,
73
+ write: (req, v) => req.writeBinaryBytea(v),
74
+ read: (res, len) => res.readBytes(len),
75
+ },
76
+ [DataTypeOids.Timestamp]: {
77
+ validate: (v) => v instanceof Date,
78
+ write: (req, v) => req.writeBinaryTimestamp(v),
79
+ read: (res) => res.readBinaryTimestamp(),
80
+ },
81
+ [DataTypeOids.Timestamptz]: {
82
+ validate: (v) => v instanceof Date,
83
+ write: (req, v) => req.writeBinaryTimestamp(v),
84
+ read: (res) => res.readBinaryTimestamp(),
85
+ },
86
+ [DataTypeOids.Point]: {
87
+ validate: isPoint,
88
+ write: (req, v) => req.writeBinaryPoint(v),
89
+ read: (res) => res.readBinaryPoint(),
90
+ },
91
+ [DataTypeOids.Numeric]: {
92
+ validate: (v) => (typeof v === 'string' && /^-?\d*\.?\d+$/.test(v)),
93
+ write: (req, v) => req.writeBinaryNumeric(v),
94
+ read: (res) => res.readBinaryNumeric(),
95
+ },
96
+ [DataTypeOids.Date]: {
97
+ validate: (v) => v instanceof Date,
98
+ write: (req, v) => req.writeBinaryDate(v),
99
+ read: (res) => res.readBinaryDate(),
100
+ },
101
+ [DataTypeOids.Time]: {
102
+ validate: (v) => typeof v === 'string' &&
103
+ /^(\d{2}):(\d{2}):(\d{2})\.(\d{3})$/.test(v),
104
+ write: (req, v) => req.writeBinaryTime(v),
105
+ read: (res) => res.readBinaryTime(),
106
+ },
107
+ [DataTypeOids.Timetz]: {
108
+ validate: (v) => typeof v === 'string' &&
109
+ /^(\d{2}):(\d{2}):(\d{2})\.(\d{3})([+-])(\d{2}):(\d{2})$/.test(v),
110
+ write: (req, v) => req.writeBinaryTimetz(v),
111
+ read: (res) => res.readBinaryTimetz(),
112
+ },
113
+ [DataTypeOids.Interval]: {
114
+ validate: (v) => v !== null &&
115
+ typeof v === 'object' &&
116
+ 'months' in v && typeof v.months === 'number' &&
117
+ 'days' in v && typeof v.days === 'number' &&
118
+ 'microseconds' in v &&
119
+ (typeof v.microseconds === 'number' || typeof v.microseconds === 'bigint'),
120
+ write: (req, v) => req.writeBinaryInterval(v),
121
+ read: (res) => res.readBinaryInterval(),
122
+ },
123
+ [DataTypeOids.Json]: {
124
+ validate: (_v) => true,
125
+ write: (req, v) => req.writeBinaryJson(v),
126
+ read: (res, len) => res.readBinaryJson(len),
127
+ },
128
+ [DataTypeOids.Jsonb]: {
129
+ validate: (_v) => true,
130
+ write: (req, v) => req.writeBinaryJsonb(v),
131
+ read: (res, len) => res.readBinaryJsonb(len),
132
+ },
133
+ [DataTypeOids.Uuid]: {
134
+ validate: (v) => typeof v === 'string' &&
135
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v),
136
+ write: (req, v) => req.writeBinaryUuid(v),
137
+ read: (res) => res.readBinaryUuid(),
138
+ },
139
+ [DataTypeOids.Cidr]: {
140
+ validate: (v) => typeof v === 'string',
141
+ write: (req, v) => req.writeBinaryCidr(v),
142
+ read: (res, len) => res.readBinaryInet(len),
143
+ },
144
+ [DataTypeOids.Inet]: {
145
+ validate: (v) => typeof v === 'string',
146
+ write: (req, v) => req.writeBinaryInet(v),
147
+ read: (res, len) => res.readBinaryInet(len),
148
+ },
149
+ [DataTypeOids.Macaddr]: {
150
+ validate: (v) => typeof v === 'string' &&
151
+ /^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i.test(v),
152
+ write: (req, v) => req.writeBinaryMacaddr(v),
153
+ read: (res) => res.readBinaryMacaddr(),
154
+ },
155
+ [DataTypeOids.Oid]: {
156
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0,
157
+ write: (req, v) => req.writeBinaryOid(v),
158
+ read: (res) => res.readBinaryOid(),
159
+ },
160
+ [DataTypeOids.Xid]: {
161
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0,
162
+ write: (req, v) => req.writeBinaryXid(v),
163
+ read: (res) => res.readBinaryXid(),
164
+ },
165
+ [DataTypeOids.Cid]: {
166
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0,
167
+ write: (req, v) => req.writeBinaryCid(v),
168
+ read: (res) => res.readBinaryCid(),
169
+ },
170
+ [DataTypeOids.Regproc]: {
171
+ validate: (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0,
172
+ write: (req, v) => req.writeBinaryRegproc(v),
173
+ read: (res) => res.readBinaryRegproc(),
174
+ },
175
+ [DataTypeOids.Lseg]: {
176
+ validate: (v) => v !== null && typeof v === 'object' &&
177
+ isPoint(v.a) && isPoint(v.b),
178
+ write: (req, v) => req.writeBinaryLseg(v),
179
+ read: (res) => res.readBinaryLseg(),
180
+ },
181
+ [DataTypeOids.Path]: {
182
+ validate: (v) => v !== null && typeof v === 'object' &&
183
+ typeof v.closed === 'boolean' &&
184
+ Array.isArray(v.points) &&
185
+ v.points.every(isPoint),
186
+ write: (req, v) => req.writeBinaryPath(v),
187
+ read: (res) => res.readBinaryPath(),
188
+ },
189
+ [DataTypeOids.Box]: {
190
+ validate: (v) => v !== null && typeof v === 'object' &&
191
+ isPoint(v.high) && isPoint(v.low),
192
+ write: (req, v) => req.writeBinaryBox(v),
193
+ read: (res) => res.readBinaryBox(),
194
+ },
195
+ [DataTypeOids.Polygon]: {
196
+ validate: (v) => v !== null && typeof v === 'object' &&
197
+ Array.isArray(v.points) &&
198
+ v.points.every(isPoint),
199
+ write: (req, v) => req.writeBinaryPolygon(v),
200
+ read: (res) => res.readBinaryPolygon(),
201
+ },
202
+ [DataTypeOids.Line]: {
203
+ validate: (v) => v !== null && typeof v === 'object' &&
204
+ typeof v.a === 'number' &&
205
+ typeof v.b === 'number' &&
206
+ typeof v.c === 'number',
207
+ write: (req, v) => req.writeBinaryLine(v),
208
+ read: (res) => res.readBinaryLine(),
209
+ },
210
+ [DataTypeOids.BoolArray]: {
211
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || typeof el === 'boolean'),
212
+ write: (req, v) => req.writeBinaryBoolArray(v),
213
+ read: (res, len) => res.readBinaryArray(len, () => res.readBool()),
214
+ },
215
+ [DataTypeOids.Int2Array]: {
216
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || (typeof el === 'number' && Number.isInteger(el) && el >= -32768 && el <= 32767)),
217
+ write: (req, v) => req.writeBinaryInt2Array(v),
218
+ read: (res, len) => res.readBinaryArray(len, () => res.readInt16()),
219
+ },
220
+ [DataTypeOids.Int4Array]: {
221
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || (typeof el === 'number' && Number.isInteger(el) && el >= -2147483648 && el <= 2147483647)),
222
+ write: (req, v) => req.writeBinaryInt4Array(v),
223
+ read: (res, len) => res.readBinaryArray(len, () => res.readInt32()),
224
+ },
225
+ [DataTypeOids.Int8Array]: {
226
+ validate: (v) => Array.isArray(v) && v.every(el => el == null ||
227
+ typeof el === 'bigint' ||
228
+ (typeof el === 'number' && Number.isSafeInteger(el))),
229
+ write: (req, v) => req.writeBinaryInt8Array(v),
230
+ read: (res, len, int8toBigint) => res.readBinaryArray(len, () => int8toBigint ? res.readBigInt64() : res.readInt64()),
231
+ },
232
+ [DataTypeOids.TextArray]: {
233
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || typeof el === 'string'),
234
+ write: (req, v) => req.writeBinaryTextArray(v),
235
+ read: (res, len) => res.readBinaryArray(len, (l) => res.readRawString(l)),
236
+ },
237
+ [DataTypeOids.VarcharArray]: {
238
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || typeof el === 'string'),
239
+ write: (req, v) => req.writeBinaryVarcharArray(v),
240
+ read: (res, len) => res.readBinaryArray(len, (l) => res.readRawString(l)),
241
+ },
242
+ [DataTypeOids.JsonArray]: {
243
+ validate: (v) => Array.isArray(v),
244
+ write: (req, v) => req.writeBinaryJsonArray(v),
245
+ read: (res, len) => res.readBinaryArray(len, (l) => res.readBinaryJson(l)),
246
+ },
247
+ [DataTypeOids.JsonbArray]: {
248
+ validate: (v) => Array.isArray(v),
249
+ write: (req, v) => req.writeBinaryJsonbArray(v),
250
+ read: (res, len) => res.readBinaryArray(len, (l) => res.readBinaryJsonb(l)),
251
+ },
252
+ [DataTypeOids.UuidArray]: {
253
+ validate: (v) => Array.isArray(v) && v.every(el => el == null || (typeof el === 'string' && /^[0-9a-f-]{36}$/i.test(el))),
254
+ write: (req, v) => req.writeBinaryUuidArray(v),
255
+ read: (res, len) => res.readBinaryArray(len, () => res.readBinaryUuid()),
256
+ },
257
+ [DataTypeOids.NumericArray]: {
258
+ validate: (v) => Array.isArray(v) && v.every(el => el == null ||
259
+ (typeof el === 'number' && Number.isFinite(el)) ||
260
+ (typeof el === 'string' && /^-?\d*\.?\d+$/.test(el))),
261
+ write: (req, v) => req.writeBinaryNumericArray(v),
262
+ read: (res, len) => res.readBinaryArray(len, () => res.readBinaryNumeric()),
263
+ },
264
+ };
package/dist/query.d.ts CHANGED
@@ -1,41 +1,51 @@
1
- import { Future } from "fluent-future";
2
- import { ColumnDescription, QueryText, Row, StatementName } from "./types";
1
+ import { Future, Resolvers } from "fluent-future";
2
+ import { ColumnDescription, QueryText, Row, StatementMeta } from "./types";
3
3
  import { PostgresError } from "./error";
4
4
  export declare abstract class Query {
5
- statement: StatementName;
6
- text: QueryText;
7
- args: (string | null)[];
8
5
  protected _timer?: NodeJS.Timeout;
9
- constructor(statement: StatementName, text: QueryText, args: (string | null)[], timeout: number);
10
- abstract reject(cause: PostgresError): void;
11
- abstract resolve(...args: any[]): void;
6
+ constructor(timeout: number);
7
+ abstract error(cause: PostgresError): void;
8
+ abstract complete(...args: any[]): void;
12
9
  }
13
10
  export declare class CollectQuery<T extends Row> extends Query {
11
+ meta: StatementMeta;
12
+ text: QueryText;
13
+ args: unknown[];
14
14
  columns: ColumnDescription[] | null;
15
- future: Future<T[], PostgresError>;
16
- private _resolve;
17
- private _reject;
15
+ resolvers: Resolvers<Future<T[], PostgresError>>;
18
16
  private _rows;
19
- constructor(statement: StatementName, text: QueryText, args: (string | null)[], columns: ColumnDescription[] | null, timeout: number);
17
+ constructor(meta: StatementMeta, text: QueryText, args: unknown[], columns: ColumnDescription[] | null, resolvers: Resolvers<Future<T[], PostgresError>>, timeout: number);
20
18
  push(value: T): void;
21
- reject(cause: PostgresError): void;
22
- resolve(): void;
19
+ error(cause: PostgresError): void;
20
+ complete(): void;
23
21
  }
24
22
  export declare class ExecuteQuery extends Query {
25
- future: Future<void, PostgresError>;
26
- private _resolve;
27
- private _reject;
28
- constructor(statement: StatementName, text: QueryText, args: (string | null)[], timeout: number);
29
- reject(cause: PostgresError): void;
30
- resolve(): void;
23
+ meta: StatementMeta;
24
+ text: QueryText;
25
+ args: unknown[];
26
+ resolvers: Resolvers<Future<void, PostgresError>>;
27
+ constructor(meta: StatementMeta, text: QueryText, args: unknown[], resolvers: Resolvers<Future<void, PostgresError>>, timeout: number);
28
+ error(cause: PostgresError): void;
29
+ complete(): void;
31
30
  }
32
31
  export declare class StreamQuery<T> extends Query {
32
+ meta: StatementMeta;
33
+ text: QueryText;
34
+ args: unknown[];
33
35
  controller: ReadableStreamDefaultController<T>;
34
36
  columns: ColumnDescription[] | null;
35
- constructor(statement: StatementName, text: QueryText, args: (string | null)[], controller: ReadableStreamDefaultController<T>, columns: ColumnDescription[] | null, timeout: number);
37
+ constructor(meta: StatementMeta, text: QueryText, args: unknown[], controller: ReadableStreamDefaultController<T>, columns: ColumnDescription[] | null, timeout: number);
36
38
  push(value: T): void;
37
- reject(cause: PostgresError): void;
38
- resolve(): void;
39
+ error(cause: PostgresError): void;
40
+ complete(): void;
41
+ }
42
+ export declare class ParseQuery extends Query {
43
+ meta: StatementMeta;
44
+ text: QueryText;
45
+ resolvers: Resolvers<Future<StatementMeta, PostgresError>>;
46
+ constructor(meta: StatementMeta, text: QueryText, resolvers: Resolvers<Future<StatementMeta, PostgresError>>, timeout: number);
47
+ error(cause: PostgresError): void;
48
+ complete(): void;
39
49
  }
40
- export type PostgresQuery = CollectQuery<any> | StreamQuery<any> | ExecuteQuery;
50
+ export type PostgresQuery = ParseQuery | CollectQuery<any> | StreamQuery<any> | ExecuteQuery;
41
51
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAa,SAAS,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,8BAAsB,KAAK;IAIZ,SAAS,EAAE,aAAa;IACxB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE;IALlC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,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