node-firebird 2.8.1 → 2.10.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 (53) hide show
  1. package/README.md +268 -7
  2. package/lib/index.d.ts +17 -9
  3. package/lib/index.js +42 -3
  4. package/lib/named-params.d.ts +42 -0
  5. package/lib/named-params.js +133 -0
  6. package/lib/pool.js +1 -1
  7. package/lib/srp.d.ts +3 -3
  8. package/lib/types.d.ts +185 -25
  9. package/lib/uri.d.ts +57 -0
  10. package/lib/uri.js +193 -0
  11. package/lib/wire/connection.d.ts +92 -59
  12. package/lib/wire/connection.js +286 -55
  13. package/lib/wire/const.d.ts +9 -1
  14. package/lib/wire/const.js +21 -9
  15. package/lib/wire/database.d.ts +51 -26
  16. package/lib/wire/database.js +26 -8
  17. package/lib/wire/eventConnection.js +5 -3
  18. package/lib/wire/query-stream.d.ts +18 -0
  19. package/lib/wire/query-stream.js +73 -0
  20. package/lib/wire/serialize.d.ts +18 -2
  21. package/lib/wire/serialize.js +7 -0
  22. package/lib/wire/service.d.ts +42 -0
  23. package/lib/wire/service.js +145 -0
  24. package/lib/wire/socket.d.ts +3 -1
  25. package/lib/wire/socket.js +5 -2
  26. package/lib/wire/statement.d.ts +40 -20
  27. package/lib/wire/statement.js +26 -6
  28. package/lib/wire/transaction.d.ts +32 -18
  29. package/lib/wire/transaction.js +50 -8
  30. package/lib/wire/wire-types.d.ts +116 -0
  31. package/lib/wire/wire-types.js +10 -0
  32. package/lib/wire/xsqlvar.d.ts +18 -18
  33. package/package.json +1 -1
  34. package/src/index.ts +54 -15
  35. package/src/messages.ts +1 -1
  36. package/src/named-params.ts +145 -0
  37. package/src/pool.ts +1 -1
  38. package/src/srp.ts +6 -6
  39. package/src/types.ts +183 -25
  40. package/src/unix-crypt.ts +9 -9
  41. package/src/uri.ts +204 -0
  42. package/src/wire/connection.ts +481 -234
  43. package/src/wire/const.ts +21 -9
  44. package/src/wire/database.ts +75 -43
  45. package/src/wire/eventConnection.ts +8 -5
  46. package/src/wire/query-stream.ts +80 -0
  47. package/src/wire/serialize.ts +29 -0
  48. package/src/wire/service.ts +188 -6
  49. package/src/wire/socket.ts +17 -8
  50. package/src/wire/statement.ts +68 -31
  51. package/src/wire/transaction.ts +85 -33
  52. package/src/wire/wire-types.ts +127 -0
  53. package/src/wire/xsqlvar.ts +9 -7
@@ -2,7 +2,7 @@ import Events from 'events';
2
2
  import stream from 'stream';
3
3
  import Const from './const';
4
4
  import { BlrReader } from './serialize';
5
- import { doError } from '../callback';
5
+ import { doError, fromCallback } from '../callback';
6
6
 
7
7
  /***************************************
8
8
  *
@@ -994,7 +994,7 @@ class ServiceManager extends Events.EventEmitter {
994
994
  var buffersize = options.buffersize || 2048;
995
995
  var timeout = options.timeout || 60;
996
996
  var self = this;
997
- this.connection.svcquery([Const.isc_info_svc_line], buffersize, timeout, function (err, data) {
997
+ this.connection.svcquery([Const.isc_info_svc_line], buffersize, timeout, function (err: any, data: any) {
998
998
  if (err || !data.buffer) {
999
999
  doError(new Error(err||'Bad query return'), callback);
1000
1000
  return;
@@ -1007,7 +1007,7 @@ class ServiceManager extends Events.EventEmitter {
1007
1007
  var buffersize = options.buffersize || (8 * 1024);
1008
1008
  var timeout = options.timeout || 60;
1009
1009
  var self = this;
1010
- this.connection.svcquery([Const.isc_info_svc_to_eof], buffersize, timeout, function (err, data) {
1010
+ this.connection.svcquery([Const.isc_info_svc_to_eof], buffersize, timeout, function (err: any, data: any) {
1011
1011
  if (err || !data.buffer) {
1012
1012
  doError(new Error(err||'Bad query return'), callback);
1013
1013
  return;
@@ -1020,7 +1020,7 @@ class ServiceManager extends Events.EventEmitter {
1020
1020
  var buffersize = options.buffersize || 2048;
1021
1021
  var timeout = options.timeout || 60;
1022
1022
  var self = this;
1023
- this.connection.svcquery([Const.isc_info_svc_running], buffersize, timeout, function (err, data) {
1023
+ this.connection.svcquery([Const.isc_info_svc_running], buffersize, timeout, function (err: any, data: any) {
1024
1024
  if (err || !data.buffer) {
1025
1025
  doError(new Error(err||'Bad query return'), callback);
1026
1026
  return;
@@ -1033,7 +1033,7 @@ class ServiceManager extends Events.EventEmitter {
1033
1033
  var buffersize = options.buffersize || 2048;
1034
1034
  var timeout = options.timeout || 60;
1035
1035
  var self = this;
1036
- this.connection.svcquery([Const.isc_info_svc_get_users], buffersize, timeout, function (err, data) {
1036
+ this.connection.svcquery([Const.isc_info_svc_get_users], buffersize, timeout, function (err: any, data: any) {
1037
1037
  if (err || !data.buffer) {
1038
1038
  doError(new Error(err||'Bad query return'), callback);
1039
1039
  return;
@@ -1046,7 +1046,7 @@ class ServiceManager extends Events.EventEmitter {
1046
1046
  var buffersize = options.buffersize || 2048;
1047
1047
  var timeout = options.timeout || 60;
1048
1048
  var self = this;
1049
- this.connection.svcquery([Const.isc_info_svc_limbo_trans], buffersize, timeout, function (err, data) {
1049
+ this.connection.svcquery([Const.isc_info_svc_limbo_trans], buffersize, timeout, function (err: any, data: any) {
1050
1050
  if (err || !data.buffer) {
1051
1051
  doError(new Error(err||'Bad query return'), callback);
1052
1052
  return;
@@ -1055,6 +1055,188 @@ class ServiceManager extends Events.EventEmitter {
1055
1055
  });
1056
1056
  }
1057
1057
 
1058
+ /* Promise / async-await API — wrappers over the callback methods above. */
1059
+
1060
+ detachAsync(force?: boolean): Promise<void> {
1061
+ var self = this;
1062
+ return fromCallback(function(cb) { self.detach(cb, force); });
1063
+ }
1064
+
1065
+ backupAsync(options: any): Promise<stream.Readable> {
1066
+ var self = this;
1067
+ return fromCallback(function(cb) { self.backup(options, cb); });
1068
+ }
1069
+
1070
+ nbackupAsync(options: any): Promise<stream.Readable> {
1071
+ var self = this;
1072
+ return fromCallback(function(cb) { self.nbackup(options, cb); });
1073
+ }
1074
+
1075
+ restoreAsync(options: any): Promise<stream.Readable> {
1076
+ var self = this;
1077
+ return fromCallback(function(cb) { self.restore(options, cb); });
1078
+ }
1079
+
1080
+ nrestoreAsync(options: any): Promise<stream.Readable> {
1081
+ var self = this;
1082
+ return fromCallback(function(cb) { self.nrestore(options, cb); });
1083
+ }
1084
+
1085
+ setDialectAsync(db: string, dialect: number): Promise<any> {
1086
+ var self = this;
1087
+ return fromCallback(function(cb) { self.setDialect(db, dialect, cb); });
1088
+ }
1089
+
1090
+ setSweepintervalAsync(db: string, sweepinterval: number): Promise<any> {
1091
+ var self = this;
1092
+ return fromCallback(function(cb) { self.setSweepinterval(db, sweepinterval, cb); });
1093
+ }
1094
+
1095
+ setCachebufferAsync(db: string, nbpages: number): Promise<any> {
1096
+ var self = this;
1097
+ return fromCallback(function(cb) { self.setCachebuffer(db, nbpages, cb); });
1098
+ }
1099
+
1100
+ BringOnlineAsync(db: string): Promise<any> {
1101
+ var self = this;
1102
+ return fromCallback(function(cb) { self.BringOnline(db, cb); });
1103
+ }
1104
+
1105
+ ShutdownAsync(db: string, kind: number, delay: number, mode?: any): Promise<any> {
1106
+ var self = this;
1107
+ return fromCallback(function(cb) { self.Shutdown(db, kind, delay, mode, cb); });
1108
+ }
1109
+
1110
+ setShadowAsync(db: string, val: boolean): Promise<any> {
1111
+ var self = this;
1112
+ return fromCallback(function(cb) { self.setShadow(db, val, cb); });
1113
+ }
1114
+
1115
+ setForcewriteAsync(db: string, val: boolean): Promise<any> {
1116
+ var self = this;
1117
+ return fromCallback(function(cb) { self.setForcewrite(db, val, cb); });
1118
+ }
1119
+
1120
+ setReservespaceAsync(db: string, val: boolean): Promise<any> {
1121
+ var self = this;
1122
+ return fromCallback(function(cb) { self.setReservespace(db, val, cb); });
1123
+ }
1124
+
1125
+ setReadonlyModeAsync(db: string): Promise<any> {
1126
+ var self = this;
1127
+ return fromCallback(function(cb) { self.setReadonlyMode(db, cb); });
1128
+ }
1129
+
1130
+ setReadwriteModeAsync(db: string): Promise<any> {
1131
+ var self = this;
1132
+ return fromCallback(function(cb) { self.setReadwriteMode(db, cb); });
1133
+ }
1134
+
1135
+ validateAsync(options: any): Promise<stream.Readable> {
1136
+ var self = this;
1137
+ return fromCallback(function(cb) { self.validate(options, cb); });
1138
+ }
1139
+
1140
+ commitAsync(db: string, transactid: number): Promise<any> {
1141
+ var self = this;
1142
+ return fromCallback(function(cb) { self.commit(db, transactid, cb); });
1143
+ }
1144
+
1145
+ rollbackAsync(db: string, transactid: number): Promise<any> {
1146
+ var self = this;
1147
+ return fromCallback(function(cb) { self.rollback(db, transactid, cb); });
1148
+ }
1149
+
1150
+ recoverAsync(db: string, transactid: number): Promise<any> {
1151
+ var self = this;
1152
+ return fromCallback(function(cb) { self.recover(db, transactid, cb); });
1153
+ }
1154
+
1155
+ getStatsAsync(options: any): Promise<stream.Readable> {
1156
+ var self = this;
1157
+ return fromCallback(function(cb) { self.getStats(options, cb); });
1158
+ }
1159
+
1160
+ getLogAsync(options: any): Promise<stream.Readable> {
1161
+ var self = this;
1162
+ return fromCallback(function(cb) { self.getLog(options, cb); });
1163
+ }
1164
+
1165
+ getUsersAsync(username?: string | null): Promise<any> {
1166
+ var self = this;
1167
+ return fromCallback(function(cb) { self.getUsers(username === undefined ? null : username, cb); });
1168
+ }
1169
+
1170
+ addUserAsync(username: string, password: string, options?: any): Promise<any> {
1171
+ var self = this;
1172
+ return fromCallback(function(cb) { self.addUser(username, password, options, cb); });
1173
+ }
1174
+
1175
+ editUserAsync(username: string, options: any): Promise<any> {
1176
+ var self = this;
1177
+ return fromCallback(function(cb) { self.editUser(username, options, cb); });
1178
+ }
1179
+
1180
+ removeUserAsync(username: string, rolename?: string | null): Promise<any> {
1181
+ var self = this;
1182
+ return fromCallback(function(cb) { self.removeUser(username, rolename === undefined ? null : rolename, cb); });
1183
+ }
1184
+
1185
+ getFbserverInfosAsync(infos?: any, options?: any): Promise<any> {
1186
+ var self = this;
1187
+ return fromCallback(function(cb) { self.getFbserverInfos(infos || {}, options || {}, cb); });
1188
+ }
1189
+
1190
+ startTraceAsync(options: any): Promise<stream.Readable> {
1191
+ var self = this;
1192
+ return fromCallback(function(cb) { self.startTrace(options, cb); });
1193
+ }
1194
+
1195
+ suspendTraceAsync(options: any): Promise<stream.Readable> {
1196
+ var self = this;
1197
+ return fromCallback(function(cb) { self.suspendTrace(options, cb); });
1198
+ }
1199
+
1200
+ resumeTraceAsync(options: any): Promise<stream.Readable> {
1201
+ var self = this;
1202
+ return fromCallback(function(cb) { self.resumeTrace(options, cb); });
1203
+ }
1204
+
1205
+ stopTraceAsync(options: any): Promise<stream.Readable> {
1206
+ var self = this;
1207
+ return fromCallback(function(cb) { self.stopTrace(options, cb); });
1208
+ }
1209
+
1210
+ getTraceListAsync(options?: any): Promise<stream.Readable> {
1211
+ var self = this;
1212
+ return fromCallback(function(cb) { self.getTraceList(options || {}, cb); });
1213
+ }
1214
+
1215
+ readlineAsync(options?: any): Promise<{ result: number, line: string }> {
1216
+ var self = this;
1217
+ return fromCallback(function(cb) { self.readline(options || {}, cb); });
1218
+ }
1219
+
1220
+ readeofAsync(options?: any): Promise<{ result: number, line: string }> {
1221
+ var self = this;
1222
+ return fromCallback(function(cb) { self.readeof(options || {}, cb); });
1223
+ }
1224
+
1225
+ hasRunningActionAsync(options?: any): Promise<any> {
1226
+ var self = this;
1227
+ return fromCallback(function(cb) { self.hasRunningAction(options || {}, cb); });
1228
+ }
1229
+
1230
+ readusersAsync(options?: any): Promise<any> {
1231
+ var self = this;
1232
+ return fromCallback(function(cb) { self.readusers(options || {}, cb); });
1233
+ }
1234
+
1235
+ readlimboAsync(options?: any): Promise<any> {
1236
+ var self = this;
1237
+ return fromCallback(function(cb) { self.readlimbo(options || {}, cb); });
1238
+ }
1239
+
1058
1240
  }
1059
1241
 
1060
1242
  export = ServiceManager;
@@ -91,8 +91,15 @@ class ChaChaCipher {
91
91
  class Socket {
92
92
  static Arc4 = Arc4;
93
93
 
94
+ // The constructor returns a Proxy whose get trap falls through to the
95
+ // underlying net.Socket, so callers can use net.Socket members not
96
+ // reimplemented here. Declare the ones the driver relies on (type-only,
97
+ // nothing is emitted).
98
+ declare end: net.Socket['end'];
99
+ declare removeAllListeners: net.Socket['removeAllListeners'];
100
+
94
101
  _socket: net.Socket;
95
- compress: boolean;
102
+ compress: boolean = false;
96
103
  compressor: zlib.Deflate | null;
97
104
  compressorBuffer: Buffer[];
98
105
  decompressor: zlib.Inflate | null;
@@ -102,10 +109,12 @@ class Socket {
102
109
  encryptCipher: any;
103
110
  decryptCipher: any;
104
111
 
105
- constructor(port: number, host: string) {
112
+ constructor(port: number, host: string, enableKeepAlive = true, keepAliveInitialDelay = 60000) {
106
113
  this._socket = net.createConnection(port, host);
107
114
  this._socket.setNoDelay(true);
108
- this._socket.setKeepAlive(true, 60000); // 1 minute delay to detect dead/stale connections
115
+ // TCP keepalive probing detects dead/stale connections; the delay is
116
+ // how long the socket must be idle before the first probe.
117
+ this._socket.setKeepAlive(enableKeepAlive, keepAliveInitialDelay);
109
118
  this.compressor = null;
110
119
  this.compressorBuffer = [];
111
120
  this.decompressor = null;
@@ -137,7 +146,7 @@ class Socket {
137
146
  }
138
147
 
139
148
  if (this.compress) {
140
- this.decompressor.write(data, () => {
149
+ this.decompressor!.write(data, () => {
141
150
  mainCb(Buffer.concat(this.decompressorBuffer));
142
151
  this.decompressorBuffer = []; // Reset buffer
143
152
  });
@@ -176,7 +185,7 @@ class Socket {
176
185
  }
177
186
 
178
187
  if (this.compress) {
179
- this.compressor.write(data, () => {
188
+ this.compressor!.write(data, () => {
180
189
  var compressedData = Buffer.concat(this.compressorBuffer);
181
190
  this.compressorBuffer = []; // Reset buffer
182
191
 
@@ -236,8 +245,8 @@ class Socket {
236
245
  const stretchedKey = crypto.createHash('sha256').update(sessionKey).digest();
237
246
  const ivlen = pluginName === 'ChaCha64' ? 8 : (iv ? iv.length : 16);
238
247
 
239
- this.encryptCipher = new ChaChaCipher(stretchedKey, iv, ivlen, true);
240
- this.decryptCipher = new ChaChaCipher(stretchedKey, iv, ivlen, false);
248
+ this.encryptCipher = new ChaChaCipher(stretchedKey, iv!, ivlen, true);
249
+ this.decryptCipher = new ChaChaCipher(stretchedKey, iv!, ivlen, false);
241
250
  } else {
242
251
  throw new Error('Unsupported encryption plugin: ' + pluginName);
243
252
  }
@@ -248,7 +257,7 @@ class Socket {
248
257
  */
249
258
  get(target: any, field: string | symbol): any {
250
259
  if (field in this) {
251
- return this[field].bind(this);
260
+ return (this as any)[field].bind(this);
252
261
  }
253
262
 
254
263
  if (typeof target[field] === 'function') {
@@ -4,55 +4,79 @@
4
4
  *
5
5
  ***************************************/
6
6
 
7
- import { fromCallback } from '../callback';
7
+ import { doError, fromCallback, type Callback, type SimpleCallback } from '../callback';
8
+ import { bindNamedParams, isNamedParamsObject } from '../named-params';
9
+ import type Connection from './connection';
10
+ import type Transaction from './transaction';
11
+ import type { SQLVarBase } from './xsqlvar';
12
+ import type { QueryOptions, QueryParams } from '../types';
8
13
 
9
14
  class Statement {
10
- connection: any;
11
- query: string;
12
- type: number;
13
- output: any[];
14
- input: any[];
15
- options: any;
16
- handle: number;
17
- plan: string;
18
- [key: string]: any;
19
-
20
- constructor(connection: any) {
15
+ connection: Connection;
16
+ // populated externally from the op_allocate_statement /
17
+ // op_prepare_statement responses (see describe() in connection.ts),
18
+ // hence the definite assignment assertions
19
+ query!: string;
20
+ type!: number;
21
+ output!: SQLVarBase[];
22
+ input!: SQLVarBase[];
23
+ /** per-execute query options (asObject/asStream/timeout/...) */
24
+ options: QueryOptions & { [key: string]: any } | undefined;
25
+ handle!: number;
26
+ plan!: string;
27
+ /**
28
+ * Placeholder names in positional order when this statement was
29
+ * prepared from SQL with named placeholders (namedPlaceholders on),
30
+ * null/undefined otherwise. Set by Transaction.newStatement.
31
+ */
32
+ namedParams?: string[] | null;
33
+ /** set when an execute/fetch on this statement errored — the statement
34
+ * is dropped on release instead of going back into the cache */
35
+ _failed?: boolean;
36
+ /** rows fetched so far by the current cursor (decodeResponse) */
37
+ nbrowsfetched?: number;
38
+
39
+ constructor(connection: Connection) {
21
40
  this.connection = connection;
22
41
  }
23
42
 
24
- close(callback?: (err?: any) => void): void {
43
+ close(callback?: SimpleCallback): void {
25
44
  this.connection.closeStatement(this, callback);
26
45
  }
27
46
 
28
- drop(callback?: (err?: any) => void): void {
47
+ drop(callback?: SimpleCallback): void {
29
48
  this.connection.dropStatement(this, callback);
30
49
  }
31
50
 
32
- release(callback?: (err?: any) => void): void {
33
- var cache_query = this.connection.getCachedQuery(this.query);
34
- if (cache_query)
35
- this.connection.closeStatement(this, callback);
36
- else
37
- this.connection.dropStatement(this, callback);
51
+ release(callback?: SimpleCallback): void {
52
+ this.connection.releaseStatement(this, callback);
38
53
  }
39
54
 
40
- execute(transaction: any, params?: any, callback?: any, options?: any): void {
55
+ execute(transaction: Transaction, params?: any, callback?: any, options?: any): void {
41
56
  if (params instanceof Function) {
42
57
  options = callback;
43
58
  callback = params;
44
59
  params = undefined;
45
60
  }
46
61
 
62
+ if (this.namedParams && isNamedParamsObject(params)) {
63
+ try {
64
+ params = bindNamedParams(this.namedParams, params);
65
+ } catch (err) {
66
+ doError(err, callback);
67
+ return;
68
+ }
69
+ }
70
+
47
71
  this.options = options;
48
72
  this.connection.executeStatement(transaction, this, params, callback, options);
49
73
  }
50
74
 
51
- fetch(transaction: any, count: number | string, callback: (err: any, result?: any) => void): void {
75
+ fetch(transaction: Transaction, count: number | string, callback: Callback): void {
52
76
  this.connection.fetch(this, transaction, count, callback);
53
77
  }
54
78
 
55
- fetchScroll(transaction: any, direction: string | number, offset?: any, count?: any, callback?: any): void {
79
+ fetchScroll(transaction: Transaction, direction: string | number, offset?: any, count?: any, callback?: any): void {
56
80
  if (typeof count === 'function') {
57
81
  callback = count;
58
82
  count = undefined;
@@ -65,41 +89,54 @@ class Statement {
65
89
  this.connection.fetchScroll(this, transaction, direction, offset, count, callback);
66
90
  }
67
91
 
68
- fetchAll(transaction: any, callback: (err: any, result?: any) => void): void {
92
+ fetchAll(transaction: Transaction, callback: Callback): void {
69
93
  this.connection.fetchAll(this, transaction, callback);
70
94
  }
71
95
 
72
96
  /**
73
97
  * Execute this statement once per row via the Firebird 4 batch API
74
- * (protocol 16+). `rows` is an array of parameter arrays.
98
+ * (protocol 16+). `rows` is an array of parameter arrays — or, when the
99
+ * statement was prepared with named placeholders, of values-by-name
100
+ * objects (the two forms can be mixed).
75
101
  */
76
- executeBatch(transaction: any, rows: any[][], callback?: any, options?: any): void {
102
+ executeBatch(transaction: Transaction, rows: QueryParams[], callback?: any, options?: any): void {
103
+ var names = this.namedParams;
104
+ if (names && Array.isArray(rows)) {
105
+ try {
106
+ rows = rows.map(function(row: any) {
107
+ return isNamedParamsObject(row) ? bindNamedParams(names as string[], row) : row;
108
+ });
109
+ } catch (err) {
110
+ doError(err, callback);
111
+ return;
112
+ }
113
+ }
77
114
  this.connection.executeBatch(transaction, this, rows, callback, options);
78
115
  }
79
116
 
80
117
  /* Promise / async-await API — wrappers over the callback methods above. */
81
118
 
82
- executeAsync(transaction: any, params?: any, options?: any): Promise<any> {
119
+ executeAsync(transaction: Transaction, params?: any, options?: any): Promise<any> {
83
120
  var self = this;
84
121
  return fromCallback(function(cb) { self.execute(transaction, params, cb, options); });
85
122
  }
86
123
 
87
- executeBatchAsync(transaction: any, rows: any[][], options?: any): Promise<any> {
124
+ executeBatchAsync(transaction: Transaction, rows: QueryParams[], options?: any): Promise<any> {
88
125
  var self = this;
89
126
  return fromCallback(function(cb) { self.executeBatch(transaction, rows, cb, options); });
90
127
  }
91
128
 
92
- fetchAsync(transaction: any, count: number | string): Promise<any> {
129
+ fetchAsync(transaction: Transaction, count: number | string): Promise<any> {
93
130
  var self = this;
94
131
  return fromCallback(function(cb) { self.fetch(transaction, count, cb); });
95
132
  }
96
133
 
97
- fetchScrollAsync(transaction: any, direction: string | number, offset?: any, count?: any): Promise<any> {
134
+ fetchScrollAsync(transaction: Transaction, direction: string | number, offset?: any, count?: any): Promise<any> {
98
135
  var self = this;
99
136
  return fromCallback(function(cb) { self.fetchScroll(transaction, direction, offset, count, cb); });
100
137
  }
101
138
 
102
- fetchAllAsync(transaction: any): Promise<any> {
139
+ fetchAllAsync(transaction: Transaction): Promise<any> {
103
140
  var self = this;
104
141
  return fromCallback(function(cb) { self.fetchAll(transaction, cb); });
105
142
  }