hana-kgvector 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +449 -0
- package/dist/Stream-JW2S2DUH.js +6 -0
- package/dist/Stream-JW2S2DUH.js.map +1 -0
- package/dist/chunk-I3F3SOHM.js +726 -0
- package/dist/chunk-I3F3SOHM.js.map +1 -0
- package/dist/chunk-VUNV25KB.js +16 -0
- package/dist/chunk-VUNV25KB.js.map +1 -0
- package/dist/index.d.ts +382 -0
- package/dist/index.js +1036 -0
- package/dist/index.js.map +1 -0
- package/dist/lib-J24D2XQX.js +1256 -0
- package/dist/lib-J24D2XQX.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,1256 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_Stream
|
|
3
|
+
} from "./chunk-I3F3SOHM.js";
|
|
4
|
+
import {
|
|
5
|
+
__commonJS,
|
|
6
|
+
__require
|
|
7
|
+
} from "./chunk-VUNV25KB.js";
|
|
8
|
+
|
|
9
|
+
// node_modules/.pnpm/ms@2.0.0/node_modules/ms/index.js
|
|
10
|
+
var require_ms = __commonJS({
|
|
11
|
+
"node_modules/.pnpm/ms@2.0.0/node_modules/ms/index.js"(exports, module) {
|
|
12
|
+
"use strict";
|
|
13
|
+
var s = 1e3;
|
|
14
|
+
var m = s * 60;
|
|
15
|
+
var h = m * 60;
|
|
16
|
+
var d = h * 24;
|
|
17
|
+
var y = d * 365.25;
|
|
18
|
+
module.exports = function(val, options) {
|
|
19
|
+
options = options || {};
|
|
20
|
+
var type = typeof val;
|
|
21
|
+
if (type === "string" && val.length > 0) {
|
|
22
|
+
return parse(val);
|
|
23
|
+
} else if (type === "number" && isNaN(val) === false) {
|
|
24
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
25
|
+
}
|
|
26
|
+
throw new Error(
|
|
27
|
+
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
function parse(str) {
|
|
31
|
+
str = String(str);
|
|
32
|
+
if (str.length > 100) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
|
36
|
+
str
|
|
37
|
+
);
|
|
38
|
+
if (!match) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
var n = parseFloat(match[1]);
|
|
42
|
+
var type = (match[2] || "ms").toLowerCase();
|
|
43
|
+
switch (type) {
|
|
44
|
+
case "years":
|
|
45
|
+
case "year":
|
|
46
|
+
case "yrs":
|
|
47
|
+
case "yr":
|
|
48
|
+
case "y":
|
|
49
|
+
return n * y;
|
|
50
|
+
case "days":
|
|
51
|
+
case "day":
|
|
52
|
+
case "d":
|
|
53
|
+
return n * d;
|
|
54
|
+
case "hours":
|
|
55
|
+
case "hour":
|
|
56
|
+
case "hrs":
|
|
57
|
+
case "hr":
|
|
58
|
+
case "h":
|
|
59
|
+
return n * h;
|
|
60
|
+
case "minutes":
|
|
61
|
+
case "minute":
|
|
62
|
+
case "mins":
|
|
63
|
+
case "min":
|
|
64
|
+
case "m":
|
|
65
|
+
return n * m;
|
|
66
|
+
case "seconds":
|
|
67
|
+
case "second":
|
|
68
|
+
case "secs":
|
|
69
|
+
case "sec":
|
|
70
|
+
case "s":
|
|
71
|
+
return n * s;
|
|
72
|
+
case "milliseconds":
|
|
73
|
+
case "millisecond":
|
|
74
|
+
case "msecs":
|
|
75
|
+
case "msec":
|
|
76
|
+
case "ms":
|
|
77
|
+
return n;
|
|
78
|
+
default:
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function fmtShort(ms) {
|
|
83
|
+
if (ms >= d) {
|
|
84
|
+
return Math.round(ms / d) + "d";
|
|
85
|
+
}
|
|
86
|
+
if (ms >= h) {
|
|
87
|
+
return Math.round(ms / h) + "h";
|
|
88
|
+
}
|
|
89
|
+
if (ms >= m) {
|
|
90
|
+
return Math.round(ms / m) + "m";
|
|
91
|
+
}
|
|
92
|
+
if (ms >= s) {
|
|
93
|
+
return Math.round(ms / s) + "s";
|
|
94
|
+
}
|
|
95
|
+
return ms + "ms";
|
|
96
|
+
}
|
|
97
|
+
function fmtLong(ms) {
|
|
98
|
+
return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms";
|
|
99
|
+
}
|
|
100
|
+
function plural(ms, n, name) {
|
|
101
|
+
if (ms < n) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (ms < n * 1.5) {
|
|
105
|
+
return Math.floor(ms / n) + " " + name;
|
|
106
|
+
}
|
|
107
|
+
return Math.ceil(ms / n) + " " + name + "s";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/debug.js
|
|
113
|
+
var require_debug = __commonJS({
|
|
114
|
+
"node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/debug.js"(exports, module) {
|
|
115
|
+
"use strict";
|
|
116
|
+
exports = module.exports = createDebug.debug = createDebug["default"] = createDebug;
|
|
117
|
+
exports.coerce = coerce;
|
|
118
|
+
exports.disable = disable;
|
|
119
|
+
exports.enable = enable;
|
|
120
|
+
exports.enabled = enabled;
|
|
121
|
+
exports.humanize = require_ms();
|
|
122
|
+
exports.instances = [];
|
|
123
|
+
exports.names = [];
|
|
124
|
+
exports.skips = [];
|
|
125
|
+
exports.formatters = {};
|
|
126
|
+
function selectColor(namespace) {
|
|
127
|
+
var hash = 0, i;
|
|
128
|
+
for (i in namespace) {
|
|
129
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
130
|
+
hash |= 0;
|
|
131
|
+
}
|
|
132
|
+
return exports.colors[Math.abs(hash) % exports.colors.length];
|
|
133
|
+
}
|
|
134
|
+
function createDebug(namespace) {
|
|
135
|
+
var prevTime;
|
|
136
|
+
function debug() {
|
|
137
|
+
if (!debug.enabled) return;
|
|
138
|
+
var self = debug;
|
|
139
|
+
var curr = +/* @__PURE__ */ new Date();
|
|
140
|
+
var ms = curr - (prevTime || curr);
|
|
141
|
+
self.diff = ms;
|
|
142
|
+
self.prev = prevTime;
|
|
143
|
+
self.curr = curr;
|
|
144
|
+
prevTime = curr;
|
|
145
|
+
var args = new Array(arguments.length);
|
|
146
|
+
for (var i = 0; i < args.length; i++) {
|
|
147
|
+
args[i] = arguments[i];
|
|
148
|
+
}
|
|
149
|
+
args[0] = exports.coerce(args[0]);
|
|
150
|
+
if ("string" !== typeof args[0]) {
|
|
151
|
+
args.unshift("%O");
|
|
152
|
+
}
|
|
153
|
+
var index = 0;
|
|
154
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
155
|
+
if (match === "%%") return match;
|
|
156
|
+
index++;
|
|
157
|
+
var formatter = exports.formatters[format];
|
|
158
|
+
if ("function" === typeof formatter) {
|
|
159
|
+
var val = args[index];
|
|
160
|
+
match = formatter.call(self, val);
|
|
161
|
+
args.splice(index, 1);
|
|
162
|
+
index--;
|
|
163
|
+
}
|
|
164
|
+
return match;
|
|
165
|
+
});
|
|
166
|
+
exports.formatArgs.call(self, args);
|
|
167
|
+
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
168
|
+
logFn.apply(self, args);
|
|
169
|
+
}
|
|
170
|
+
debug.namespace = namespace;
|
|
171
|
+
debug.enabled = exports.enabled(namespace);
|
|
172
|
+
debug.useColors = exports.useColors();
|
|
173
|
+
debug.color = selectColor(namespace);
|
|
174
|
+
debug.destroy = destroy;
|
|
175
|
+
if ("function" === typeof exports.init) {
|
|
176
|
+
exports.init(debug);
|
|
177
|
+
}
|
|
178
|
+
exports.instances.push(debug);
|
|
179
|
+
return debug;
|
|
180
|
+
}
|
|
181
|
+
function destroy() {
|
|
182
|
+
var index = exports.instances.indexOf(this);
|
|
183
|
+
if (index !== -1) {
|
|
184
|
+
exports.instances.splice(index, 1);
|
|
185
|
+
return true;
|
|
186
|
+
} else {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function enable(namespaces) {
|
|
191
|
+
exports.save(namespaces);
|
|
192
|
+
exports.names = [];
|
|
193
|
+
exports.skips = [];
|
|
194
|
+
var i;
|
|
195
|
+
var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
196
|
+
var len = split.length;
|
|
197
|
+
for (i = 0; i < len; i++) {
|
|
198
|
+
if (!split[i]) continue;
|
|
199
|
+
namespaces = split[i].replace(/\*/g, ".*?");
|
|
200
|
+
if (namespaces[0] === "-") {
|
|
201
|
+
exports.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
|
|
202
|
+
} else {
|
|
203
|
+
exports.names.push(new RegExp("^" + namespaces + "$"));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
for (i = 0; i < exports.instances.length; i++) {
|
|
207
|
+
var instance = exports.instances[i];
|
|
208
|
+
instance.enabled = exports.enabled(instance.namespace);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function disable() {
|
|
212
|
+
exports.enable("");
|
|
213
|
+
}
|
|
214
|
+
function enabled(name) {
|
|
215
|
+
if (name[name.length - 1] === "*") {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
var i, len;
|
|
219
|
+
for (i = 0, len = exports.skips.length; i < len; i++) {
|
|
220
|
+
if (exports.skips[i].test(name)) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
for (i = 0, len = exports.names.length; i < len; i++) {
|
|
225
|
+
if (exports.names[i].test(name)) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
function coerce(val) {
|
|
232
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
233
|
+
return val;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/browser.js
|
|
239
|
+
var require_browser = __commonJS({
|
|
240
|
+
"node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/browser.js"(exports, module) {
|
|
241
|
+
"use strict";
|
|
242
|
+
exports = module.exports = require_debug();
|
|
243
|
+
exports.log = log;
|
|
244
|
+
exports.formatArgs = formatArgs;
|
|
245
|
+
exports.save = save;
|
|
246
|
+
exports.load = load;
|
|
247
|
+
exports.useColors = useColors;
|
|
248
|
+
exports.storage = "undefined" != typeof chrome && "undefined" != typeof chrome.storage ? chrome.storage.local : localstorage();
|
|
249
|
+
exports.colors = [
|
|
250
|
+
"#0000CC",
|
|
251
|
+
"#0000FF",
|
|
252
|
+
"#0033CC",
|
|
253
|
+
"#0033FF",
|
|
254
|
+
"#0066CC",
|
|
255
|
+
"#0066FF",
|
|
256
|
+
"#0099CC",
|
|
257
|
+
"#0099FF",
|
|
258
|
+
"#00CC00",
|
|
259
|
+
"#00CC33",
|
|
260
|
+
"#00CC66",
|
|
261
|
+
"#00CC99",
|
|
262
|
+
"#00CCCC",
|
|
263
|
+
"#00CCFF",
|
|
264
|
+
"#3300CC",
|
|
265
|
+
"#3300FF",
|
|
266
|
+
"#3333CC",
|
|
267
|
+
"#3333FF",
|
|
268
|
+
"#3366CC",
|
|
269
|
+
"#3366FF",
|
|
270
|
+
"#3399CC",
|
|
271
|
+
"#3399FF",
|
|
272
|
+
"#33CC00",
|
|
273
|
+
"#33CC33",
|
|
274
|
+
"#33CC66",
|
|
275
|
+
"#33CC99",
|
|
276
|
+
"#33CCCC",
|
|
277
|
+
"#33CCFF",
|
|
278
|
+
"#6600CC",
|
|
279
|
+
"#6600FF",
|
|
280
|
+
"#6633CC",
|
|
281
|
+
"#6633FF",
|
|
282
|
+
"#66CC00",
|
|
283
|
+
"#66CC33",
|
|
284
|
+
"#9900CC",
|
|
285
|
+
"#9900FF",
|
|
286
|
+
"#9933CC",
|
|
287
|
+
"#9933FF",
|
|
288
|
+
"#99CC00",
|
|
289
|
+
"#99CC33",
|
|
290
|
+
"#CC0000",
|
|
291
|
+
"#CC0033",
|
|
292
|
+
"#CC0066",
|
|
293
|
+
"#CC0099",
|
|
294
|
+
"#CC00CC",
|
|
295
|
+
"#CC00FF",
|
|
296
|
+
"#CC3300",
|
|
297
|
+
"#CC3333",
|
|
298
|
+
"#CC3366",
|
|
299
|
+
"#CC3399",
|
|
300
|
+
"#CC33CC",
|
|
301
|
+
"#CC33FF",
|
|
302
|
+
"#CC6600",
|
|
303
|
+
"#CC6633",
|
|
304
|
+
"#CC9900",
|
|
305
|
+
"#CC9933",
|
|
306
|
+
"#CCCC00",
|
|
307
|
+
"#CCCC33",
|
|
308
|
+
"#FF0000",
|
|
309
|
+
"#FF0033",
|
|
310
|
+
"#FF0066",
|
|
311
|
+
"#FF0099",
|
|
312
|
+
"#FF00CC",
|
|
313
|
+
"#FF00FF",
|
|
314
|
+
"#FF3300",
|
|
315
|
+
"#FF3333",
|
|
316
|
+
"#FF3366",
|
|
317
|
+
"#FF3399",
|
|
318
|
+
"#FF33CC",
|
|
319
|
+
"#FF33FF",
|
|
320
|
+
"#FF6600",
|
|
321
|
+
"#FF6633",
|
|
322
|
+
"#FF9900",
|
|
323
|
+
"#FF9933",
|
|
324
|
+
"#FFCC00",
|
|
325
|
+
"#FFCC33"
|
|
326
|
+
];
|
|
327
|
+
function useColors() {
|
|
328
|
+
if (typeof window !== "undefined" && window.process && window.process.type === "renderer") {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773
|
|
335
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?
|
|
336
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
337
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker
|
|
338
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
339
|
+
}
|
|
340
|
+
exports.formatters.j = function(v) {
|
|
341
|
+
try {
|
|
342
|
+
return JSON.stringify(v);
|
|
343
|
+
} catch (err) {
|
|
344
|
+
return "[UnexpectedJSONParseError]: " + err.message;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
function formatArgs(args) {
|
|
348
|
+
var useColors2 = this.useColors;
|
|
349
|
+
args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports.humanize(this.diff);
|
|
350
|
+
if (!useColors2) return;
|
|
351
|
+
var c = "color: " + this.color;
|
|
352
|
+
args.splice(1, 0, c, "color: inherit");
|
|
353
|
+
var index = 0;
|
|
354
|
+
var lastC = 0;
|
|
355
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
356
|
+
if ("%%" === match) return;
|
|
357
|
+
index++;
|
|
358
|
+
if ("%c" === match) {
|
|
359
|
+
lastC = index;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
args.splice(lastC, 0, c);
|
|
363
|
+
}
|
|
364
|
+
function log() {
|
|
365
|
+
return "object" === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments);
|
|
366
|
+
}
|
|
367
|
+
function save(namespaces) {
|
|
368
|
+
try {
|
|
369
|
+
if (null == namespaces) {
|
|
370
|
+
exports.storage.removeItem("debug");
|
|
371
|
+
} else {
|
|
372
|
+
exports.storage.debug = namespaces;
|
|
373
|
+
}
|
|
374
|
+
} catch (e) {
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function load() {
|
|
378
|
+
var r;
|
|
379
|
+
try {
|
|
380
|
+
r = exports.storage.debug;
|
|
381
|
+
} catch (e) {
|
|
382
|
+
}
|
|
383
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
384
|
+
r = process.env.DEBUG;
|
|
385
|
+
}
|
|
386
|
+
return r;
|
|
387
|
+
}
|
|
388
|
+
exports.enable(load());
|
|
389
|
+
function localstorage() {
|
|
390
|
+
try {
|
|
391
|
+
return window.localStorage;
|
|
392
|
+
} catch (e) {
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/node.js
|
|
399
|
+
var require_node = __commonJS({
|
|
400
|
+
"node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/node.js"(exports, module) {
|
|
401
|
+
"use strict";
|
|
402
|
+
var tty = __require("tty");
|
|
403
|
+
var util = __require("util");
|
|
404
|
+
exports = module.exports = require_debug();
|
|
405
|
+
exports.init = init;
|
|
406
|
+
exports.log = log;
|
|
407
|
+
exports.formatArgs = formatArgs;
|
|
408
|
+
exports.save = save;
|
|
409
|
+
exports.load = load;
|
|
410
|
+
exports.useColors = useColors;
|
|
411
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
412
|
+
try {
|
|
413
|
+
supportsColor = __require("supports-color");
|
|
414
|
+
if (supportsColor && supportsColor.level >= 2) {
|
|
415
|
+
exports.colors = [
|
|
416
|
+
20,
|
|
417
|
+
21,
|
|
418
|
+
26,
|
|
419
|
+
27,
|
|
420
|
+
32,
|
|
421
|
+
33,
|
|
422
|
+
38,
|
|
423
|
+
39,
|
|
424
|
+
40,
|
|
425
|
+
41,
|
|
426
|
+
42,
|
|
427
|
+
43,
|
|
428
|
+
44,
|
|
429
|
+
45,
|
|
430
|
+
56,
|
|
431
|
+
57,
|
|
432
|
+
62,
|
|
433
|
+
63,
|
|
434
|
+
68,
|
|
435
|
+
69,
|
|
436
|
+
74,
|
|
437
|
+
75,
|
|
438
|
+
76,
|
|
439
|
+
77,
|
|
440
|
+
78,
|
|
441
|
+
79,
|
|
442
|
+
80,
|
|
443
|
+
81,
|
|
444
|
+
92,
|
|
445
|
+
93,
|
|
446
|
+
98,
|
|
447
|
+
99,
|
|
448
|
+
112,
|
|
449
|
+
113,
|
|
450
|
+
128,
|
|
451
|
+
129,
|
|
452
|
+
134,
|
|
453
|
+
135,
|
|
454
|
+
148,
|
|
455
|
+
149,
|
|
456
|
+
160,
|
|
457
|
+
161,
|
|
458
|
+
162,
|
|
459
|
+
163,
|
|
460
|
+
164,
|
|
461
|
+
165,
|
|
462
|
+
166,
|
|
463
|
+
167,
|
|
464
|
+
168,
|
|
465
|
+
169,
|
|
466
|
+
170,
|
|
467
|
+
171,
|
|
468
|
+
172,
|
|
469
|
+
173,
|
|
470
|
+
178,
|
|
471
|
+
179,
|
|
472
|
+
184,
|
|
473
|
+
185,
|
|
474
|
+
196,
|
|
475
|
+
197,
|
|
476
|
+
198,
|
|
477
|
+
199,
|
|
478
|
+
200,
|
|
479
|
+
201,
|
|
480
|
+
202,
|
|
481
|
+
203,
|
|
482
|
+
204,
|
|
483
|
+
205,
|
|
484
|
+
206,
|
|
485
|
+
207,
|
|
486
|
+
208,
|
|
487
|
+
209,
|
|
488
|
+
214,
|
|
489
|
+
215,
|
|
490
|
+
220,
|
|
491
|
+
221
|
|
492
|
+
];
|
|
493
|
+
}
|
|
494
|
+
} catch (err) {
|
|
495
|
+
}
|
|
496
|
+
var supportsColor;
|
|
497
|
+
exports.inspectOpts = Object.keys(process.env).filter(function(key) {
|
|
498
|
+
return /^debug_/i.test(key);
|
|
499
|
+
}).reduce(function(obj, key) {
|
|
500
|
+
var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
|
|
501
|
+
return k.toUpperCase();
|
|
502
|
+
});
|
|
503
|
+
var val = process.env[key];
|
|
504
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
505
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
506
|
+
else if (val === "null") val = null;
|
|
507
|
+
else val = Number(val);
|
|
508
|
+
obj[prop] = val;
|
|
509
|
+
return obj;
|
|
510
|
+
}, {});
|
|
511
|
+
function useColors() {
|
|
512
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
513
|
+
}
|
|
514
|
+
exports.formatters.o = function(v) {
|
|
515
|
+
this.inspectOpts.colors = this.useColors;
|
|
516
|
+
return util.inspect(v, this.inspectOpts).split("\n").map(function(str) {
|
|
517
|
+
return str.trim();
|
|
518
|
+
}).join(" ");
|
|
519
|
+
};
|
|
520
|
+
exports.formatters.O = function(v) {
|
|
521
|
+
this.inspectOpts.colors = this.useColors;
|
|
522
|
+
return util.inspect(v, this.inspectOpts);
|
|
523
|
+
};
|
|
524
|
+
function formatArgs(args) {
|
|
525
|
+
var name = this.namespace;
|
|
526
|
+
var useColors2 = this.useColors;
|
|
527
|
+
if (useColors2) {
|
|
528
|
+
var c = this.color;
|
|
529
|
+
var colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
530
|
+
var prefix = " " + colorCode + ";1m" + name + " \x1B[0m";
|
|
531
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
532
|
+
args.push(colorCode + "m+" + exports.humanize(this.diff) + "\x1B[0m");
|
|
533
|
+
} else {
|
|
534
|
+
args[0] = getDate() + name + " " + args[0];
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function getDate() {
|
|
538
|
+
if (exports.inspectOpts.hideDate) {
|
|
539
|
+
return "";
|
|
540
|
+
} else {
|
|
541
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function log() {
|
|
545
|
+
return process.stderr.write(util.format.apply(util, arguments) + "\n");
|
|
546
|
+
}
|
|
547
|
+
function save(namespaces) {
|
|
548
|
+
if (null == namespaces) {
|
|
549
|
+
delete process.env.DEBUG;
|
|
550
|
+
} else {
|
|
551
|
+
process.env.DEBUG = namespaces;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function load() {
|
|
555
|
+
return process.env.DEBUG;
|
|
556
|
+
}
|
|
557
|
+
function init(debug) {
|
|
558
|
+
debug.inspectOpts = {};
|
|
559
|
+
var keys = Object.keys(exports.inspectOpts);
|
|
560
|
+
for (var i = 0; i < keys.length; i++) {
|
|
561
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
exports.enable(load());
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/index.js
|
|
569
|
+
var require_src = __commonJS({
|
|
570
|
+
"node_modules/.pnpm/debug@3.1.0/node_modules/debug/src/index.js"(exports, module) {
|
|
571
|
+
"use strict";
|
|
572
|
+
if (typeof process === "undefined" || process.type === "renderer") {
|
|
573
|
+
module.exports = require_browser();
|
|
574
|
+
} else {
|
|
575
|
+
module.exports = require_node();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
// node_modules/.pnpm/@sap+hana-client@2.27.19/node_modules/@sap/hana-client/lib/index.js
|
|
581
|
+
var require_lib = __commonJS({
|
|
582
|
+
"node_modules/.pnpm/@sap+hana-client@2.27.19/node_modules/@sap/hana-client/lib/index.js"(exports, module) {
|
|
583
|
+
var fs = __require("fs");
|
|
584
|
+
var path = __require("path");
|
|
585
|
+
var os = __require("os");
|
|
586
|
+
var net = __require("net");
|
|
587
|
+
var debug = require_src()("@sap/hana-client:index");
|
|
588
|
+
debug.log = console.info.bind(console);
|
|
589
|
+
var name = "index.js";
|
|
590
|
+
var majorVersion = process.versions.node.split(".")[0];
|
|
591
|
+
debug("Starting %s", name);
|
|
592
|
+
var extensions = {
|
|
593
|
+
"darwin": ".dylib",
|
|
594
|
+
"linux": ".so",
|
|
595
|
+
"win32": ".dll"
|
|
596
|
+
};
|
|
597
|
+
var db = null;
|
|
598
|
+
function isMusl() {
|
|
599
|
+
const output = __require("child_process").spawnSync("ldd", ["--version"]).stderr;
|
|
600
|
+
if (output && output.toString("utf8").indexOf("musl") > -1) {
|
|
601
|
+
return true;
|
|
602
|
+
}
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
var readPipe = null;
|
|
606
|
+
function refPipe() {
|
|
607
|
+
readPipe.ref();
|
|
608
|
+
}
|
|
609
|
+
function unrefPipe() {
|
|
610
|
+
readPipe.unref();
|
|
611
|
+
}
|
|
612
|
+
function setupPipe(pipeInfo2) {
|
|
613
|
+
if (!db) return;
|
|
614
|
+
var ldb = db;
|
|
615
|
+
if (process.platform === "win32") {
|
|
616
|
+
readPipe = net.createConnection(pipeInfo2["IPCEndpoint"]);
|
|
617
|
+
} else {
|
|
618
|
+
readPipe = net.Socket({
|
|
619
|
+
fd: pipeInfo2["fd"],
|
|
620
|
+
readable: true
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
readPipe.unref();
|
|
624
|
+
readPipe.on("data", function(data) {
|
|
625
|
+
ldb.__runCallbacks();
|
|
626
|
+
});
|
|
627
|
+
ldb.__setRefFunctions(refPipe, unrefPipe);
|
|
628
|
+
}
|
|
629
|
+
var InternalResultSetParser = class {
|
|
630
|
+
// initialize and read header
|
|
631
|
+
constructor(rs_bin) {
|
|
632
|
+
if (!Buffer.isBuffer(rs_bin)) {
|
|
633
|
+
this.throwError("rs_bin is not a Buffer in InternalResultSetParser constructor");
|
|
634
|
+
} else if (rs_bin.length < 16) {
|
|
635
|
+
this.throwError("rs_bin length of " + rs_bin.length + " is too small in InternalResultSetParser constructor");
|
|
636
|
+
}
|
|
637
|
+
this.m_buffer = rs_bin;
|
|
638
|
+
this.m_curr_offset = 0;
|
|
639
|
+
this.m_in_array_value = false;
|
|
640
|
+
var length_in_buffer = this.privateReadUInt64();
|
|
641
|
+
if (this.m_buffer.length != length_in_buffer) {
|
|
642
|
+
this.throwError("rs_bin length of " + this.m_buffer.length + " does not match internal length of " + length_in_buffer + " in InternalResultSetParser constructor");
|
|
643
|
+
}
|
|
644
|
+
this.numberOfRows = this.privateReadUInt32();
|
|
645
|
+
this.numberOfColumns = this.privateReadUInt32();
|
|
646
|
+
if (this.numberOfColumns < 1 || this.numberOfColumns > 65535) {
|
|
647
|
+
this.throwError("Invalid numberOfColumns of " + this.numberOfColumns + " in InternalResultSetParser constructor");
|
|
648
|
+
}
|
|
649
|
+
this.columnNames = [];
|
|
650
|
+
for (var i = 0; i < this.numberOfColumns; i++) {
|
|
651
|
+
var col_name = this.readValue();
|
|
652
|
+
if (typeof col_name !== "string") {
|
|
653
|
+
this.throwError("Invalid column name type of " + typeof col_name + " in InternalResultSetParser constructor");
|
|
654
|
+
}
|
|
655
|
+
this.columnNames.push(col_name);
|
|
656
|
+
}
|
|
657
|
+
this.columnTableNames = [];
|
|
658
|
+
for (var i = 0; i < this.numberOfColumns; i++) {
|
|
659
|
+
var col_table_name = this.readValue();
|
|
660
|
+
if (col_table_name !== null && typeof col_table_name !== "string") {
|
|
661
|
+
this.throwError("Invalid read column table name type of " + typeof col_table_name + " in InternalResultSetParser constructor");
|
|
662
|
+
}
|
|
663
|
+
this.columnTableNames.push(col_table_name);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
throwError(msg) {
|
|
667
|
+
var err = new Error("Error making result set Object: " + msg);
|
|
668
|
+
err.code = -20009;
|
|
669
|
+
err.sqlState = "HY000";
|
|
670
|
+
throw err;
|
|
671
|
+
}
|
|
672
|
+
// read the next value
|
|
673
|
+
readValue() {
|
|
674
|
+
const I_RS_NULL = 1;
|
|
675
|
+
const I_RS_BOOLEAN = 2;
|
|
676
|
+
const I_RS_INT32 = 3;
|
|
677
|
+
const I_RS_DOUBLE = 4;
|
|
678
|
+
const I_RS_STRING = 5;
|
|
679
|
+
const I_RS_BINARY = 6;
|
|
680
|
+
const I_RS_ARRAY = 7;
|
|
681
|
+
if (this.m_curr_offset >= this.m_buffer_length) {
|
|
682
|
+
this.throwError("InternalResultSetParser.readValue already at end of buffer");
|
|
683
|
+
}
|
|
684
|
+
var type = this.m_buffer.readInt8(this.m_curr_offset++);
|
|
685
|
+
switch (type) {
|
|
686
|
+
case I_RS_NULL:
|
|
687
|
+
return null;
|
|
688
|
+
case I_RS_BOOLEAN:
|
|
689
|
+
var val = this.m_buffer.readInt8(this.m_curr_offset++);
|
|
690
|
+
return val ? true : false;
|
|
691
|
+
case I_RS_INT32:
|
|
692
|
+
var num = this.m_buffer.readInt32LE(this.m_curr_offset);
|
|
693
|
+
this.m_curr_offset += 4;
|
|
694
|
+
return num;
|
|
695
|
+
case I_RS_DOUBLE:
|
|
696
|
+
var num = this.m_buffer.readDoubleLE(this.m_curr_offset);
|
|
697
|
+
this.m_curr_offset += 8;
|
|
698
|
+
return num;
|
|
699
|
+
case I_RS_STRING:
|
|
700
|
+
var len = this.privateReadUInt32();
|
|
701
|
+
var str = this.m_buffer.toString("utf8", this.m_curr_offset, this.m_curr_offset + len);
|
|
702
|
+
this.m_curr_offset += len;
|
|
703
|
+
return str;
|
|
704
|
+
case I_RS_BINARY:
|
|
705
|
+
var len = this.privateReadUInt32();
|
|
706
|
+
var bin = this.m_buffer.subarray(this.m_curr_offset, this.m_curr_offset + len);
|
|
707
|
+
this.m_curr_offset += len;
|
|
708
|
+
return bin;
|
|
709
|
+
case I_RS_ARRAY:
|
|
710
|
+
var num_elements = this.m_buffer.readInt32LE(this.m_curr_offset);
|
|
711
|
+
this.m_curr_offset += 4;
|
|
712
|
+
if (this.m_in_array_value) {
|
|
713
|
+
this.throwError("InternalResultSetParser.readValue nested array value");
|
|
714
|
+
}
|
|
715
|
+
this.m_in_array_value = true;
|
|
716
|
+
var array = [];
|
|
717
|
+
for (var i = 0; i < num_elements; i++) {
|
|
718
|
+
array.push(this.readValue());
|
|
719
|
+
}
|
|
720
|
+
this.m_in_array_value = false;
|
|
721
|
+
return array;
|
|
722
|
+
}
|
|
723
|
+
;
|
|
724
|
+
this.throwError("InternalResultSetParser.readValue unexpected value type code of " + type);
|
|
725
|
+
}
|
|
726
|
+
// confirm that all data in the binary buffer was read
|
|
727
|
+
verifyAtEnd() {
|
|
728
|
+
if (this.m_curr_offset != this.m_buffer.length) {
|
|
729
|
+
this.throwError("Verify at end failed. m_curr_offset:" + this.m_curr_offset + " m_buffer.length:" + this.m_buffer.length);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
// internal method used to implement InternalResultSetParser itself
|
|
733
|
+
privateReadUInt32() {
|
|
734
|
+
var val = this.m_buffer.readInt32LE(this.m_curr_offset);
|
|
735
|
+
this.m_curr_offset += 4;
|
|
736
|
+
return val;
|
|
737
|
+
}
|
|
738
|
+
privateReadUInt64() {
|
|
739
|
+
var val;
|
|
740
|
+
if (majorVersion >= 12) {
|
|
741
|
+
val = this.m_buffer.readBigUInt64LE(this.m_curr_offset);
|
|
742
|
+
this.m_curr_offset += 8;
|
|
743
|
+
} else {
|
|
744
|
+
var low_val = this.privateReadUInt32();
|
|
745
|
+
var high_val = this.privateReadUInt32();
|
|
746
|
+
val = low_val + high_val * 4294967296;
|
|
747
|
+
}
|
|
748
|
+
return val;
|
|
749
|
+
}
|
|
750
|
+
/* member data:
|
|
751
|
+
* numberOfRows: number of rows in result set
|
|
752
|
+
* numberOfColumns: number of columns in result set
|
|
753
|
+
* columnNames: array of strings of column names
|
|
754
|
+
* columnTableNames: array of (strings or NULL) of column table names
|
|
755
|
+
* member data that should be considered private:
|
|
756
|
+
* m_buffer: the entire binary buffer we are parsing
|
|
757
|
+
* m_curr_offset: current offset of m_buffer for next read
|
|
758
|
+
* m_in_array_value: true when elements remain in I_RS_ARRAY
|
|
759
|
+
*/
|
|
760
|
+
};
|
|
761
|
+
function translateFromInternalResultSet(options, rs_bin) {
|
|
762
|
+
var rowsAsArray = false;
|
|
763
|
+
var nestTables = false;
|
|
764
|
+
if (options !== null) {
|
|
765
|
+
if (options.rowsAsArray) {
|
|
766
|
+
rowsAsArray = true;
|
|
767
|
+
}
|
|
768
|
+
if (options.nestTables) {
|
|
769
|
+
nestTables = true;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
var rs_parser = new InternalResultSetParser(rs_bin);
|
|
773
|
+
var column_names = rs_parser.columnNames;
|
|
774
|
+
var column_table_names = rs_parser.columnTableNames;
|
|
775
|
+
var rows = [];
|
|
776
|
+
var number_of_rows = rs_parser.numberOfRows;
|
|
777
|
+
var number_of_columns = rs_parser.numberOfColumns;
|
|
778
|
+
for (var i = 0; i < number_of_rows; i++) {
|
|
779
|
+
var row;
|
|
780
|
+
if (rowsAsArray) {
|
|
781
|
+
row = [];
|
|
782
|
+
for (var j = 0; j < number_of_columns; j++) {
|
|
783
|
+
row.push(rs_parser.readValue());
|
|
784
|
+
}
|
|
785
|
+
} else {
|
|
786
|
+
row = {};
|
|
787
|
+
for (var j = 0; j < number_of_columns; j++) {
|
|
788
|
+
if (nestTables && column_table_names[j]) {
|
|
789
|
+
if (row[column_table_names[j]] === void 0) {
|
|
790
|
+
row[column_table_names[j]] = {};
|
|
791
|
+
}
|
|
792
|
+
row[column_table_names[j]][column_names[j]] = rs_parser.readValue();
|
|
793
|
+
} else {
|
|
794
|
+
row[column_names[j]] = rs_parser.readValue();
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
rows.push(row);
|
|
799
|
+
}
|
|
800
|
+
rs_parser.verifyAtEnd();
|
|
801
|
+
return rows;
|
|
802
|
+
}
|
|
803
|
+
var ArgParser = class {
|
|
804
|
+
constructor(argv) {
|
|
805
|
+
this.argv = argv;
|
|
806
|
+
this.next_idx = 0;
|
|
807
|
+
}
|
|
808
|
+
// Return the next arg, skipping args that are null or undefined,
|
|
809
|
+
// return null if there is no more args
|
|
810
|
+
getNext() {
|
|
811
|
+
while (this.next_idx < this.argv.length) {
|
|
812
|
+
var next_arg = this.argv[this.next_idx++];
|
|
813
|
+
if (next_arg !== null && next_arg !== void 0) {
|
|
814
|
+
return next_arg;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return null;
|
|
818
|
+
}
|
|
819
|
+
// return what the next arg will be, but do NOT advance next_idx
|
|
820
|
+
peekNext() {
|
|
821
|
+
var save_next_idx = this.next_idx;
|
|
822
|
+
var peek_arg = this.getNext();
|
|
823
|
+
this.next_idx = save_next_idx;
|
|
824
|
+
return peek_arg;
|
|
825
|
+
}
|
|
826
|
+
// Helper for parseExecuteArgs to resolve ambiguity of first parameter being an
|
|
827
|
+
// object, which could be named bind parameters or could be options (yuck!)
|
|
828
|
+
// Return true if arg is bind parameters, false otherwise
|
|
829
|
+
isBindParameter(arg) {
|
|
830
|
+
if (arg === null) return false;
|
|
831
|
+
if (Array.isArray(arg)) {
|
|
832
|
+
return true;
|
|
833
|
+
}
|
|
834
|
+
if (typeof arg !== "object") {
|
|
835
|
+
return false;
|
|
836
|
+
}
|
|
837
|
+
var peek_arg = this.peekNext();
|
|
838
|
+
if (peek_arg !== null && typeof peek_arg === "object") {
|
|
839
|
+
return true;
|
|
840
|
+
}
|
|
841
|
+
if (arg.nestTables !== void 0 || arg.rowsAsArray !== void 0 || arg.queryTimeout !== void 0 || arg.communicationTimeout !== void 0 || arg.fastInternalRows !== void 0 || arg.returnMultipleResultSets !== void 0 || arg.vectorOutputType !== void 0) {
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
return true;
|
|
845
|
+
}
|
|
846
|
+
// parse params, options and cbfunc args common to
|
|
847
|
+
// Statement.execute and Connection.execute
|
|
848
|
+
parseExecuteArgs() {
|
|
849
|
+
this.params = null;
|
|
850
|
+
this.options = null;
|
|
851
|
+
this.cbfunc = null;
|
|
852
|
+
var arg = this.getNext();
|
|
853
|
+
if (this.isBindParameter(arg)) {
|
|
854
|
+
this.params = arg;
|
|
855
|
+
arg = this.getNext();
|
|
856
|
+
}
|
|
857
|
+
if (arg !== null && typeof arg === "object" && !Array.isArray(arg)) {
|
|
858
|
+
this.options = arg;
|
|
859
|
+
arg = this.getNext();
|
|
860
|
+
}
|
|
861
|
+
if (arg !== null && typeof arg === "function") {
|
|
862
|
+
this.cbfunc = arg;
|
|
863
|
+
arg = this.getNext();
|
|
864
|
+
}
|
|
865
|
+
if (arg !== null) {
|
|
866
|
+
while (arg !== null) {
|
|
867
|
+
if (typeof arg === "function") {
|
|
868
|
+
this.cbfunc = arg;
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
arg = this.getNext();
|
|
872
|
+
}
|
|
873
|
+
throw new Error();
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
function StatementExec(stmt, p1, p2, p3, execType) {
|
|
878
|
+
var args = new ArgParser([p1, p2, p3]);
|
|
879
|
+
var parseError;
|
|
880
|
+
try {
|
|
881
|
+
args.parseExecuteArgs();
|
|
882
|
+
} catch (e) {
|
|
883
|
+
var methodName;
|
|
884
|
+
switch (execType) {
|
|
885
|
+
case 2:
|
|
886
|
+
methodName = "exec[ute]Batch";
|
|
887
|
+
break;
|
|
888
|
+
case 1:
|
|
889
|
+
methodName = "exec[ute]Query";
|
|
890
|
+
break;
|
|
891
|
+
default:
|
|
892
|
+
case 0:
|
|
893
|
+
methodName = "exec[ute]";
|
|
894
|
+
break;
|
|
895
|
+
}
|
|
896
|
+
parseError = new Error("Invalid parameter for function '" + methodName + "([params][, options][, callback])'");
|
|
897
|
+
parseError.code = -20002;
|
|
898
|
+
parseError.sqlState = "HY000";
|
|
899
|
+
}
|
|
900
|
+
var func;
|
|
901
|
+
switch (execType) {
|
|
902
|
+
case 2:
|
|
903
|
+
func = stmt.execBatchInternal;
|
|
904
|
+
break;
|
|
905
|
+
case 1:
|
|
906
|
+
func = stmt.execQueryInternal;
|
|
907
|
+
break;
|
|
908
|
+
case 0:
|
|
909
|
+
default:
|
|
910
|
+
func = stmt.execInternal;
|
|
911
|
+
break;
|
|
912
|
+
}
|
|
913
|
+
if (args.cbfunc) {
|
|
914
|
+
if (parseError) {
|
|
915
|
+
args.cbfunc(parseError);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
func.call(
|
|
919
|
+
stmt,
|
|
920
|
+
args.params,
|
|
921
|
+
args.options,
|
|
922
|
+
function StatementExecCallback(e, rows2) {
|
|
923
|
+
if (!e) {
|
|
924
|
+
if (Buffer.isBuffer(rows2)) {
|
|
925
|
+
try {
|
|
926
|
+
rows2 = translateFromInternalResultSet(args.options, rows2);
|
|
927
|
+
} catch (err) {
|
|
928
|
+
e = err;
|
|
929
|
+
rows2 = null;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (arguments.length == 2) {
|
|
934
|
+
args.cbfunc(e, rows2);
|
|
935
|
+
} else {
|
|
936
|
+
args.cbfunc(e);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
);
|
|
940
|
+
} else {
|
|
941
|
+
if (parseError) {
|
|
942
|
+
throw parseError;
|
|
943
|
+
}
|
|
944
|
+
var rows = func.call(stmt, args.params, args.options, null);
|
|
945
|
+
if (Buffer.isBuffer(rows)) {
|
|
946
|
+
rows = translateFromInternalResultSet(args.options, rows);
|
|
947
|
+
}
|
|
948
|
+
return rows;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
function dynamicallyAddStmtExecMethod(stmt) {
|
|
952
|
+
if (stmt.exec == null) {
|
|
953
|
+
stmt.exec = function(p1 = null, p2 = null, p3 = null) {
|
|
954
|
+
return StatementExec(this, p1, p2, p3, 0);
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
if (stmt.execute == null) {
|
|
958
|
+
stmt.execute = function(p1 = null, p2 = null, p3 = null) {
|
|
959
|
+
return StatementExec(this, p1, p2, p3, 0);
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
if (stmt.execQuery == null) {
|
|
963
|
+
stmt.execQuery = function(p1 = null, p2 = null, p3 = null) {
|
|
964
|
+
return StatementExec(this, p1, p2, p3, 1);
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
if (stmt.executeQuery == null) {
|
|
968
|
+
stmt.executeQuery = function(p1 = null, p2 = null, p3 = null) {
|
|
969
|
+
return StatementExec(this, p1, p2, p3, 1);
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
if (stmt.execBatch == null) {
|
|
973
|
+
stmt.execBatch = function(p1 = null, p2 = null, p3 = null) {
|
|
974
|
+
return StatementExec(this, p1, p2, p3, 2);
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
if (stmt.executeBatch == null) {
|
|
978
|
+
stmt.executeBatch = function(p1 = null, p2 = null, p3 = null) {
|
|
979
|
+
return StatementExec(this, p1, p2, p3, 2);
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
function isPropertyTrue(obj, key) {
|
|
984
|
+
if (typeof obj === "object" && obj !== null) {
|
|
985
|
+
const lowerKey = key.toLowerCase();
|
|
986
|
+
for (const prop in obj) {
|
|
987
|
+
if (prop.toLowerCase() === lowerKey) {
|
|
988
|
+
const value = obj[prop];
|
|
989
|
+
return value === true || typeof value === "string" && value.toLowerCase() === "true";
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return false;
|
|
994
|
+
}
|
|
995
|
+
function ConnectionExec(conn, sql, p2, p3, p4) {
|
|
996
|
+
var args = new ArgParser([p2, p3, p4]);
|
|
997
|
+
var parseError;
|
|
998
|
+
try {
|
|
999
|
+
args.parseExecuteArgs();
|
|
1000
|
+
} catch (e) {
|
|
1001
|
+
parseError = new Error("Invalid parameter for function 'exec[ute](sql[, params][, options][, callback])'");
|
|
1002
|
+
parseError.code = -20002;
|
|
1003
|
+
parseError.sqlState = "HY000";
|
|
1004
|
+
}
|
|
1005
|
+
if (args.cbfunc) {
|
|
1006
|
+
if (parseError) {
|
|
1007
|
+
args.cbfunc(parseError);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
if (args.options !== void 0 && args.options !== null && isPropertyTrue(args.options, "returnMultipleResultSets")) {
|
|
1011
|
+
const streamExt = require_Stream();
|
|
1012
|
+
streamExt.executeMultipleResultSets(conn, sql, args.params, args.options, args.cbfunc);
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
conn.execInternal(
|
|
1016
|
+
sql,
|
|
1017
|
+
args.params,
|
|
1018
|
+
args.options,
|
|
1019
|
+
function ConnectionExecCallback(e, rows2) {
|
|
1020
|
+
if (!e) {
|
|
1021
|
+
if (Buffer.isBuffer(rows2)) {
|
|
1022
|
+
try {
|
|
1023
|
+
rows2 = translateFromInternalResultSet(args.options, rows2);
|
|
1024
|
+
} catch (err) {
|
|
1025
|
+
e = err;
|
|
1026
|
+
rows2 = null;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (arguments.length == 2) {
|
|
1031
|
+
args.cbfunc(e, rows2);
|
|
1032
|
+
} else {
|
|
1033
|
+
args.cbfunc(e);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
} else {
|
|
1038
|
+
if (parseError) {
|
|
1039
|
+
throw parseError;
|
|
1040
|
+
}
|
|
1041
|
+
var rows = conn.execInternal(sql, args.params, args.options, null);
|
|
1042
|
+
if (Buffer.isBuffer(rows)) {
|
|
1043
|
+
rows = translateFromInternalResultSet(args.options, rows);
|
|
1044
|
+
}
|
|
1045
|
+
return rows;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function dynamicallyAddConnExecMethod(conn) {
|
|
1049
|
+
if (conn.exec == null) {
|
|
1050
|
+
conn.exec = function(sql, p2 = null, p3 = null, p4 = null) {
|
|
1051
|
+
return ConnectionExec(this, sql, p2, p3, p4);
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
if (conn.execute == null) {
|
|
1055
|
+
conn.execute = function(sql, p2 = null, p3 = null, p4 = null) {
|
|
1056
|
+
return ConnectionExec(this, sql, p2, p3, p4);
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
var modpath = path.dirname(__dirname);
|
|
1061
|
+
var hanaDynatrace;
|
|
1062
|
+
try {
|
|
1063
|
+
hanaDynatrace = __require(path.join(modpath, "extension", "Dynatrace.js"));
|
|
1064
|
+
} catch (ex) {
|
|
1065
|
+
debug("Could not load Dynatrace.js:" + ex.message);
|
|
1066
|
+
}
|
|
1067
|
+
var hanaOpenTelemetry;
|
|
1068
|
+
try {
|
|
1069
|
+
hanaOpenTelemetry = __require(path.join(modpath, "extension", "OpenTelemetry.js"));
|
|
1070
|
+
} catch (ex) {
|
|
1071
|
+
debug("Could not load OpenTelemetry.js:" + ex.message);
|
|
1072
|
+
}
|
|
1073
|
+
function dynamicallyAddExtTraceWrappers(conn, host, port, tenant, allowOpenTelemetry, allowDynatrace) {
|
|
1074
|
+
var destInfo = { host, port, tenant };
|
|
1075
|
+
try {
|
|
1076
|
+
if (allowOpenTelemetry && hanaOpenTelemetry && hanaOpenTelemetry.isOpenTelemetryEnabled()) {
|
|
1077
|
+
hanaOpenTelemetry.openTelemetryConnection(conn, destInfo);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
} catch (ex) {
|
|
1081
|
+
debug("Error in dynamicallyAddExtTraceWrappers for OpenTelemetry: " + ex.message);
|
|
1082
|
+
}
|
|
1083
|
+
try {
|
|
1084
|
+
if (allowDynatrace && hanaDynatrace && hanaDynatrace.isDynatraceEnabled()) {
|
|
1085
|
+
hanaDynatrace.dynatraceConnection(conn, destInfo);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
} catch (ex) {
|
|
1089
|
+
debug("Error in dynamicallyAddExtTraceWrappers for Dynatrace: " + ex.message);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
process.on("exit", function() {
|
|
1093
|
+
db.__stopAllWork();
|
|
1094
|
+
});
|
|
1095
|
+
debug("Detected os.arch=" + os.arch() + ", process.platform=" + process.platform + ", process.arch=" + process.arch + ", process.version=" + process.version);
|
|
1096
|
+
if (process.platform === "win32" && process.arch != "x64") {
|
|
1097
|
+
debug("ERROR: On Windows, this driver only supports the x64 architecture. Your node process is: " + process.arch);
|
|
1098
|
+
throw new Error("On Windows, this driver only supports the x64 architecture. Your node process is: " + process.arch);
|
|
1099
|
+
}
|
|
1100
|
+
if (majorVersion < 8) {
|
|
1101
|
+
throw new Error("Node version " + process.version + " is unsupported by @sap/hana-client. Only versions >=8 are supported");
|
|
1102
|
+
}
|
|
1103
|
+
var pb_subdir = null;
|
|
1104
|
+
var dbcapi_name = "libdbcapiHDB";
|
|
1105
|
+
if (process.platform === "linux") {
|
|
1106
|
+
if (isMusl()) {
|
|
1107
|
+
pb_subdir = "linuxx86_64_alpine-gcc6";
|
|
1108
|
+
} else if (process.arch === "x64") {
|
|
1109
|
+
pb_subdir = "linuxx86_64-gcc6";
|
|
1110
|
+
} else if (process.arch.toLowerCase().indexOf("ppc") != -1 && os.endianness() === "LE") {
|
|
1111
|
+
pb_subdir = "linuxppc64le-gcc6";
|
|
1112
|
+
} else if (process.arch === "arm64") {
|
|
1113
|
+
pb_subdir = "linuxaarch64-gcc9";
|
|
1114
|
+
} else {
|
|
1115
|
+
pb_subdir = "unknown";
|
|
1116
|
+
}
|
|
1117
|
+
} else if (process.platform === "win32") {
|
|
1118
|
+
pb_subdir = "ntamd64-msvc2022";
|
|
1119
|
+
} else if (process.platform === "darwin") {
|
|
1120
|
+
if (process.arch === "arm64") {
|
|
1121
|
+
pb_subdir = "darwinarm64-xcode12";
|
|
1122
|
+
} else {
|
|
1123
|
+
pb_subdir = "darwinintel64-xcode7";
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
var pb_path = path.join(modpath, "prebuilt", pb_subdir);
|
|
1127
|
+
var dll_path = pb_path;
|
|
1128
|
+
var dbcapi = path.join(dll_path, dbcapi_name + extensions[process.platform]);
|
|
1129
|
+
var removeDirectory = function(dir) {
|
|
1130
|
+
if (fs.existsSync(dir)) {
|
|
1131
|
+
fs.readdirSync(dir).forEach((file, index) => {
|
|
1132
|
+
const curPath = path.join(dir, file);
|
|
1133
|
+
if (fs.lstatSync(curPath).isDirectory()) {
|
|
1134
|
+
removeDirectory(curPath);
|
|
1135
|
+
} else {
|
|
1136
|
+
fs.unlinkSync(curPath);
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
fs.rmdirSync(dir);
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
var getSubDirs = function(dir) {
|
|
1143
|
+
const isDirectory = (source) => fs.lstatSync(source).isDirectory();
|
|
1144
|
+
const getDirectories = (source) => fs.readdirSync(source).map((name2) => path.join(source, name2)).filter(isDirectory);
|
|
1145
|
+
return getDirectories(dir);
|
|
1146
|
+
};
|
|
1147
|
+
if (process.env["HDB_NODE_PLATFORM_CLEAN"] === "1") {
|
|
1148
|
+
pb_path_all = getSubDirs(path.join(modpath, "prebuilt"));
|
|
1149
|
+
pb_path_all.forEach((pbPath) => {
|
|
1150
|
+
if (pbPath !== pb_path) {
|
|
1151
|
+
try {
|
|
1152
|
+
removeDirectory(pbPath);
|
|
1153
|
+
} catch (ex) {
|
|
1154
|
+
debug(ex.message);
|
|
1155
|
+
debug("Failed to remove unrelated native platform libraries in '" + pbPath + "'.");
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
} else if (process.env["HDB_NODEJS_INSTALL_PLATFORMS"]) {
|
|
1160
|
+
keep = process.env["HDB_NODEJS_INSTALL_PLATFORMS"].split(",").map((name2) => path.join(modpath, "prebuilt", name2));
|
|
1161
|
+
pb_path_all = getSubDirs(path.join(modpath, "prebuilt"));
|
|
1162
|
+
pb_count = pb_path_all.length;
|
|
1163
|
+
pb_path_all.forEach((pbPath) => {
|
|
1164
|
+
if (keep.indexOf(pbPath) < 0) {
|
|
1165
|
+
try {
|
|
1166
|
+
removeDirectory(pbPath);
|
|
1167
|
+
pb_count -= 1;
|
|
1168
|
+
} catch (ex) {
|
|
1169
|
+
debug(ex.message);
|
|
1170
|
+
debug("Failed to remove unrelated native platform libraries in '" + pbPath + "'.");
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
if (pb_count <= 0) {
|
|
1175
|
+
debug("WARNING: Environment variable HDB_NODEJS_INSTALL_PLATFORMS did not name any valid platforms. All native platform libraries have been removed.");
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
var pb_path_all;
|
|
1179
|
+
var keep;
|
|
1180
|
+
var pb_count;
|
|
1181
|
+
var default_driver_file = "hana-client";
|
|
1182
|
+
var driver_file = default_driver_file;
|
|
1183
|
+
if (process.env["HDB_NODE_NO_NAPI_DRIVER"] === "1") {
|
|
1184
|
+
v = process.version;
|
|
1185
|
+
match = v.match(/v([0-9]+)\.([0-9]+)\.[0-9]+/);
|
|
1186
|
+
driver_file += "_v" + match[1];
|
|
1187
|
+
if (match[1] + 0 == 0) {
|
|
1188
|
+
driver_file += "_" + match[2];
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
var v;
|
|
1192
|
+
var match;
|
|
1193
|
+
var driver_path = path.join(pb_path, driver_file + ".node");
|
|
1194
|
+
try {
|
|
1195
|
+
debug("Checking for existence of " + driver_path);
|
|
1196
|
+
fs.statSync(driver_path);
|
|
1197
|
+
} catch (ex) {
|
|
1198
|
+
debug("Did not find " + driver_path);
|
|
1199
|
+
driver_path = path.join(pb_path, default_driver_file + ".node");
|
|
1200
|
+
try {
|
|
1201
|
+
debug("Checking for existence of " + driver_path);
|
|
1202
|
+
fs.statSync(driver_path);
|
|
1203
|
+
} catch (ex2) {
|
|
1204
|
+
debug("No prebuilt node driver found for platform: '" + process.platform + "', arch: '" + process.arch + "', endianness: '" + os.endianness() + "' for Node version: '" + process.version + "'");
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
debug("Attempting to load Hana node-hdbcapi driver");
|
|
1208
|
+
var userbld_driver_path = path.join(modpath, "build", "Release", "hana-client.node");
|
|
1209
|
+
debug("... Trying user-built copy...");
|
|
1210
|
+
try {
|
|
1211
|
+
debug("... Looking for user-built copy in " + userbld_driver_path + " ... ");
|
|
1212
|
+
fs.statSync(userbld_driver_path);
|
|
1213
|
+
debug("Found.");
|
|
1214
|
+
try {
|
|
1215
|
+
debug("... Attempting to load user-built copy... ");
|
|
1216
|
+
db = __require(userbld_driver_path);
|
|
1217
|
+
debug("Loaded.");
|
|
1218
|
+
} catch (ex) {
|
|
1219
|
+
debug(ex.message);
|
|
1220
|
+
debug("Could not load: User-built copy did not satisfy requirements.");
|
|
1221
|
+
throw ex;
|
|
1222
|
+
}
|
|
1223
|
+
} catch (ex) {
|
|
1224
|
+
debug("Not found.");
|
|
1225
|
+
}
|
|
1226
|
+
if (db === null) {
|
|
1227
|
+
debug("... Trying prebuilt copy...");
|
|
1228
|
+
try {
|
|
1229
|
+
debug("... Looking for prebuilt copy in " + driver_path + " ... ");
|
|
1230
|
+
db = __require(driver_path);
|
|
1231
|
+
debug("Loaded.");
|
|
1232
|
+
} catch (ex) {
|
|
1233
|
+
debug(ex.message);
|
|
1234
|
+
debug("Could not load: Prebuilt copy did not satisfy requirements.");
|
|
1235
|
+
debug("Could not load modules for Platform: '" + process.platform + "', Process Arch: '" + process.arch + "', and Version: '" + process.version + "'");
|
|
1236
|
+
throw ex;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
db.__loadDbcapi(dbcapi);
|
|
1240
|
+
var pipeInfo = db.__getPipe();
|
|
1241
|
+
setupPipe(pipeInfo);
|
|
1242
|
+
db.__setAddFnsThatAddMethodsToObjects(
|
|
1243
|
+
dynamicallyAddConnExecMethod,
|
|
1244
|
+
dynamicallyAddStmtExecMethod,
|
|
1245
|
+
dynamicallyAddExtTraceWrappers
|
|
1246
|
+
);
|
|
1247
|
+
if (db !== null) {
|
|
1248
|
+
db.isDynatraceSupported = Boolean(hanaDynatrace);
|
|
1249
|
+
db.isOpenTelemetrySupported = Boolean(hanaOpenTelemetry);
|
|
1250
|
+
debug("Success.");
|
|
1251
|
+
}
|
|
1252
|
+
module.exports = db;
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
export default require_lib();
|
|
1256
|
+
//# sourceMappingURL=lib-J24D2XQX.js.map
|