monetdb 1.3.3 → 1.3.4

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.
@@ -0,0 +1,45 @@
1
+ name: Linux
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-20.04
13
+ env:
14
+ DBFARM: dbfarm
15
+
16
+ strategy:
17
+ matrix:
18
+ node: ['10', '12', '14', '16', '18']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Use Node.js ${{ matrix.node-version }}
23
+ uses: actions/setup-node@v1
24
+ with:
25
+ node-version: ${{ matrix.node-version }}
26
+ - run: npm ci
27
+ - name: Install MonetDB
28
+ run: |
29
+ sudo apt-get update -qq
30
+ sudo apt-get install -y software-properties-common curl make
31
+ curl https://www.monetdb.org/downloads/MonetDB-GPG-KEY | sudo apt-key add -
32
+ sudo add-apt-repository 'deb http://dev.monetdb.org/downloads/deb/ focal monetdb'
33
+ sudo apt-get update -qq
34
+ sudo apt-get install -y monetdb5-server
35
+ - name: create database
36
+ run: |
37
+ monetdbd create ${{ env.DBFARM }}
38
+ monetdbd start ${{ env.DBFARM }}
39
+ monetdb create test
40
+ monetdb release test
41
+ monetdb start test
42
+ - name: Run Unit-Tests
43
+ run: |
44
+ npm t
45
+
@@ -0,0 +1,43 @@
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: macos
5
+
6
+ on:
7
+ push:
8
+ branches: [ master ]
9
+ pull_request:
10
+ branches: [ master ]
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: macos-10.15
16
+ env:
17
+ DBFARM: dbfarm
18
+
19
+ strategy:
20
+ matrix:
21
+ node: ['10', '12', '14', '16', '18']
22
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Use Node.js ${{ matrix.node-version }}
27
+ uses: actions/setup-node@v2
28
+ with:
29
+ node-version: ${{ matrix.node-version }}
30
+ - run: npm ci
31
+ - name: Install MonetDB
32
+ run: |
33
+ brew install monetdb
34
+ - name: create database
35
+ run: |
36
+ monetdbd create ${{ env.DBFARM }}
37
+ monetdbd start ${{ env.DBFARM }}
38
+ monetdb create test
39
+ monetdb release test
40
+ monetdb start test
41
+ - name: Run Unit-Tests
42
+ run: |
43
+ npm t
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # MonetDB NodeJS connector version 1.\*
2
2
 
3
- [![Build Status](https://travis-ci.org/MonetDB/monetdb-nodejs.svg)](https://travis-ci.org/MonetDB/monetdb-nodejs)
3
+ [![Linux](https://github.com/MonetDB/monetdb-nodejs/workflows/Linux/badge.svg)
4
+ [![macOS](https://github.com/MonetDB/monetdb-nodejs/workflows/macos/badge.svg)
5
+ [![Travis CI](https://travis-ci.org/MonetDB/monetdb-nodejs.svg)](https://travis-ci.org/MonetDB/monetdb-nodejs)
4
6
  [![Coverage Status](https://coveralls.io/repos/MonetDB/monetdb-nodejs/badge.svg?branch=master&service=github)](https://coveralls.io/github/MonetDB/monetdb-nodejs?branch=master)
5
7
  [![npm version](https://badge.fury.io/js/monetdb.svg)](https://badge.fury.io/js/monetdb)
6
- [![Dependency Status](https://david-dm.org/MonetDB/monetdb-nodejs.svg)](https://david-dm.org/MonetDB/monetdb-nodejs)
7
8
 
8
9
 
9
10
  This NodeJS module provides an easy and powerful way to use MonetDB inside your NodeJS programs.
package/dist/mapi.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { Socket } from 'node:net';
5
+ import { EventEmitter } from 'events';
6
+ import { Buffer } from 'buffer';
7
+ declare enum MAPI_STATE {
8
+ INIT = 1,
9
+ CONNECTED = 2,
10
+ READY = 3
11
+ }
12
+ declare enum MAPI_LANGUAGE {
13
+ SQL = "sql",
14
+ MAPI = "mapi",
15
+ CONTROL = "control"
16
+ }
17
+ declare class Store {
18
+ buff: Buffer;
19
+ offset: number;
20
+ segments: Segment[];
21
+ constructor(size?: number);
22
+ append(data: Buffer): number;
23
+ expand(byteCount: number): number;
24
+ drain(): string;
25
+ isFull(): boolean;
26
+ toString(): string;
27
+ }
28
+ declare class Segment {
29
+ offset: number;
30
+ bytes: number;
31
+ bytesOffset: number;
32
+ last: boolean;
33
+ constructor(bytes: number, last: boolean, offset: number, bytesOffset: number);
34
+ isFull(): boolean;
35
+ }
36
+ declare class MAPIConnection extends EventEmitter {
37
+ state: MAPI_STATE;
38
+ socket: Socket;
39
+ timeout?: number;
40
+ username?: string;
41
+ password?: string;
42
+ database?: string;
43
+ hostname?: string;
44
+ language: MAPI_LANGUAGE;
45
+ port?: number;
46
+ redirects: number;
47
+ store: Store;
48
+ constructor();
49
+ connect(database: string, username?: string, password?: string, hostname?: string, port?: number, timeout?: number, language?: MAPI_LANGUAGE): Promise<any[]>;
50
+ disconnect(): void;
51
+ private login;
52
+ private send;
53
+ private handleTimeout;
54
+ private handleSocketError;
55
+ private recv;
56
+ private handleResponse;
57
+ }
58
+ export default MAPIConnection;
package/dist/mapi.js ADDED
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_net_1 = require("node:net");
4
+ const events_1 = require("events");
5
+ const buffer_1 = require("buffer");
6
+ const node_crypto_1 = require("node:crypto");
7
+ const MAPI_BLOCK_SIZE = (1024 * 8) - 2;
8
+ const MAPI_HEADER_SIZE = 2;
9
+ const MSG_PROMPT = "";
10
+ const MSG_MORE = "\x01\x02\n";
11
+ const MSG_FILETRANS = "\x01\x03\n";
12
+ const MSG_INFO = "#";
13
+ const MSG_ERROR = "!";
14
+ const MSG_Q = "&";
15
+ const MSG_QTABLE = "&1";
16
+ const MSG_QUPDATE = "&2";
17
+ const MSG_QSCHEMA = "&3";
18
+ const MSG_QTRANS = "&4";
19
+ const MSG_QPREPARE = "&5";
20
+ const MSG_QBLOCK = "&6";
21
+ const MSG_HEADER = "%";
22
+ const MSG_TUPLE = "[";
23
+ const MSG_TUPLE_NOSLICE = "=";
24
+ const MSG_REDIRECT = "^";
25
+ const MSG_OK = "=OK";
26
+ const MAX_REDIRECTS = 10;
27
+ var MAPI_STATE;
28
+ (function (MAPI_STATE) {
29
+ MAPI_STATE[MAPI_STATE["INIT"] = 1] = "INIT";
30
+ MAPI_STATE[MAPI_STATE["CONNECTED"] = 2] = "CONNECTED";
31
+ MAPI_STATE[MAPI_STATE["READY"] = 3] = "READY";
32
+ })(MAPI_STATE || (MAPI_STATE = {}));
33
+ var MAPI_LANGUAGE;
34
+ (function (MAPI_LANGUAGE) {
35
+ MAPI_LANGUAGE["SQL"] = "sql";
36
+ MAPI_LANGUAGE["MAPI"] = "mapi";
37
+ MAPI_LANGUAGE["CONTROL"] = "control";
38
+ })(MAPI_LANGUAGE || (MAPI_LANGUAGE = {}));
39
+ // MAPI URI:
40
+ // tcp socket: mapi:monetdb://[<username>[:<password>]@]<host>[:<port>]/<database>
41
+ // unix domain socket: mapi:monetdb:///[<username>[:<password>]@]path/to/socket?database=<database>
42
+ function isMapiUri(uri) {
43
+ const regx = new RegExp('^mapi:monetdb://*', 'i');
44
+ return regx.test(uri);
45
+ }
46
+ function parseMapiUri(uri) {
47
+ // return parsed result as object
48
+ }
49
+ class Store {
50
+ constructor(size = MAPI_BLOCK_SIZE) {
51
+ this.buff = buffer_1.Buffer.allocUnsafe(size).fill(0);
52
+ this.offset = 0;
53
+ this.segments = [];
54
+ }
55
+ append(data) {
56
+ let srcStartIndx = 0;
57
+ let srcEndIndx = srcStartIndx + data.length;
58
+ let segment = this.segments.pop();
59
+ let bytesCopied = 0;
60
+ if (!this.isFull()) {
61
+ // check if out of space
62
+ if ((this.buff.length - this.offset) < data.length)
63
+ this.expand(MAPI_BLOCK_SIZE);
64
+ if (segment === undefined || segment.isFull()) {
65
+ const hdr = data.readUInt16LE(0);
66
+ const last = (hdr & 1) === 1;
67
+ const bytes = hdr >> 1;
68
+ srcStartIndx = MAPI_HEADER_SIZE;
69
+ srcEndIndx = srcStartIndx + Math.min(bytes, data.length);
70
+ bytesCopied = data.copy(this.buff, this.offset, srcStartIndx, srcEndIndx);
71
+ segment = new Segment(bytes, last, this.offset, bytesCopied);
72
+ this.segments.push(segment);
73
+ this.offset += bytesCopied;
74
+ }
75
+ else {
76
+ const byteCntToRead = segment.bytes - segment.bytesOffset;
77
+ srcEndIndx = srcStartIndx + byteCntToRead;
78
+ bytesCopied = data.copy(this.buff, this.offset, srcStartIndx, srcEndIndx);
79
+ this.offset += bytesCopied;
80
+ segment.bytesOffset += bytesCopied;
81
+ console.log(`segment is full $(segment.bytesOffset === segment.bytes)`);
82
+ this.segments.push(segment);
83
+ }
84
+ }
85
+ return bytesCopied;
86
+ }
87
+ expand(byteCount) {
88
+ const buff = buffer_1.Buffer.allocUnsafe(this.buff.length + byteCount).fill(0);
89
+ const bytesCopied = this.buff.copy(buff);
90
+ this.buff = buff;
91
+ // should be byteCount
92
+ return this.buff.length - bytesCopied;
93
+ }
94
+ drain() {
95
+ const res = this.toString();
96
+ this.segments = [];
97
+ this.offset = 0;
98
+ this.buff.fill(0);
99
+ return res;
100
+ }
101
+ isFull() {
102
+ const l = this.segments.length;
103
+ if (l > 0) {
104
+ const segment = this.segments[l - 1];
105
+ return segment.last && segment.isFull();
106
+ }
107
+ return false;
108
+ }
109
+ toString() {
110
+ return this.buff.toString();
111
+ }
112
+ }
113
+ class Segment {
114
+ constructor(bytes, last, offset, bytesOffset) {
115
+ this.bytes = bytes;
116
+ this.last = last;
117
+ this.offset = offset;
118
+ this.bytesOffset = bytesOffset;
119
+ }
120
+ isFull() {
121
+ return this.bytes === this.bytesOffset;
122
+ }
123
+ }
124
+ class MAPIConnection extends events_1.EventEmitter {
125
+ constructor() {
126
+ super();
127
+ this.state = MAPI_STATE.INIT;
128
+ this.socket = null;
129
+ this.redirects = 0;
130
+ this.store = new Store(MAPI_BLOCK_SIZE);
131
+ }
132
+ connect(database, username, password, hostname, port, timeout, language = MAPI_LANGUAGE.SQL) {
133
+ if (isMapiUri(database)) {
134
+ // parse URI
135
+ }
136
+ else {
137
+ this.username = username;
138
+ this.password = password;
139
+ this.port = port;
140
+ this.database = database;
141
+ this.language = language;
142
+ }
143
+ this.socket = (0, node_net_1.createConnection)(this.port, this.hostname, () => this.state = MAPI_STATE.CONNECTED);
144
+ this.socket.setKeepAlive(true);
145
+ this.socket.setNoDelay(true);
146
+ if (timeout)
147
+ this.socket.setTimeout(timeout);
148
+ this.socket.addListener('data', this.recv.bind(this));
149
+ this.socket.addListener('error', this.handleSocketError.bind(this));
150
+ this.socket.addListener('timeout', this.handleTimeout.bind(this));
151
+ return (0, events_1.once)(this, 'ready');
152
+ }
153
+ disconnect() {
154
+ this.send("");
155
+ this.socket.end();
156
+ this.state = MAPI_STATE.INIT;
157
+ this.socket = null;
158
+ this.redirects = 0;
159
+ }
160
+ login(resp) {
161
+ const [challenge, identity, protocol, hashes, endian, algo] = resp.split(':');
162
+ let password;
163
+ try {
164
+ password = (0, node_crypto_1.createHash)(algo).update(this.password).digest('hex');
165
+ }
166
+ catch (err) {
167
+ console.error(algo);
168
+ this.emit('error', err);
169
+ return;
170
+ }
171
+ let pwhash = null;
172
+ // try hash algorithms in the order provided by the server
173
+ for (const algo of hashes.split(',')) {
174
+ try {
175
+ const hash = (0, node_crypto_1.createHash)(algo);
176
+ pwhash = `{${algo}}` + hash.update(password + challenge).digest('hex');
177
+ break;
178
+ }
179
+ catch (_a) { }
180
+ }
181
+ if (pwhash) {
182
+ const counterResponse = `${endian}:${this.username}:${pwhash}:${this.language}:${this.database}:`;
183
+ this.send(counterResponse);
184
+ }
185
+ else {
186
+ this.emit('error', 'Unsupported hash algorithm');
187
+ }
188
+ }
189
+ send(msg) {
190
+ console.log(`Sending ${msg}`);
191
+ let buff = buffer_1.Buffer.from(msg);
192
+ let last = 0;
193
+ let offset = 0;
194
+ while (last === 0) {
195
+ const bs = Math.min((buff.length - offset) + MAPI_HEADER_SIZE, MAPI_BLOCK_SIZE);
196
+ last = (bs < MAPI_BLOCK_SIZE) ? 1 : 0;
197
+ const bytesOut = bs - MAPI_HEADER_SIZE;
198
+ const outBuff = buffer_1.Buffer.allocUnsafe(bs).fill(0);
199
+ let pos = 0;
200
+ pos += outBuff.writeUint16LE((bytesOut << 1) | last, 0);
201
+ const start = offset;
202
+ const end = offset + bytesOut;
203
+ offset += buff.copy(outBuff, pos, start, end);
204
+ this.socket.write(outBuff);
205
+ }
206
+ }
207
+ handleTimeout() {
208
+ this.emit('error', new Error('Timeout'));
209
+ }
210
+ handleSocketError(err) {
211
+ console.error(err);
212
+ }
213
+ recv(data) {
214
+ const bytesLeftOver = data.length - this.store.append(data);
215
+ if (this.store.isFull()) {
216
+ return this.handleResponse(this.store.drain());
217
+ }
218
+ if (bytesLeftOver) {
219
+ const msg = `some $(bytesLeftOver) bytes left over!`;
220
+ console.warn(msg);
221
+ this.recv(data.subarray(bytesLeftOver));
222
+ }
223
+ }
224
+ handleResponse(resp) {
225
+ console.log('>>', resp);
226
+ if (resp.startsWith(MSG_ERROR)) {
227
+ const err = new Error(resp.substring(1));
228
+ this.emit('error', err);
229
+ }
230
+ if (this.state != MAPI_STATE.READY) {
231
+ const isRedirect = resp.startsWith(MSG_REDIRECT);
232
+ if (isRedirect) {
233
+ this.redirects += 1;
234
+ console.log('received redirect');
235
+ if (this.redirects > MAX_REDIRECTS)
236
+ this.emit('error', `Exceeded max number of redirects $(MAX_REDIRECTS)`);
237
+ return;
238
+ }
239
+ if (resp.startsWith(MSG_OK) || resp.startsWith('\x00')) {
240
+ console.log('OK');
241
+ this.state = MAPI_STATE.READY;
242
+ this.emit('ready', this.state);
243
+ return;
244
+ }
245
+ return this.login(resp);
246
+ }
247
+ }
248
+ }
249
+ exports.default = MAPIConnection;
250
+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BAAmB,CAAC,CAAC;gBACjC,IAAI,IAAI,CAAC,SAAS,GAAG,aAAa;oBAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mDAAmD,CAAC,CAAC;gBAC3E,OAAO;aACV;YACD,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBACpD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAClB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC/B,OAAO;aACV;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC3B;IAEL,CAAC;CAGJ;AAED,kBAAe,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es6.d.ts","../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../node_modules/typescript/lib/lib.scripthost.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../src/mapi.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts"],"fileInfos":["721cec59c3fef87aaf480047d821fb758b3ec9482c4129a54631e6e25e432a31",{"version":"8730f4bf322026ff5229336391a18bcaa1f94d4f82416c8b2f3954e2ccaae2ba","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","4b421cbfb3a38a27c279dec1e9112c3d1da296f77a1a85ddadf7e7a425d45d18","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3aafcb693fe5b5c3bd277bd4c3a617b53db474fe498fc5df067c5603b1eebde7","affectsGlobalScope":true},{"version":"f3d4da15233e593eacb3965cde7960f3fddf5878528d882bcedd5cbaba0193c7","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"5f406584aef28a331c36523df688ca3650288d14f39c5d2e555c95f0d2ff8f6f","affectsGlobalScope":true},{"version":"22f230e544b35349cfb3bd9110b6ef37b41c6d6c43c3314a31bd0d9652fcec72","affectsGlobalScope":true},{"version":"7ea0b55f6b315cf9ac2ad622b0a7813315bb6e97bf4bb3fbf8f8affbca7dc695","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"eb26de841c52236d8222f87e9e6a235332e0788af8c87a71e9e210314300410a","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"5e5e095c4470c8bab227dbbc61374878ecead104c74ab9960d3adcccfee23205","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"2768ef564cfc0689a1b76106c421a2909bdff0acbe87da010785adab80efdd5c","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},{"version":"b65dfb1b5382661dfa63dd7e527baf151b260ea7378cea4607808ae409deb7bb","signature":"c716610ef30e95586d35e0f549eec9c6c6310dc1e59a7207a3057e4b4d5518b6"},"7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","dab86d9604fe40854ef3c0a6f9e8948873dc3509213418e5e457f410fd11200f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"d076fede3cb042e7b13fc29442aaa03a57806bc51e2b26a67a01fbc66a7c0c12","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","fd93cee2621ff42dabe57b7be402783fd1aa69ece755bcba1e0290547ae60513","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","223c37f62ce09a3d99e77498acdee7b2705a4ae14552fbdb4093600cd9164f3f",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","4c8525f256873c7ba3135338c647eaf0ca7115a1a2805ae2d0056629461186ce","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"4c50342e1b65d3bee2ed4ab18f84842d5724ad11083bd666d8705dc7a6079d80","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"8dbe725f8d237e70310977afcfa011629804d101ebaa0266cafda6b61ad72236"],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":true,"module":1,"noImplicitAny":false,"outDir":"./","sourceMap":true,"strict":false,"target":2},"fileIdsList":[[48,94],[51,94],[52,57,85,94],[53,64,65,72,82,93,94],[53,54,64,72,94],[55,94],[56,57,65,73,94],[57,82,90,94],[58,60,64,72,94],[59,94],[60,61,94],[64,94],[62,64,94],[64,65,66,82,93,94],[64,65,66,79,82,85,94],[94,98],[94],[60,67,72,82,93,94],[64,65,67,68,72,82,90,93,94],[67,69,82,90,93,94],[48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],[64,70,94],[71,93,94],[60,64,72,82,94],[73,94],[74,94],[51,75,94],[76,92,94,98],[77,94],[78,94],[64,79,80,94],[79,81,94,96],[52,64,82,83,84,85,94],[52,82,84,94],[82,83,94],[85,94],[86,94],[64,88,89,94],[88,89,94],[57,72,82,90,94],[91,94],[72,92,94],[52,67,78,93,94],[57,94],[82,94,95],[94,96],[94,97],[52,57,64,66,75,82,93,94,96,98],[82,94,99],[52,57,64,72,94],[52,64,72]],"referencedMap":[[48,1],[49,1],[51,2],[52,3],[53,4],[54,5],[55,6],[56,7],[57,8],[58,9],[59,10],[60,11],[61,11],[63,12],[62,13],[64,12],[65,14],[66,15],[50,16],[100,17],[67,18],[68,19],[69,20],[101,21],[70,22],[71,23],[72,24],[73,25],[74,26],[75,27],[76,28],[77,29],[78,30],[79,31],[80,31],[81,32],[82,33],[84,34],[83,35],[85,36],[86,37],[87,17],[88,38],[89,39],[90,40],[91,41],[92,42],[93,43],[94,44],[95,45],[96,46],[97,47],[98,48],[99,49],[9,17],[10,17],[14,17],[13,17],[3,17],[15,17],[16,17],[17,17],[18,17],[19,17],[20,17],[21,17],[22,17],[4,17],[5,17],[26,17],[23,17],[24,17],[25,17],[27,17],[28,17],[29,17],[6,17],[30,17],[31,17],[32,17],[33,17],[7,17],[37,17],[34,17],[35,17],[36,17],[38,17],[8,17],[39,17],[44,17],[45,17],[40,17],[41,17],[42,17],[43,17],[2,17],[1,17],[46,17],[12,17],[11,17],[47,50]],"exportedModulesMap":[[48,1],[49,1],[51,2],[52,3],[53,4],[54,5],[55,6],[56,7],[57,8],[58,9],[59,10],[60,11],[61,11],[63,12],[62,13],[64,12],[65,14],[66,15],[50,16],[100,17],[67,18],[68,19],[69,20],[101,21],[70,22],[71,23],[72,24],[73,25],[74,26],[75,27],[76,28],[77,29],[78,30],[79,31],[80,31],[81,32],[82,33],[84,34],[83,35],[85,36],[86,37],[87,17],[88,38],[89,39],[90,40],[91,41],[92,42],[93,43],[94,44],[95,45],[96,46],[97,47],[98,48],[99,49],[9,17],[10,17],[14,17],[13,17],[3,17],[15,17],[16,17],[17,17],[18,17],[19,17],[20,17],[21,17],[22,17],[4,17],[5,17],[26,17],[23,17],[24,17],[25,17],[27,17],[28,17],[29,17],[6,17],[30,17],[31,17],[32,17],[33,17],[7,17],[37,17],[34,17],[35,17],[36,17],[38,17],[8,17],[39,17],[44,17],[45,17],[40,17],[41,17],[42,17],[43,17],[2,17],[1,17],[46,17],[12,17],[11,17],[47,51]],"semanticDiagnosticsPerFile":[48,49,51,52,53,54,55,56,57,58,59,60,61,63,62,64,65,66,50,100,67,68,69,101,70,71,72,73,74,75,76,77,78,79,80,81,82,84,83,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,9,10,14,13,3,15,16,17,18,19,20,21,22,4,5,26,23,24,25,27,28,29,6,30,31,32,33,7,37,34,35,36,38,8,39,44,45,40,41,42,43,2,1,46,12,11,47]},"version":"4.9.4"}
package/foo.js ADDED
@@ -0,0 +1,16 @@
1
+ async function foo() {
2
+ const mapi = new (require('./dist/mapi.js').default)();
3
+ const [state] = await mapi.connect('test', 'monetdb', 'monetdb', 'localhost', 50000);
4
+ console.log(state);
5
+ mapi.disconnect();
6
+ }
7
+
8
+ async function bar() {
9
+ const mdb = require("./index.js");
10
+ const MDB = mdb({warnings: false, dbname: "test"});
11
+ const conn = new MDB();
12
+ await conn.connect();
13
+ conn.close();
14
+ }
15
+
16
+ foo()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monetdb",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Connect MonetDB to your NodeJS app",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,7 +35,7 @@
35
35
  "chai-as-promised": "^5.1.0",
36
36
  "coveralls": "^3.0.9",
37
37
  "istanbul": "^0.4.0",
38
- "mocha": "^6.2.2",
38
+ "mocha": "^10.2.0",
39
39
  "mocha-lcov-reporter": "^1.0.0"
40
40
  },
41
41
  "dependencies": {
@@ -101,7 +101,7 @@ module.exports = function MapiConnection(options) {
101
101
  options.debugMapiFn(options.logger, 'TX', message);
102
102
  }
103
103
 
104
- var buf = new Buffer(message, 'utf8');
104
+ var buf = new Buffer.from(message, 'utf8');
105
105
  var final = 0;
106
106
  while (final == 0) {
107
107
  var bs = Math.min(buf.length, _mapiBlockSize - 2);
@@ -113,7 +113,7 @@ module.exports = function MapiConnection(options) {
113
113
 
114
114
  _debug('Writing ' + bs + ' bytes, final=' + final);
115
115
 
116
- var hdrbuf = new Buffer(2);
116
+ var hdrbuf = new Buffer.alloc(2);
117
117
  hdrbuf.writeInt16LE((bs << 1) | final, 0);
118
118
  if(!_socket) return;
119
119
  _socket.write(Buffer.concat([hdrbuf, sendbuf]));
@@ -144,7 +144,7 @@ module.exports = function MapiConnection(options) {
144
144
  //String concat involve problems with 2 bytes characters like é ou à
145
145
  //_readStr = _readStr + data.toString('utf8', 0, read_cnt);
146
146
 
147
- var buf = new Buffer(read_cnt);
147
+ var buf = Buffer.allocUnsafe(read_cnt).fill(0);
148
148
  data.copy(buf, 0, 0, read_cnt);
149
149
  _readStr = _readStr + decoder.write(buf);
150
150
 
@@ -184,7 +184,7 @@ module.exports = function MapiConnection(options) {
184
184
 
185
185
  /* also, the buffer might contain more blocks or parts thereof */
186
186
  if (data.length > read_cnt) {
187
- var leftover = new Buffer(data.length - read_cnt);
187
+ var leftover = Buffer.allocUnsafe(data.length - read_cnt).fill(0);
188
188
  data.copy(leftover, 0, read_cnt, data.length);
189
189
  _handleData(leftover);
190
190
  }
package/test/test.js CHANGED
@@ -451,10 +451,10 @@ describe("#Time zone offset", function() {
451
451
  var baseTimestamp = "2015-10-29 11:31:35.000000";
452
452
  var MDB = getMDB();
453
453
 
454
- function setupConnection(timezoneOffset) {
454
+ function setupConnection(timezoneOffset, tbl) {
455
455
  var conn = timezoneOffset !== undefined ? new MDB({timezoneOffset: timezoneOffset}) : new MDB();
456
456
  conn.connect();
457
- conn.query("START TRANSACTION; CREATE TABLE foo (a TIMESTAMPTZ)");
457
+ conn.query(`START TRANSACTION; CREATE TABLE ${tbl} (a TIMESTAMPTZ)`);
458
458
  return conn;
459
459
  }
460
460
 
@@ -463,11 +463,11 @@ describe("#Time zone offset", function() {
463
463
  conn.destroy();
464
464
  }
465
465
 
466
- function testTimezoneOffset(timezoneOffset, timestampIn, timestampOut) {
466
+ function testTimezoneOffset(timezoneOffset, timestampIn, timestampOut, tbl="foo") {
467
467
  if(!timestampOut) timestampOut = timestampIn;
468
- var conn = setupConnection(timezoneOffset);
469
- return conn.query("INSERT INTO foo VALUES ('" + timestampIn + "')").then(function() {
470
- return conn.query("SELECT * FROM foo");
468
+ var conn = setupConnection(timezoneOffset, tbl);
469
+ return conn.query(`INSERT INTO ${tbl} VALUES ('${timestampIn}')`).then(function() {
470
+ return conn.query(`SELECT * FROM ${tbl}`);
471
471
  }).fin(function() {
472
472
  closeConnection(conn);
473
473
  }).should.eventually.have.property("data")
@@ -476,7 +476,7 @@ describe("#Time zone offset", function() {
476
476
 
477
477
  it("should be automatically set to the current time zone", function() {
478
478
  var timestampCurTz = baseTimestamp + constructCurTimezoneStr();
479
- return testTimezoneOffset(undefined, timestampCurTz);
479
+ return testTimezoneOffset(undefined, timestampCurTz, undefined);
480
480
  });
481
481
 
482
482
  it("should be customizable", function() {
@@ -487,10 +487,10 @@ describe("#Time zone offset", function() {
487
487
  var timestampPlus1030 = baseTimestamp + "+10:30";
488
488
  var timestampMinus1030 = baseTimestamp + "-10:30";
489
489
  return Q.all([
490
- testTimezoneOffset(offset2, timestampPlus2),
491
- testTimezoneOffset(-offset2, timestampMinus2),
492
- testTimezoneOffset(offset1030, timestampPlus1030),
493
- testTimezoneOffset(-offset1030, timestampMinus1030)
490
+ testTimezoneOffset(offset2, timestampPlus2, undefined, 'foo1'),
491
+ testTimezoneOffset(-offset2, timestampMinus2, undefined, 'foo2'),
492
+ testTimezoneOffset(offset1030, timestampPlus1030, undefined, 'foo3'),
493
+ testTimezoneOffset(-offset1030, timestampMinus1030, undefined, 'foo4')
494
494
  ]);
495
495
  });
496
496