@truto/truto-jsonata 1.0.45 → 1.0.47
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/README.md +75 -0
- package/dist/browser/index.js +891 -451
- package/dist/browser/index.js.map +25 -10
- package/dist/cjs/index.cjs +911 -471
- package/dist/cjs/index.cjs.map +26 -11
- package/dist/esm/index.js +130 -117
- package/dist/esm/index.js.map +8 -7
- package/dist/functions/dtFromFormat.d.ts +2 -2
- package/dist/functions/jsonToCsv.d.ts +1 -0
- package/package.json +2 -1
package/dist/browser/index.js
CHANGED
|
@@ -21548,6 +21548,223 @@ var require_Window = __commonJS((exports, module) => {
|
|
|
21548
21548
|
utils.expose(require_impl(), Window);
|
|
21549
21549
|
});
|
|
21550
21550
|
|
|
21551
|
+
// node_modules/retry/lib/retry_operation.js
|
|
21552
|
+
var require_retry_operation = __commonJS((exports, module) => {
|
|
21553
|
+
function RetryOperation(timeouts, options3) {
|
|
21554
|
+
if (typeof options3 === "boolean") {
|
|
21555
|
+
options3 = { forever: options3 };
|
|
21556
|
+
}
|
|
21557
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
21558
|
+
this._timeouts = timeouts;
|
|
21559
|
+
this._options = options3 || {};
|
|
21560
|
+
this._maxRetryTime = options3 && options3.maxRetryTime || Infinity;
|
|
21561
|
+
this._fn = null;
|
|
21562
|
+
this._errors = [];
|
|
21563
|
+
this._attempts = 1;
|
|
21564
|
+
this._operationTimeout = null;
|
|
21565
|
+
this._operationTimeoutCb = null;
|
|
21566
|
+
this._timeout = null;
|
|
21567
|
+
this._operationStart = null;
|
|
21568
|
+
this._timer = null;
|
|
21569
|
+
if (this._options.forever) {
|
|
21570
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
21571
|
+
}
|
|
21572
|
+
}
|
|
21573
|
+
module.exports = RetryOperation;
|
|
21574
|
+
RetryOperation.prototype.reset = function() {
|
|
21575
|
+
this._attempts = 1;
|
|
21576
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
21577
|
+
};
|
|
21578
|
+
RetryOperation.prototype.stop = function() {
|
|
21579
|
+
if (this._timeout) {
|
|
21580
|
+
clearTimeout(this._timeout);
|
|
21581
|
+
}
|
|
21582
|
+
if (this._timer) {
|
|
21583
|
+
clearTimeout(this._timer);
|
|
21584
|
+
}
|
|
21585
|
+
this._timeouts = [];
|
|
21586
|
+
this._cachedTimeouts = null;
|
|
21587
|
+
};
|
|
21588
|
+
RetryOperation.prototype.retry = function(err) {
|
|
21589
|
+
if (this._timeout) {
|
|
21590
|
+
clearTimeout(this._timeout);
|
|
21591
|
+
}
|
|
21592
|
+
if (!err) {
|
|
21593
|
+
return false;
|
|
21594
|
+
}
|
|
21595
|
+
var currentTime = new Date().getTime();
|
|
21596
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
21597
|
+
this._errors.push(err);
|
|
21598
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
21599
|
+
return false;
|
|
21600
|
+
}
|
|
21601
|
+
this._errors.push(err);
|
|
21602
|
+
var timeout = this._timeouts.shift();
|
|
21603
|
+
if (timeout === undefined) {
|
|
21604
|
+
if (this._cachedTimeouts) {
|
|
21605
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
21606
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
21607
|
+
} else {
|
|
21608
|
+
return false;
|
|
21609
|
+
}
|
|
21610
|
+
}
|
|
21611
|
+
var self2 = this;
|
|
21612
|
+
this._timer = setTimeout(function() {
|
|
21613
|
+
self2._attempts++;
|
|
21614
|
+
if (self2._operationTimeoutCb) {
|
|
21615
|
+
self2._timeout = setTimeout(function() {
|
|
21616
|
+
self2._operationTimeoutCb(self2._attempts);
|
|
21617
|
+
}, self2._operationTimeout);
|
|
21618
|
+
if (self2._options.unref) {
|
|
21619
|
+
self2._timeout.unref();
|
|
21620
|
+
}
|
|
21621
|
+
}
|
|
21622
|
+
self2._fn(self2._attempts);
|
|
21623
|
+
}, timeout);
|
|
21624
|
+
if (this._options.unref) {
|
|
21625
|
+
this._timer.unref();
|
|
21626
|
+
}
|
|
21627
|
+
return true;
|
|
21628
|
+
};
|
|
21629
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
21630
|
+
this._fn = fn;
|
|
21631
|
+
if (timeoutOps) {
|
|
21632
|
+
if (timeoutOps.timeout) {
|
|
21633
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
21634
|
+
}
|
|
21635
|
+
if (timeoutOps.cb) {
|
|
21636
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
21637
|
+
}
|
|
21638
|
+
}
|
|
21639
|
+
var self2 = this;
|
|
21640
|
+
if (this._operationTimeoutCb) {
|
|
21641
|
+
this._timeout = setTimeout(function() {
|
|
21642
|
+
self2._operationTimeoutCb();
|
|
21643
|
+
}, self2._operationTimeout);
|
|
21644
|
+
}
|
|
21645
|
+
this._operationStart = new Date().getTime();
|
|
21646
|
+
this._fn(this._attempts);
|
|
21647
|
+
};
|
|
21648
|
+
RetryOperation.prototype.try = function(fn) {
|
|
21649
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
21650
|
+
this.attempt(fn);
|
|
21651
|
+
};
|
|
21652
|
+
RetryOperation.prototype.start = function(fn) {
|
|
21653
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
21654
|
+
this.attempt(fn);
|
|
21655
|
+
};
|
|
21656
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
21657
|
+
RetryOperation.prototype.errors = function() {
|
|
21658
|
+
return this._errors;
|
|
21659
|
+
};
|
|
21660
|
+
RetryOperation.prototype.attempts = function() {
|
|
21661
|
+
return this._attempts;
|
|
21662
|
+
};
|
|
21663
|
+
RetryOperation.prototype.mainError = function() {
|
|
21664
|
+
if (this._errors.length === 0) {
|
|
21665
|
+
return null;
|
|
21666
|
+
}
|
|
21667
|
+
var counts = {};
|
|
21668
|
+
var mainError = null;
|
|
21669
|
+
var mainErrorCount = 0;
|
|
21670
|
+
for (var i = 0;i < this._errors.length; i++) {
|
|
21671
|
+
var error = this._errors[i];
|
|
21672
|
+
var message = error.message;
|
|
21673
|
+
var count = (counts[message] || 0) + 1;
|
|
21674
|
+
counts[message] = count;
|
|
21675
|
+
if (count >= mainErrorCount) {
|
|
21676
|
+
mainError = error;
|
|
21677
|
+
mainErrorCount = count;
|
|
21678
|
+
}
|
|
21679
|
+
}
|
|
21680
|
+
return mainError;
|
|
21681
|
+
};
|
|
21682
|
+
});
|
|
21683
|
+
|
|
21684
|
+
// node_modules/retry/lib/retry.js
|
|
21685
|
+
var require_retry = __commonJS((exports) => {
|
|
21686
|
+
var RetryOperation = require_retry_operation();
|
|
21687
|
+
exports.operation = function(options3) {
|
|
21688
|
+
var timeouts = exports.timeouts(options3);
|
|
21689
|
+
return new RetryOperation(timeouts, {
|
|
21690
|
+
forever: options3 && (options3.forever || options3.retries === Infinity),
|
|
21691
|
+
unref: options3 && options3.unref,
|
|
21692
|
+
maxRetryTime: options3 && options3.maxRetryTime
|
|
21693
|
+
});
|
|
21694
|
+
};
|
|
21695
|
+
exports.timeouts = function(options3) {
|
|
21696
|
+
if (options3 instanceof Array) {
|
|
21697
|
+
return [].concat(options3);
|
|
21698
|
+
}
|
|
21699
|
+
var opts = {
|
|
21700
|
+
retries: 10,
|
|
21701
|
+
factor: 2,
|
|
21702
|
+
minTimeout: 1 * 1000,
|
|
21703
|
+
maxTimeout: Infinity,
|
|
21704
|
+
randomize: false
|
|
21705
|
+
};
|
|
21706
|
+
for (var key in options3) {
|
|
21707
|
+
opts[key] = options3[key];
|
|
21708
|
+
}
|
|
21709
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
21710
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
21711
|
+
}
|
|
21712
|
+
var timeouts = [];
|
|
21713
|
+
for (var i = 0;i < opts.retries; i++) {
|
|
21714
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
21715
|
+
}
|
|
21716
|
+
if (options3 && options3.forever && !timeouts.length) {
|
|
21717
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
21718
|
+
}
|
|
21719
|
+
timeouts.sort(function(a, b) {
|
|
21720
|
+
return a - b;
|
|
21721
|
+
});
|
|
21722
|
+
return timeouts;
|
|
21723
|
+
};
|
|
21724
|
+
exports.createTimeout = function(attempt, opts) {
|
|
21725
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
21726
|
+
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
21727
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
21728
|
+
return timeout;
|
|
21729
|
+
};
|
|
21730
|
+
exports.wrap = function(obj, options3, methods) {
|
|
21731
|
+
if (options3 instanceof Array) {
|
|
21732
|
+
methods = options3;
|
|
21733
|
+
options3 = null;
|
|
21734
|
+
}
|
|
21735
|
+
if (!methods) {
|
|
21736
|
+
methods = [];
|
|
21737
|
+
for (var key in obj) {
|
|
21738
|
+
if (typeof obj[key] === "function") {
|
|
21739
|
+
methods.push(key);
|
|
21740
|
+
}
|
|
21741
|
+
}
|
|
21742
|
+
}
|
|
21743
|
+
for (var i = 0;i < methods.length; i++) {
|
|
21744
|
+
var method = methods[i];
|
|
21745
|
+
var original = obj[method];
|
|
21746
|
+
obj[method] = function retryWrapper(original2) {
|
|
21747
|
+
var op = exports.operation(options3);
|
|
21748
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
21749
|
+
var callback = args.pop();
|
|
21750
|
+
args.push(function(err) {
|
|
21751
|
+
if (op.retry(err)) {
|
|
21752
|
+
return;
|
|
21753
|
+
}
|
|
21754
|
+
if (err) {
|
|
21755
|
+
arguments[0] = op.mainError();
|
|
21756
|
+
}
|
|
21757
|
+
callback.apply(this, arguments);
|
|
21758
|
+
});
|
|
21759
|
+
op.attempt(function() {
|
|
21760
|
+
original2.apply(obj, args);
|
|
21761
|
+
});
|
|
21762
|
+
}.bind(obj, original);
|
|
21763
|
+
obj[method].options = options3;
|
|
21764
|
+
}
|
|
21765
|
+
};
|
|
21766
|
+
});
|
|
21767
|
+
|
|
21551
21768
|
// node_modules/json2md/lib/converters.js
|
|
21552
21769
|
var require_converters = __commonJS((exports, module) => {
|
|
21553
21770
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
|
|
@@ -21879,223 +22096,6 @@ var require_lib2 = __commonJS((exports, module) => {
|
|
|
21879
22096
|
module.exports = json2md;
|
|
21880
22097
|
});
|
|
21881
22098
|
|
|
21882
|
-
// node_modules/retry/lib/retry_operation.js
|
|
21883
|
-
var require_retry_operation = __commonJS((exports, module) => {
|
|
21884
|
-
function RetryOperation(timeouts, options3) {
|
|
21885
|
-
if (typeof options3 === "boolean") {
|
|
21886
|
-
options3 = { forever: options3 };
|
|
21887
|
-
}
|
|
21888
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
21889
|
-
this._timeouts = timeouts;
|
|
21890
|
-
this._options = options3 || {};
|
|
21891
|
-
this._maxRetryTime = options3 && options3.maxRetryTime || Infinity;
|
|
21892
|
-
this._fn = null;
|
|
21893
|
-
this._errors = [];
|
|
21894
|
-
this._attempts = 1;
|
|
21895
|
-
this._operationTimeout = null;
|
|
21896
|
-
this._operationTimeoutCb = null;
|
|
21897
|
-
this._timeout = null;
|
|
21898
|
-
this._operationStart = null;
|
|
21899
|
-
this._timer = null;
|
|
21900
|
-
if (this._options.forever) {
|
|
21901
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
21902
|
-
}
|
|
21903
|
-
}
|
|
21904
|
-
module.exports = RetryOperation;
|
|
21905
|
-
RetryOperation.prototype.reset = function() {
|
|
21906
|
-
this._attempts = 1;
|
|
21907
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
21908
|
-
};
|
|
21909
|
-
RetryOperation.prototype.stop = function() {
|
|
21910
|
-
if (this._timeout) {
|
|
21911
|
-
clearTimeout(this._timeout);
|
|
21912
|
-
}
|
|
21913
|
-
if (this._timer) {
|
|
21914
|
-
clearTimeout(this._timer);
|
|
21915
|
-
}
|
|
21916
|
-
this._timeouts = [];
|
|
21917
|
-
this._cachedTimeouts = null;
|
|
21918
|
-
};
|
|
21919
|
-
RetryOperation.prototype.retry = function(err) {
|
|
21920
|
-
if (this._timeout) {
|
|
21921
|
-
clearTimeout(this._timeout);
|
|
21922
|
-
}
|
|
21923
|
-
if (!err) {
|
|
21924
|
-
return false;
|
|
21925
|
-
}
|
|
21926
|
-
var currentTime = new Date().getTime();
|
|
21927
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
21928
|
-
this._errors.push(err);
|
|
21929
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
21930
|
-
return false;
|
|
21931
|
-
}
|
|
21932
|
-
this._errors.push(err);
|
|
21933
|
-
var timeout = this._timeouts.shift();
|
|
21934
|
-
if (timeout === undefined) {
|
|
21935
|
-
if (this._cachedTimeouts) {
|
|
21936
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
21937
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
21938
|
-
} else {
|
|
21939
|
-
return false;
|
|
21940
|
-
}
|
|
21941
|
-
}
|
|
21942
|
-
var self2 = this;
|
|
21943
|
-
this._timer = setTimeout(function() {
|
|
21944
|
-
self2._attempts++;
|
|
21945
|
-
if (self2._operationTimeoutCb) {
|
|
21946
|
-
self2._timeout = setTimeout(function() {
|
|
21947
|
-
self2._operationTimeoutCb(self2._attempts);
|
|
21948
|
-
}, self2._operationTimeout);
|
|
21949
|
-
if (self2._options.unref) {
|
|
21950
|
-
self2._timeout.unref();
|
|
21951
|
-
}
|
|
21952
|
-
}
|
|
21953
|
-
self2._fn(self2._attempts);
|
|
21954
|
-
}, timeout);
|
|
21955
|
-
if (this._options.unref) {
|
|
21956
|
-
this._timer.unref();
|
|
21957
|
-
}
|
|
21958
|
-
return true;
|
|
21959
|
-
};
|
|
21960
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
21961
|
-
this._fn = fn;
|
|
21962
|
-
if (timeoutOps) {
|
|
21963
|
-
if (timeoutOps.timeout) {
|
|
21964
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
21965
|
-
}
|
|
21966
|
-
if (timeoutOps.cb) {
|
|
21967
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
21968
|
-
}
|
|
21969
|
-
}
|
|
21970
|
-
var self2 = this;
|
|
21971
|
-
if (this._operationTimeoutCb) {
|
|
21972
|
-
this._timeout = setTimeout(function() {
|
|
21973
|
-
self2._operationTimeoutCb();
|
|
21974
|
-
}, self2._operationTimeout);
|
|
21975
|
-
}
|
|
21976
|
-
this._operationStart = new Date().getTime();
|
|
21977
|
-
this._fn(this._attempts);
|
|
21978
|
-
};
|
|
21979
|
-
RetryOperation.prototype.try = function(fn) {
|
|
21980
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
21981
|
-
this.attempt(fn);
|
|
21982
|
-
};
|
|
21983
|
-
RetryOperation.prototype.start = function(fn) {
|
|
21984
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
21985
|
-
this.attempt(fn);
|
|
21986
|
-
};
|
|
21987
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
21988
|
-
RetryOperation.prototype.errors = function() {
|
|
21989
|
-
return this._errors;
|
|
21990
|
-
};
|
|
21991
|
-
RetryOperation.prototype.attempts = function() {
|
|
21992
|
-
return this._attempts;
|
|
21993
|
-
};
|
|
21994
|
-
RetryOperation.prototype.mainError = function() {
|
|
21995
|
-
if (this._errors.length === 0) {
|
|
21996
|
-
return null;
|
|
21997
|
-
}
|
|
21998
|
-
var counts = {};
|
|
21999
|
-
var mainError = null;
|
|
22000
|
-
var mainErrorCount = 0;
|
|
22001
|
-
for (var i = 0;i < this._errors.length; i++) {
|
|
22002
|
-
var error = this._errors[i];
|
|
22003
|
-
var message = error.message;
|
|
22004
|
-
var count = (counts[message] || 0) + 1;
|
|
22005
|
-
counts[message] = count;
|
|
22006
|
-
if (count >= mainErrorCount) {
|
|
22007
|
-
mainError = error;
|
|
22008
|
-
mainErrorCount = count;
|
|
22009
|
-
}
|
|
22010
|
-
}
|
|
22011
|
-
return mainError;
|
|
22012
|
-
};
|
|
22013
|
-
});
|
|
22014
|
-
|
|
22015
|
-
// node_modules/retry/lib/retry.js
|
|
22016
|
-
var require_retry = __commonJS((exports) => {
|
|
22017
|
-
var RetryOperation = require_retry_operation();
|
|
22018
|
-
exports.operation = function(options3) {
|
|
22019
|
-
var timeouts = exports.timeouts(options3);
|
|
22020
|
-
return new RetryOperation(timeouts, {
|
|
22021
|
-
forever: options3 && (options3.forever || options3.retries === Infinity),
|
|
22022
|
-
unref: options3 && options3.unref,
|
|
22023
|
-
maxRetryTime: options3 && options3.maxRetryTime
|
|
22024
|
-
});
|
|
22025
|
-
};
|
|
22026
|
-
exports.timeouts = function(options3) {
|
|
22027
|
-
if (options3 instanceof Array) {
|
|
22028
|
-
return [].concat(options3);
|
|
22029
|
-
}
|
|
22030
|
-
var opts = {
|
|
22031
|
-
retries: 10,
|
|
22032
|
-
factor: 2,
|
|
22033
|
-
minTimeout: 1 * 1000,
|
|
22034
|
-
maxTimeout: Infinity,
|
|
22035
|
-
randomize: false
|
|
22036
|
-
};
|
|
22037
|
-
for (var key in options3) {
|
|
22038
|
-
opts[key] = options3[key];
|
|
22039
|
-
}
|
|
22040
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
22041
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
22042
|
-
}
|
|
22043
|
-
var timeouts = [];
|
|
22044
|
-
for (var i = 0;i < opts.retries; i++) {
|
|
22045
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
22046
|
-
}
|
|
22047
|
-
if (options3 && options3.forever && !timeouts.length) {
|
|
22048
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
22049
|
-
}
|
|
22050
|
-
timeouts.sort(function(a, b) {
|
|
22051
|
-
return a - b;
|
|
22052
|
-
});
|
|
22053
|
-
return timeouts;
|
|
22054
|
-
};
|
|
22055
|
-
exports.createTimeout = function(attempt, opts) {
|
|
22056
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
22057
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
22058
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
22059
|
-
return timeout;
|
|
22060
|
-
};
|
|
22061
|
-
exports.wrap = function(obj, options3, methods) {
|
|
22062
|
-
if (options3 instanceof Array) {
|
|
22063
|
-
methods = options3;
|
|
22064
|
-
options3 = null;
|
|
22065
|
-
}
|
|
22066
|
-
if (!methods) {
|
|
22067
|
-
methods = [];
|
|
22068
|
-
for (var key in obj) {
|
|
22069
|
-
if (typeof obj[key] === "function") {
|
|
22070
|
-
methods.push(key);
|
|
22071
|
-
}
|
|
22072
|
-
}
|
|
22073
|
-
}
|
|
22074
|
-
for (var i = 0;i < methods.length; i++) {
|
|
22075
|
-
var method = methods[i];
|
|
22076
|
-
var original = obj[method];
|
|
22077
|
-
obj[method] = function retryWrapper(original2) {
|
|
22078
|
-
var op = exports.operation(options3);
|
|
22079
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
22080
|
-
var callback = args.pop();
|
|
22081
|
-
args.push(function(err) {
|
|
22082
|
-
if (op.retry(err)) {
|
|
22083
|
-
return;
|
|
22084
|
-
}
|
|
22085
|
-
if (err) {
|
|
22086
|
-
arguments[0] = op.mainError();
|
|
22087
|
-
}
|
|
22088
|
-
callback.apply(this, arguments);
|
|
22089
|
-
});
|
|
22090
|
-
op.attempt(function() {
|
|
22091
|
-
original2.apply(obj, args);
|
|
22092
|
-
});
|
|
22093
|
-
}.bind(obj, original);
|
|
22094
|
-
obj[method].options = options3;
|
|
22095
|
-
}
|
|
22096
|
-
};
|
|
22097
|
-
});
|
|
22098
|
-
|
|
22099
22099
|
// node:buffer
|
|
22100
22100
|
var exports_buffer = {};
|
|
22101
22101
|
__export(exports_buffer, {
|
|
@@ -29888,15 +29888,15 @@ var require_js2xml = __commonJS((exports, module) => {
|
|
|
29888
29888
|
if ("attributesFn" in options3) {
|
|
29889
29889
|
attributes = options3.attributesFn(attributes, currentElementName, currentElement);
|
|
29890
29890
|
}
|
|
29891
|
-
var key, attr, attrName,
|
|
29891
|
+
var key, attr, attrName, quote2, result = [];
|
|
29892
29892
|
for (key in attributes) {
|
|
29893
29893
|
if (attributes.hasOwnProperty(key) && attributes[key] !== null && attributes[key] !== undefined) {
|
|
29894
|
-
|
|
29894
|
+
quote2 = options3.noQuotesForNativeAttributes && typeof attributes[key] !== "string" ? "" : '"';
|
|
29895
29895
|
attr = "" + attributes[key];
|
|
29896
29896
|
attr = attr.replace(/"/g, """);
|
|
29897
29897
|
attrName = "attributeNameFn" in options3 ? options3.attributeNameFn(key, attr, currentElementName, currentElement) : key;
|
|
29898
29898
|
result.push(options3.spaces && options3.indentAttributes ? writeIndentation(options3, depth + 1, false) : " ");
|
|
29899
|
-
result.push(attrName + "=" +
|
|
29899
|
+
result.push(attrName + "=" + quote2 + ("attributeValueFn" in options3 ? options3.attributeValueFn(attr, key, currentElementName, currentElement) : attr) + quote2);
|
|
29900
29900
|
}
|
|
29901
29901
|
}
|
|
29902
29902
|
if (attributes && Object.keys(attributes).length && options3.spaces && options3.indentAttributes) {
|
|
@@ -30350,7 +30350,7 @@ var require_object_inspect = __commonJS((exports, module) => {
|
|
|
30350
30350
|
var s2 = "<" + $toLowerCase.call(String(obj.nodeName));
|
|
30351
30351
|
var attrs = obj.attributes || [];
|
|
30352
30352
|
for (var i2 = 0;i2 < attrs.length; i2++) {
|
|
30353
|
-
s2 += " " + attrs[i2].name + "=" + wrapQuotes(
|
|
30353
|
+
s2 += " " + attrs[i2].name + "=" + wrapQuotes(quote2(attrs[i2].value), "double", opts);
|
|
30354
30354
|
}
|
|
30355
30355
|
s2 += ">";
|
|
30356
30356
|
if (obj.childNodes && obj.childNodes.length) {
|
|
@@ -30453,7 +30453,7 @@ var require_object_inspect = __commonJS((exports, module) => {
|
|
|
30453
30453
|
var quoteChar = quotes[style];
|
|
30454
30454
|
return quoteChar + s2 + quoteChar;
|
|
30455
30455
|
}
|
|
30456
|
-
function
|
|
30456
|
+
function quote2(s2) {
|
|
30457
30457
|
return $replace.call(String(s2), /"/g, """);
|
|
30458
30458
|
}
|
|
30459
30459
|
function canTrustToString(obj) {
|
|
@@ -31382,7 +31382,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
31382
31382
|
var $replace = bind.call($call, String.prototype.replace);
|
|
31383
31383
|
var $strSlice = bind.call($call, String.prototype.slice);
|
|
31384
31384
|
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
31385
|
-
var
|
|
31385
|
+
var rePropName3 = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
31386
31386
|
var reEscapeChar2 = /\\(\\)?/g;
|
|
31387
31387
|
var stringToPath2 = function stringToPath(string) {
|
|
31388
31388
|
var first = $strSlice(string, 0, 1);
|
|
@@ -31393,8 +31393,8 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
31393
31393
|
throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
|
|
31394
31394
|
}
|
|
31395
31395
|
var result = [];
|
|
31396
|
-
$replace(string,
|
|
31397
|
-
result[result.length] =
|
|
31396
|
+
$replace(string, rePropName3, function(match2, number, quote2, subString) {
|
|
31397
|
+
result[result.length] = quote2 ? $replace(subString, reEscapeChar2, "$1") : number || match2;
|
|
31398
31398
|
});
|
|
31399
31399
|
return result;
|
|
31400
31400
|
};
|
|
@@ -31766,9 +31766,9 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
31766
31766
|
return acc;
|
|
31767
31767
|
}, target);
|
|
31768
31768
|
};
|
|
31769
|
-
var decode = function(str, defaultDecoder,
|
|
31769
|
+
var decode = function(str, defaultDecoder, charset2) {
|
|
31770
31770
|
var strWithoutPlus = str.replace(/\+/g, " ");
|
|
31771
|
-
if (
|
|
31771
|
+
if (charset2 === "iso-8859-1") {
|
|
31772
31772
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
31773
31773
|
}
|
|
31774
31774
|
try {
|
|
@@ -31778,7 +31778,7 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
31778
31778
|
}
|
|
31779
31779
|
};
|
|
31780
31780
|
var limit = 1024;
|
|
31781
|
-
var encode = function encode(str, defaultEncoder,
|
|
31781
|
+
var encode = function encode(str, defaultEncoder, charset2, kind, format) {
|
|
31782
31782
|
if (str.length === 0) {
|
|
31783
31783
|
return str;
|
|
31784
31784
|
}
|
|
@@ -31788,7 +31788,7 @@ var require_utils2 = __commonJS((exports, module) => {
|
|
|
31788
31788
|
} else if (typeof str !== "string") {
|
|
31789
31789
|
string = String(str);
|
|
31790
31790
|
}
|
|
31791
|
-
if (
|
|
31791
|
+
if (charset2 === "iso-8859-1") {
|
|
31792
31792
|
return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
|
|
31793
31793
|
return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
|
|
31794
31794
|
});
|
|
@@ -31930,7 +31930,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
31930
31930
|
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
31931
31931
|
};
|
|
31932
31932
|
var sentinel = {};
|
|
31933
|
-
var stringify = function stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly,
|
|
31933
|
+
var stringify = function stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset2, sideChannel) {
|
|
31934
31934
|
var obj = object;
|
|
31935
31935
|
var tmpSc = sideChannel;
|
|
31936
31936
|
var step = 0;
|
|
@@ -31963,14 +31963,14 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
31963
31963
|
}
|
|
31964
31964
|
if (obj === null) {
|
|
31965
31965
|
if (strictNullHandling) {
|
|
31966
|
-
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder,
|
|
31966
|
+
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset2, "key", format) : prefix;
|
|
31967
31967
|
}
|
|
31968
31968
|
obj = "";
|
|
31969
31969
|
}
|
|
31970
31970
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
31971
31971
|
if (encoder) {
|
|
31972
|
-
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder,
|
|
31973
|
-
return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder,
|
|
31972
|
+
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset2, "key", format);
|
|
31973
|
+
return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset2, "value", format))];
|
|
31974
31974
|
}
|
|
31975
31975
|
return [formatter(prefix) + "=" + formatter(String(obj))];
|
|
31976
31976
|
}
|
|
@@ -32006,7 +32006,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
32006
32006
|
sideChannel.set(object, step);
|
|
32007
32007
|
var valueSideChannel = getSideChannel();
|
|
32008
32008
|
valueSideChannel.set(sentinel, sideChannel);
|
|
32009
|
-
pushToArray(values2, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray3(obj) ? null : encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly,
|
|
32009
|
+
pushToArray(values2, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray3(obj) ? null : encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset2, valueSideChannel));
|
|
32010
32010
|
}
|
|
32011
32011
|
return values2;
|
|
32012
32012
|
};
|
|
@@ -32023,7 +32023,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
32023
32023
|
if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
|
|
32024
32024
|
throw new TypeError("Encoder has to be a function.");
|
|
32025
32025
|
}
|
|
32026
|
-
var
|
|
32026
|
+
var charset2 = opts.charset || defaults.charset;
|
|
32027
32027
|
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
32028
32028
|
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
32029
32029
|
}
|
|
@@ -32056,7 +32056,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
32056
32056
|
allowDots,
|
|
32057
32057
|
allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
32058
32058
|
arrayFormat,
|
|
32059
|
-
charset,
|
|
32059
|
+
charset: charset2,
|
|
32060
32060
|
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
32061
32061
|
commaRoundTrip: !!opts.commaRoundTrip,
|
|
32062
32062
|
delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
|
|
@@ -32174,14 +32174,14 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
32174
32174
|
}
|
|
32175
32175
|
var skipIndex = -1;
|
|
32176
32176
|
var i2;
|
|
32177
|
-
var
|
|
32177
|
+
var charset2 = options3.charset;
|
|
32178
32178
|
if (options3.charsetSentinel) {
|
|
32179
32179
|
for (i2 = 0;i2 < parts.length; ++i2) {
|
|
32180
32180
|
if (parts[i2].indexOf("utf8=") === 0) {
|
|
32181
32181
|
if (parts[i2] === charsetSentinel) {
|
|
32182
|
-
|
|
32182
|
+
charset2 = "utf-8";
|
|
32183
32183
|
} else if (parts[i2] === isoSentinel) {
|
|
32184
|
-
|
|
32184
|
+
charset2 = "iso-8859-1";
|
|
32185
32185
|
}
|
|
32186
32186
|
skipIndex = i2;
|
|
32187
32187
|
i2 = parts.length;
|
|
@@ -32198,15 +32198,15 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
32198
32198
|
var key;
|
|
32199
32199
|
var val;
|
|
32200
32200
|
if (pos === -1) {
|
|
32201
|
-
key = options3.decoder(part, defaults.decoder,
|
|
32201
|
+
key = options3.decoder(part, defaults.decoder, charset2, "key");
|
|
32202
32202
|
val = options3.strictNullHandling ? null : "";
|
|
32203
32203
|
} else {
|
|
32204
|
-
key = options3.decoder(part.slice(0, pos), defaults.decoder,
|
|
32204
|
+
key = options3.decoder(part.slice(0, pos), defaults.decoder, charset2, "key");
|
|
32205
32205
|
val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options3, isArray3(obj[key]) ? obj[key].length : 0), function(encodedVal) {
|
|
32206
|
-
return options3.decoder(encodedVal, defaults.decoder,
|
|
32206
|
+
return options3.decoder(encodedVal, defaults.decoder, charset2, "value");
|
|
32207
32207
|
});
|
|
32208
32208
|
}
|
|
32209
|
-
if (val && options3.interpretNumericEntities &&
|
|
32209
|
+
if (val && options3.interpretNumericEntities && charset2 === "iso-8859-1") {
|
|
32210
32210
|
val = interpretNumericEntities(String(val));
|
|
32211
32211
|
}
|
|
32212
32212
|
if (part.indexOf("[]=") > -1) {
|
|
@@ -32306,7 +32306,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
32306
32306
|
if (typeof opts.throwOnLimitExceeded !== "undefined" && typeof opts.throwOnLimitExceeded !== "boolean") {
|
|
32307
32307
|
throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
|
|
32308
32308
|
}
|
|
32309
|
-
var
|
|
32309
|
+
var charset2 = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
|
|
32310
32310
|
var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
|
|
32311
32311
|
if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
|
|
32312
32312
|
throw new TypeError("The duplicates option must be either combine, first, or last");
|
|
@@ -32318,7 +32318,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
32318
32318
|
allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
32319
32319
|
allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
|
|
32320
32320
|
arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit,
|
|
32321
|
-
charset,
|
|
32321
|
+
charset: charset2,
|
|
32322
32322
|
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
32323
32323
|
comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
|
|
32324
32324
|
decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
|
|
@@ -40573,7 +40573,7 @@ var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?
|
|
|
40573
40573
|
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
40574
40574
|
var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
40575
40575
|
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
40576
|
-
var html = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[
|
|
40576
|
+
var html = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
40577
40577
|
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
40578
40578
|
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
40579
40579
|
var blockNormal = {
|
|
@@ -40591,7 +40591,7 @@ var blockNormal = {
|
|
|
40591
40591
|
table: noopTest,
|
|
40592
40592
|
text: blockText
|
|
40593
40593
|
};
|
|
40594
|
-
var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}
|
|
40594
|
+
var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
40595
40595
|
var blockGfm = {
|
|
40596
40596
|
...blockNormal,
|
|
40597
40597
|
lheading: lheadingGfm,
|
|
@@ -43747,7 +43747,7 @@ var def2 = edit2(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +
|
|
|
43747
43747
|
var list2 = edit2(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet2).getRegex();
|
|
43748
43748
|
var _tag2 = "address|article|aside|base|basefont|blockquote|body|caption" + "|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption" + "|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe" + "|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option" + "|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title" + "|tr|track|ul";
|
|
43749
43749
|
var _comment2 = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
43750
|
-
var html2 = edit2("^ {0,3}(?:" + "<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)" + "|comment[^\\n]*(\\n+|$)" + "|<\\?[\\s\\S]*?(?:\\?>\\n*|$)" + "|<![A-Z][\\s\\S]*?(?:>\\n*|$)" + "|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)" + "|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[
|
|
43750
|
+
var html2 = edit2("^ {0,3}(?:" + "<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)" + "|comment[^\\n]*(\\n+|$)" + "|<\\?[\\s\\S]*?(?:\\?>\\n*|$)" + "|<![A-Z][\\s\\S]*?(?:>\\n*|$)" + "|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)" + "|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + "|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + "|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)" + ")", "i").replace("comment", _comment2).replace("tag", _tag2).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
43751
43751
|
var paragraph2 = edit2(_paragraph2).replace("hr", hr2).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag2).getRegex();
|
|
43752
43752
|
var blockquote2 = edit2(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph2).getRegex();
|
|
43753
43753
|
var blockNormal2 = {
|
|
@@ -43765,7 +43765,7 @@ var blockNormal2 = {
|
|
|
43765
43765
|
table: noopTest2,
|
|
43766
43766
|
text: blockText2
|
|
43767
43767
|
};
|
|
43768
|
-
var gfmTable2 = edit2("^ *([^\\n ].*)\\n" + " {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)" + "(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr2).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}
|
|
43768
|
+
var gfmTable2 = edit2("^ *([^\\n ].*)\\n" + " {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)" + "(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr2).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag2).getRegex();
|
|
43769
43769
|
var blockGfm2 = {
|
|
43770
43770
|
...blockNormal2,
|
|
43771
43771
|
table: gfmTable2,
|
|
@@ -45570,6 +45570,195 @@ var convertMarkdownToSlack = (text) => {
|
|
|
45570
45570
|
};
|
|
45571
45571
|
var convertMarkdownToSlack_default = convertMarkdownToSlack;
|
|
45572
45572
|
|
|
45573
|
+
// node_modules/p-retry/index.js
|
|
45574
|
+
var import_retry = __toESM(require_retry(), 1);
|
|
45575
|
+
|
|
45576
|
+
// node_modules/is-network-error/index.js
|
|
45577
|
+
var objectToString2 = Object.prototype.toString;
|
|
45578
|
+
var isError = (value) => objectToString2.call(value) === "[object Error]";
|
|
45579
|
+
var errorMessages = new Set([
|
|
45580
|
+
"network error",
|
|
45581
|
+
"Failed to fetch",
|
|
45582
|
+
"NetworkError when attempting to fetch resource.",
|
|
45583
|
+
"The Internet connection appears to be offline.",
|
|
45584
|
+
"Load failed",
|
|
45585
|
+
"Network request failed",
|
|
45586
|
+
"fetch failed",
|
|
45587
|
+
"terminated"
|
|
45588
|
+
]);
|
|
45589
|
+
function isNetworkError(error) {
|
|
45590
|
+
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
45591
|
+
if (!isValid) {
|
|
45592
|
+
return false;
|
|
45593
|
+
}
|
|
45594
|
+
if (error.message === "Load failed") {
|
|
45595
|
+
return error.stack === undefined;
|
|
45596
|
+
}
|
|
45597
|
+
return errorMessages.has(error.message);
|
|
45598
|
+
}
|
|
45599
|
+
|
|
45600
|
+
// node_modules/p-retry/index.js
|
|
45601
|
+
class AbortError extends Error {
|
|
45602
|
+
constructor(message) {
|
|
45603
|
+
super();
|
|
45604
|
+
if (message instanceof Error) {
|
|
45605
|
+
this.originalError = message;
|
|
45606
|
+
({ message } = message);
|
|
45607
|
+
} else {
|
|
45608
|
+
this.originalError = new Error(message);
|
|
45609
|
+
this.originalError.stack = this.stack;
|
|
45610
|
+
}
|
|
45611
|
+
this.name = "AbortError";
|
|
45612
|
+
this.message = message;
|
|
45613
|
+
}
|
|
45614
|
+
}
|
|
45615
|
+
var decorateErrorWithCounts = (error, attemptNumber, options3) => {
|
|
45616
|
+
const retriesLeft = options3.retries - (attemptNumber - 1);
|
|
45617
|
+
error.attemptNumber = attemptNumber;
|
|
45618
|
+
error.retriesLeft = retriesLeft;
|
|
45619
|
+
return error;
|
|
45620
|
+
};
|
|
45621
|
+
async function pRetry(input, options3) {
|
|
45622
|
+
return new Promise((resolve, reject2) => {
|
|
45623
|
+
options3 = { ...options3 };
|
|
45624
|
+
options3.onFailedAttempt ??= () => {};
|
|
45625
|
+
options3.shouldRetry ??= () => true;
|
|
45626
|
+
options3.retries ??= 10;
|
|
45627
|
+
const operation = import_retry.default.operation(options3);
|
|
45628
|
+
const abortHandler = () => {
|
|
45629
|
+
operation.stop();
|
|
45630
|
+
reject2(options3.signal?.reason);
|
|
45631
|
+
};
|
|
45632
|
+
if (options3.signal && !options3.signal.aborted) {
|
|
45633
|
+
options3.signal.addEventListener("abort", abortHandler, { once: true });
|
|
45634
|
+
}
|
|
45635
|
+
const cleanUp = () => {
|
|
45636
|
+
options3.signal?.removeEventListener("abort", abortHandler);
|
|
45637
|
+
operation.stop();
|
|
45638
|
+
};
|
|
45639
|
+
operation.attempt(async (attemptNumber) => {
|
|
45640
|
+
try {
|
|
45641
|
+
const result = await input(attemptNumber);
|
|
45642
|
+
cleanUp();
|
|
45643
|
+
resolve(result);
|
|
45644
|
+
} catch (error) {
|
|
45645
|
+
try {
|
|
45646
|
+
if (!(error instanceof Error)) {
|
|
45647
|
+
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
45648
|
+
}
|
|
45649
|
+
if (error instanceof AbortError) {
|
|
45650
|
+
throw error.originalError;
|
|
45651
|
+
}
|
|
45652
|
+
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
45653
|
+
throw error;
|
|
45654
|
+
}
|
|
45655
|
+
decorateErrorWithCounts(error, attemptNumber, options3);
|
|
45656
|
+
if (!await options3.shouldRetry(error)) {
|
|
45657
|
+
operation.stop();
|
|
45658
|
+
reject2(error);
|
|
45659
|
+
}
|
|
45660
|
+
await options3.onFailedAttempt(error);
|
|
45661
|
+
if (!operation.retry(error)) {
|
|
45662
|
+
throw operation.mainError();
|
|
45663
|
+
}
|
|
45664
|
+
} catch (finalError) {
|
|
45665
|
+
decorateErrorWithCounts(finalError, attemptNumber, options3);
|
|
45666
|
+
cleanUp();
|
|
45667
|
+
reject2(finalError);
|
|
45668
|
+
}
|
|
45669
|
+
}
|
|
45670
|
+
});
|
|
45671
|
+
});
|
|
45672
|
+
}
|
|
45673
|
+
|
|
45674
|
+
// src/functions/convertMdToPdf.ts
|
|
45675
|
+
function getFilenameFromHeaders(resp, fallback) {
|
|
45676
|
+
const cd = resp.headers.get("content-disposition") || "";
|
|
45677
|
+
const matchStar = cd.match(/filename\*=([^;]+)/i);
|
|
45678
|
+
if (matchStar) {
|
|
45679
|
+
const value = trim_default(matchStar[1]);
|
|
45680
|
+
const parts = split_default(value, "''");
|
|
45681
|
+
if (parts.length === 2) {
|
|
45682
|
+
try {
|
|
45683
|
+
return decodeURIComponent(parts[1]);
|
|
45684
|
+
} catch {
|
|
45685
|
+
return parts[1];
|
|
45686
|
+
}
|
|
45687
|
+
}
|
|
45688
|
+
return trim_default(value, `'"`);
|
|
45689
|
+
}
|
|
45690
|
+
const match = cd.match(/filename="?([^";]+)"?/i);
|
|
45691
|
+
if (match)
|
|
45692
|
+
return match[1];
|
|
45693
|
+
return fallback || "document.pdf";
|
|
45694
|
+
}
|
|
45695
|
+
async function convertMdToPdf(markdown, options3 = {}, assetHeaders = {}) {
|
|
45696
|
+
const documentParserApiUrl = this.environment.lookup("documentParserApiUrl");
|
|
45697
|
+
const documentParserApiKey = this.environment.lookup("documentParserApiKey");
|
|
45698
|
+
if (!documentParserApiKey) {
|
|
45699
|
+
throw new Error("Document parser API key not found in environment");
|
|
45700
|
+
}
|
|
45701
|
+
if (!documentParserApiUrl) {
|
|
45702
|
+
throw new Error("Document parser API URL not found in environment");
|
|
45703
|
+
}
|
|
45704
|
+
if (!markdown || typeof markdown !== "string") {
|
|
45705
|
+
throw new AbortError("Markdown content is required and must be a string");
|
|
45706
|
+
}
|
|
45707
|
+
const requestBody = {
|
|
45708
|
+
markdown,
|
|
45709
|
+
options: options3,
|
|
45710
|
+
assetHeaders
|
|
45711
|
+
};
|
|
45712
|
+
return await pRetry(async () => {
|
|
45713
|
+
const response = await fetch(`${documentParserApiUrl}/md-to-pdf`, {
|
|
45714
|
+
method: "POST",
|
|
45715
|
+
headers: {
|
|
45716
|
+
Authorization: `Bearer ${documentParserApiKey}`,
|
|
45717
|
+
"Content-Type": "application/json",
|
|
45718
|
+
Accept: "application/pdf",
|
|
45719
|
+
"User-Agent": "truto"
|
|
45720
|
+
},
|
|
45721
|
+
body: JSON.stringify(requestBody)
|
|
45722
|
+
});
|
|
45723
|
+
if (!response.ok) {
|
|
45724
|
+
if (response.status === 429) {
|
|
45725
|
+
throw new Error("Rate limit exceeded");
|
|
45726
|
+
}
|
|
45727
|
+
if (response.status >= 500) {
|
|
45728
|
+
throw new Error(`Server error: ${response.status}`);
|
|
45729
|
+
}
|
|
45730
|
+
const errorText = await response.text();
|
|
45731
|
+
let errorMessage = `PDF conversion failed (${response.status})`;
|
|
45732
|
+
try {
|
|
45733
|
+
const errorData = JSON.parse(errorText);
|
|
45734
|
+
errorMessage = errorData.error || errorMessage;
|
|
45735
|
+
if (errorData.details) {
|
|
45736
|
+
errorMessage += `: ${errorData.details}`;
|
|
45737
|
+
}
|
|
45738
|
+
} catch {
|
|
45739
|
+
errorMessage += `: ${errorText}`;
|
|
45740
|
+
}
|
|
45741
|
+
throw new AbortError(errorMessage);
|
|
45742
|
+
}
|
|
45743
|
+
const contentType = response.headers.get("content-type");
|
|
45744
|
+
if (!contentType || !includes_default(contentType, "application/pdf")) {
|
|
45745
|
+
throw new AbortError(`Expected PDF but received: ${contentType}`);
|
|
45746
|
+
}
|
|
45747
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
45748
|
+
const filename = getFilenameFromHeaders(response, options3.filename);
|
|
45749
|
+
const blob2 = new Blob([arrayBuffer], { type: "application/pdf" });
|
|
45750
|
+
blob2.name = filename;
|
|
45751
|
+
return blob2;
|
|
45752
|
+
}, {
|
|
45753
|
+
retries: 5,
|
|
45754
|
+
maxTimeout: 30000,
|
|
45755
|
+
minTimeout: 2500,
|
|
45756
|
+
onFailedAttempt: (error) => {
|
|
45757
|
+
console.warn(`PDF conversion attempt ${error.attemptNumber} failed:`, error.message);
|
|
45758
|
+
}
|
|
45759
|
+
});
|
|
45760
|
+
}
|
|
45761
|
+
|
|
45573
45762
|
// src/functions/convertNotionToMarkdown.ts
|
|
45574
45763
|
var formatPlainText = (x) => {
|
|
45575
45764
|
if (x) {
|
|
@@ -50453,17 +50642,17 @@ var digest = async (text, algorithm = "SHA-256", stringType = "hex") => {
|
|
|
50453
50642
|
var digest_default = digest;
|
|
50454
50643
|
|
|
50455
50644
|
// src/functions/dtFromFormat.ts
|
|
50456
|
-
function dtFromFormat(date, format) {
|
|
50645
|
+
function dtFromFormat(date, format, options3) {
|
|
50457
50646
|
if (format === "RFC2822") {
|
|
50458
|
-
return DateTime.fromRFC2822(date);
|
|
50647
|
+
return DateTime.fromRFC2822(date, options3);
|
|
50459
50648
|
}
|
|
50460
50649
|
if (format === "ISO") {
|
|
50461
|
-
return DateTime.fromISO(date);
|
|
50650
|
+
return DateTime.fromISO(date, options3);
|
|
50462
50651
|
}
|
|
50463
50652
|
if (format === "fromSeconds") {
|
|
50464
|
-
return DateTime.fromSeconds(parseInt(date));
|
|
50653
|
+
return DateTime.fromSeconds(parseInt(date), options3);
|
|
50465
50654
|
}
|
|
50466
|
-
return DateTime.fromFormat(date, format);
|
|
50655
|
+
return DateTime.fromFormat(date, format, options3);
|
|
50467
50656
|
}
|
|
50468
50657
|
var dtFromFormat_default = dtFromFormat;
|
|
50469
50658
|
|
|
@@ -50606,107 +50795,6 @@ async function pMap(iterable, mapper, {
|
|
|
50606
50795
|
}
|
|
50607
50796
|
var pMapSkip = Symbol("skip");
|
|
50608
50797
|
|
|
50609
|
-
// node_modules/p-retry/index.js
|
|
50610
|
-
var import_retry = __toESM(require_retry(), 1);
|
|
50611
|
-
|
|
50612
|
-
// node_modules/is-network-error/index.js
|
|
50613
|
-
var objectToString2 = Object.prototype.toString;
|
|
50614
|
-
var isError = (value) => objectToString2.call(value) === "[object Error]";
|
|
50615
|
-
var errorMessages = new Set([
|
|
50616
|
-
"network error",
|
|
50617
|
-
"Failed to fetch",
|
|
50618
|
-
"NetworkError when attempting to fetch resource.",
|
|
50619
|
-
"The Internet connection appears to be offline.",
|
|
50620
|
-
"Load failed",
|
|
50621
|
-
"Network request failed",
|
|
50622
|
-
"fetch failed",
|
|
50623
|
-
"terminated"
|
|
50624
|
-
]);
|
|
50625
|
-
function isNetworkError(error) {
|
|
50626
|
-
const isValid = error && isError(error) && error.name === "TypeError" && typeof error.message === "string";
|
|
50627
|
-
if (!isValid) {
|
|
50628
|
-
return false;
|
|
50629
|
-
}
|
|
50630
|
-
if (error.message === "Load failed") {
|
|
50631
|
-
return error.stack === undefined;
|
|
50632
|
-
}
|
|
50633
|
-
return errorMessages.has(error.message);
|
|
50634
|
-
}
|
|
50635
|
-
|
|
50636
|
-
// node_modules/p-retry/index.js
|
|
50637
|
-
class AbortError extends Error {
|
|
50638
|
-
constructor(message) {
|
|
50639
|
-
super();
|
|
50640
|
-
if (message instanceof Error) {
|
|
50641
|
-
this.originalError = message;
|
|
50642
|
-
({ message } = message);
|
|
50643
|
-
} else {
|
|
50644
|
-
this.originalError = new Error(message);
|
|
50645
|
-
this.originalError.stack = this.stack;
|
|
50646
|
-
}
|
|
50647
|
-
this.name = "AbortError";
|
|
50648
|
-
this.message = message;
|
|
50649
|
-
}
|
|
50650
|
-
}
|
|
50651
|
-
var decorateErrorWithCounts = (error, attemptNumber, options3) => {
|
|
50652
|
-
const retriesLeft = options3.retries - (attemptNumber - 1);
|
|
50653
|
-
error.attemptNumber = attemptNumber;
|
|
50654
|
-
error.retriesLeft = retriesLeft;
|
|
50655
|
-
return error;
|
|
50656
|
-
};
|
|
50657
|
-
async function pRetry(input, options3) {
|
|
50658
|
-
return new Promise((resolve, reject2) => {
|
|
50659
|
-
options3 = { ...options3 };
|
|
50660
|
-
options3.onFailedAttempt ??= () => {};
|
|
50661
|
-
options3.shouldRetry ??= () => true;
|
|
50662
|
-
options3.retries ??= 10;
|
|
50663
|
-
const operation = import_retry.default.operation(options3);
|
|
50664
|
-
const abortHandler = () => {
|
|
50665
|
-
operation.stop();
|
|
50666
|
-
reject2(options3.signal?.reason);
|
|
50667
|
-
};
|
|
50668
|
-
if (options3.signal && !options3.signal.aborted) {
|
|
50669
|
-
options3.signal.addEventListener("abort", abortHandler, { once: true });
|
|
50670
|
-
}
|
|
50671
|
-
const cleanUp = () => {
|
|
50672
|
-
options3.signal?.removeEventListener("abort", abortHandler);
|
|
50673
|
-
operation.stop();
|
|
50674
|
-
};
|
|
50675
|
-
operation.attempt(async (attemptNumber) => {
|
|
50676
|
-
try {
|
|
50677
|
-
const result = await input(attemptNumber);
|
|
50678
|
-
cleanUp();
|
|
50679
|
-
resolve(result);
|
|
50680
|
-
} catch (error) {
|
|
50681
|
-
try {
|
|
50682
|
-
if (!(error instanceof Error)) {
|
|
50683
|
-
throw new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`);
|
|
50684
|
-
}
|
|
50685
|
-
if (error instanceof AbortError) {
|
|
50686
|
-
throw error.originalError;
|
|
50687
|
-
}
|
|
50688
|
-
if (error instanceof TypeError && !isNetworkError(error)) {
|
|
50689
|
-
throw error;
|
|
50690
|
-
}
|
|
50691
|
-
decorateErrorWithCounts(error, attemptNumber, options3);
|
|
50692
|
-
if (!await options3.shouldRetry(error)) {
|
|
50693
|
-
operation.stop();
|
|
50694
|
-
reject2(error);
|
|
50695
|
-
}
|
|
50696
|
-
await options3.onFailedAttempt(error);
|
|
50697
|
-
if (!operation.retry(error)) {
|
|
50698
|
-
throw operation.mainError();
|
|
50699
|
-
}
|
|
50700
|
-
} catch (finalError) {
|
|
50701
|
-
decorateErrorWithCounts(finalError, attemptNumber, options3);
|
|
50702
|
-
cleanUp();
|
|
50703
|
-
reject2(finalError);
|
|
50704
|
-
}
|
|
50705
|
-
}
|
|
50706
|
-
});
|
|
50707
|
-
});
|
|
50708
|
-
}
|
|
50709
|
-
|
|
50710
50798
|
// src/functions/generateEmbeddingsCohere.ts
|
|
50711
50799
|
async function generateEmbeddingsCohere(body, api_key) {
|
|
50712
50800
|
if (!isEmpty_default(body.texts)) {
|
|
@@ -50915,6 +51003,445 @@ function jsonParse(str) {
|
|
|
50915
51003
|
}
|
|
50916
51004
|
var jsonParse_default = jsonParse;
|
|
50917
51005
|
|
|
51006
|
+
// node_modules/@json2csv/formatters/dist/mjs/default.js
|
|
51007
|
+
function defaultFormatter(value) {
|
|
51008
|
+
if (value === null || value === undefined)
|
|
51009
|
+
return "";
|
|
51010
|
+
return `${value}`;
|
|
51011
|
+
}
|
|
51012
|
+
// node_modules/@json2csv/formatters/dist/mjs/number.js
|
|
51013
|
+
function numberFormatter(opts = {}) {
|
|
51014
|
+
const { separator, decimals } = opts;
|
|
51015
|
+
if (separator) {
|
|
51016
|
+
if (decimals) {
|
|
51017
|
+
return (value) => value.toFixed(decimals).replace(".", separator);
|
|
51018
|
+
}
|
|
51019
|
+
return (value) => `${value}`.replace(".", separator);
|
|
51020
|
+
}
|
|
51021
|
+
if (decimals) {
|
|
51022
|
+
return (value) => value.toFixed(decimals);
|
|
51023
|
+
}
|
|
51024
|
+
return (value) => `${value}`;
|
|
51025
|
+
}
|
|
51026
|
+
// node_modules/@json2csv/formatters/dist/mjs/string.js
|
|
51027
|
+
function stringFormatter(opts = {}) {
|
|
51028
|
+
const quote = typeof opts.quote === "string" ? opts.quote : '"';
|
|
51029
|
+
const escapedQuote = typeof opts.escapedQuote === "string" ? opts.escapedQuote : `${quote}${quote}`;
|
|
51030
|
+
if (!quote || quote === escapedQuote) {
|
|
51031
|
+
return (value) => value;
|
|
51032
|
+
}
|
|
51033
|
+
const quoteRegExp = new RegExp(quote, "g");
|
|
51034
|
+
return (value) => {
|
|
51035
|
+
if (value.includes(quote)) {
|
|
51036
|
+
value = value.replace(quoteRegExp, escapedQuote);
|
|
51037
|
+
}
|
|
51038
|
+
return `${quote}${value}${quote}`;
|
|
51039
|
+
};
|
|
51040
|
+
}
|
|
51041
|
+
// node_modules/@json2csv/formatters/dist/mjs/stringExcel.js
|
|
51042
|
+
var quote = '"';
|
|
51043
|
+
var quoteRegExp = new RegExp(quote, "g");
|
|
51044
|
+
// node_modules/@json2csv/formatters/dist/mjs/symbol.js
|
|
51045
|
+
function symbolFormatter(opts = { stringFormatter: stringFormatter() }) {
|
|
51046
|
+
return (value) => opts.stringFormatter(value.toString().slice(7, -1));
|
|
51047
|
+
}
|
|
51048
|
+
// node_modules/@json2csv/formatters/dist/mjs/object.js
|
|
51049
|
+
function objectFormatter(opts = { stringFormatter: stringFormatter() }) {
|
|
51050
|
+
return (value) => {
|
|
51051
|
+
if (value === null)
|
|
51052
|
+
return "";
|
|
51053
|
+
let stringifiedValue = JSON.stringify(value);
|
|
51054
|
+
if (stringifiedValue === undefined)
|
|
51055
|
+
return "";
|
|
51056
|
+
if (stringifiedValue[0] === '"')
|
|
51057
|
+
stringifiedValue = stringifiedValue.replace(/^"(.+)"$/, "$1");
|
|
51058
|
+
return opts.stringFormatter(stringifiedValue);
|
|
51059
|
+
};
|
|
51060
|
+
}
|
|
51061
|
+
// node_modules/@json2csv/plainjs/dist/mjs/utils.js
|
|
51062
|
+
var rePropName2 = RegExp("[^.[\\]]+" + "|" + "\\[(?:" + `([^"'][^[]*)` + "|" + `(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2` + ")\\]" + "|" + "(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
51063
|
+
function castPath2(value) {
|
|
51064
|
+
var _a, _b, _c;
|
|
51065
|
+
const result = [];
|
|
51066
|
+
let match2;
|
|
51067
|
+
while (match2 = rePropName2.exec(value)) {
|
|
51068
|
+
result.push((_c = (_a = match2[3]) !== null && _a !== undefined ? _a : (_b = match2[1]) === null || _b === undefined ? undefined : _b.trim()) !== null && _c !== undefined ? _c : match2[0]);
|
|
51069
|
+
}
|
|
51070
|
+
return result;
|
|
51071
|
+
}
|
|
51072
|
+
function getProp(obj, path, defaultValue) {
|
|
51073
|
+
if (path in obj) {
|
|
51074
|
+
const value = obj[path];
|
|
51075
|
+
return value === undefined ? defaultValue : value;
|
|
51076
|
+
}
|
|
51077
|
+
const processedPath = Array.isArray(path) ? path : castPath2(path, obj);
|
|
51078
|
+
let currentValue = obj;
|
|
51079
|
+
for (const key of processedPath) {
|
|
51080
|
+
currentValue = currentValue === null || currentValue === undefined ? undefined : currentValue[key];
|
|
51081
|
+
if (currentValue === undefined)
|
|
51082
|
+
return defaultValue;
|
|
51083
|
+
}
|
|
51084
|
+
return currentValue;
|
|
51085
|
+
}
|
|
51086
|
+
function flattenReducer(acc, arr) {
|
|
51087
|
+
try {
|
|
51088
|
+
Array.isArray(arr) ? acc.push(...arr) : acc.push(arr);
|
|
51089
|
+
return acc;
|
|
51090
|
+
} catch (err) {
|
|
51091
|
+
return acc.concat(arr);
|
|
51092
|
+
}
|
|
51093
|
+
}
|
|
51094
|
+
function fastJoin(arr, separator) {
|
|
51095
|
+
let isFirst = true;
|
|
51096
|
+
return arr.reduce((acc, elem) => {
|
|
51097
|
+
if (elem === null || elem === undefined) {
|
|
51098
|
+
elem = "";
|
|
51099
|
+
}
|
|
51100
|
+
if (isFirst) {
|
|
51101
|
+
isFirst = false;
|
|
51102
|
+
return `${elem}`;
|
|
51103
|
+
}
|
|
51104
|
+
return `${acc}${separator}${elem}`;
|
|
51105
|
+
}, "");
|
|
51106
|
+
}
|
|
51107
|
+
|
|
51108
|
+
// node_modules/@json2csv/plainjs/dist/mjs/BaseParser.js
|
|
51109
|
+
var FormatterTypes;
|
|
51110
|
+
(function(FormatterTypes2) {
|
|
51111
|
+
FormatterTypes2["header"] = "header";
|
|
51112
|
+
FormatterTypes2["undefined"] = "undefined";
|
|
51113
|
+
FormatterTypes2["boolean"] = "boolean";
|
|
51114
|
+
FormatterTypes2["number"] = "number";
|
|
51115
|
+
FormatterTypes2["bigint"] = "bigint";
|
|
51116
|
+
FormatterTypes2["string"] = "string";
|
|
51117
|
+
FormatterTypes2["symbol"] = "symbol";
|
|
51118
|
+
FormatterTypes2["function"] = "function";
|
|
51119
|
+
FormatterTypes2["object"] = "object";
|
|
51120
|
+
})(FormatterTypes || (FormatterTypes = {}));
|
|
51121
|
+
|
|
51122
|
+
class JSON2CSVBase {
|
|
51123
|
+
constructor(opts) {
|
|
51124
|
+
this.opts = this.preprocessOpts(opts);
|
|
51125
|
+
}
|
|
51126
|
+
preprocessOpts(opts) {
|
|
51127
|
+
const processedOpts = Object.assign({}, opts);
|
|
51128
|
+
if (processedOpts.fields) {
|
|
51129
|
+
processedOpts.fields = this.preprocessFieldsInfo(processedOpts.fields, processedOpts.defaultValue);
|
|
51130
|
+
}
|
|
51131
|
+
processedOpts.transforms = processedOpts.transforms || [];
|
|
51132
|
+
const stringFormatter2 = processedOpts.formatters && processedOpts.formatters["string"] || stringFormatter();
|
|
51133
|
+
const objectFormatter2 = objectFormatter({ stringFormatter: stringFormatter2 });
|
|
51134
|
+
const defaultFormatters = {
|
|
51135
|
+
header: stringFormatter2,
|
|
51136
|
+
undefined: defaultFormatter,
|
|
51137
|
+
boolean: defaultFormatter,
|
|
51138
|
+
number: numberFormatter(),
|
|
51139
|
+
bigint: defaultFormatter,
|
|
51140
|
+
string: stringFormatter2,
|
|
51141
|
+
symbol: symbolFormatter({ stringFormatter: stringFormatter2 }),
|
|
51142
|
+
function: objectFormatter2,
|
|
51143
|
+
object: objectFormatter2
|
|
51144
|
+
};
|
|
51145
|
+
processedOpts.formatters = Object.assign(Object.assign({}, defaultFormatters), processedOpts.formatters);
|
|
51146
|
+
processedOpts.delimiter = processedOpts.delimiter || ",";
|
|
51147
|
+
processedOpts.eol = processedOpts.eol || `
|
|
51148
|
+
`;
|
|
51149
|
+
processedOpts.header = processedOpts.header !== false;
|
|
51150
|
+
processedOpts.includeEmptyRows = processedOpts.includeEmptyRows || false;
|
|
51151
|
+
processedOpts.withBOM = processedOpts.withBOM || false;
|
|
51152
|
+
return processedOpts;
|
|
51153
|
+
}
|
|
51154
|
+
preprocessFieldsInfo(fields, globalDefaultValue) {
|
|
51155
|
+
return fields.map((fieldInfo) => {
|
|
51156
|
+
if (typeof fieldInfo === "string") {
|
|
51157
|
+
return {
|
|
51158
|
+
label: fieldInfo,
|
|
51159
|
+
value: (row) => getProp(row, fieldInfo, globalDefaultValue)
|
|
51160
|
+
};
|
|
51161
|
+
}
|
|
51162
|
+
if (typeof fieldInfo === "object") {
|
|
51163
|
+
const defaultValue = "default" in fieldInfo ? fieldInfo.default : globalDefaultValue;
|
|
51164
|
+
if (typeof fieldInfo.value === "string") {
|
|
51165
|
+
const fieldPath = fieldInfo.value;
|
|
51166
|
+
return {
|
|
51167
|
+
label: fieldInfo.label || fieldInfo.value,
|
|
51168
|
+
value: (row) => getProp(row, fieldPath, defaultValue)
|
|
51169
|
+
};
|
|
51170
|
+
}
|
|
51171
|
+
if (typeof fieldInfo.value === "function") {
|
|
51172
|
+
const label = fieldInfo.label || fieldInfo.value.name || "";
|
|
51173
|
+
const field = { label, default: defaultValue };
|
|
51174
|
+
const valueGetter = fieldInfo.value;
|
|
51175
|
+
return {
|
|
51176
|
+
label,
|
|
51177
|
+
value(row) {
|
|
51178
|
+
const value = valueGetter(row, field);
|
|
51179
|
+
return value === undefined ? defaultValue : value;
|
|
51180
|
+
}
|
|
51181
|
+
};
|
|
51182
|
+
}
|
|
51183
|
+
}
|
|
51184
|
+
throw new Error("Invalid field info option. " + JSON.stringify(fieldInfo));
|
|
51185
|
+
});
|
|
51186
|
+
}
|
|
51187
|
+
getHeader() {
|
|
51188
|
+
return fastJoin(this.opts.fields.map((fieldInfo) => this.opts.formatters.header(fieldInfo.label)), this.opts.delimiter);
|
|
51189
|
+
}
|
|
51190
|
+
preprocessRow(row) {
|
|
51191
|
+
return this.opts.transforms.reduce((rows, transform) => rows.map((row2) => transform(row2)).reduce(flattenReducer, []), [row]);
|
|
51192
|
+
}
|
|
51193
|
+
processRow(row) {
|
|
51194
|
+
if (!row) {
|
|
51195
|
+
return;
|
|
51196
|
+
}
|
|
51197
|
+
const processedRow = this.opts.fields.map((fieldInfo) => this.processCell(row, fieldInfo));
|
|
51198
|
+
if (!this.opts.includeEmptyRows && processedRow.every((field) => field === "")) {
|
|
51199
|
+
return;
|
|
51200
|
+
}
|
|
51201
|
+
return fastJoin(processedRow, this.opts.delimiter);
|
|
51202
|
+
}
|
|
51203
|
+
processCell(row, fieldInfo) {
|
|
51204
|
+
return this.processValue(fieldInfo.value(row));
|
|
51205
|
+
}
|
|
51206
|
+
processValue(value) {
|
|
51207
|
+
const formatter = this.opts.formatters[typeof value];
|
|
51208
|
+
return formatter(value);
|
|
51209
|
+
}
|
|
51210
|
+
}
|
|
51211
|
+
// node_modules/@json2csv/plainjs/dist/mjs/Parser.js
|
|
51212
|
+
class JSON2CSVParser extends JSON2CSVBase {
|
|
51213
|
+
constructor(opts) {
|
|
51214
|
+
super(opts);
|
|
51215
|
+
}
|
|
51216
|
+
parse(data) {
|
|
51217
|
+
const preprocessedData = this.preprocessData(data);
|
|
51218
|
+
this.opts.fields = this.opts.fields || this.preprocessFieldsInfo(preprocessedData.reduce((fields, item) => {
|
|
51219
|
+
Object.keys(item).forEach((field) => {
|
|
51220
|
+
if (!fields.includes(field)) {
|
|
51221
|
+
fields.push(field);
|
|
51222
|
+
}
|
|
51223
|
+
});
|
|
51224
|
+
return fields;
|
|
51225
|
+
}, []), this.opts.defaultValue);
|
|
51226
|
+
const header = this.opts.header ? this.getHeader() : "";
|
|
51227
|
+
const rows = this.processData(preprocessedData);
|
|
51228
|
+
const csv = (this.opts.withBOM ? "\uFEFF" : "") + header + (header && rows ? this.opts.eol : "") + rows;
|
|
51229
|
+
return csv;
|
|
51230
|
+
}
|
|
51231
|
+
preprocessData(data) {
|
|
51232
|
+
const processedData = Array.isArray(data) ? data : [data];
|
|
51233
|
+
if (!this.opts.fields) {
|
|
51234
|
+
if (data === undefined || data === null || processedData.length === 0) {
|
|
51235
|
+
throw new Error('Data should not be empty or the "fields" option should be included');
|
|
51236
|
+
}
|
|
51237
|
+
if (typeof processedData[0] !== "object") {
|
|
51238
|
+
throw new Error('Data items should be objects or the "fields" option should be included');
|
|
51239
|
+
}
|
|
51240
|
+
}
|
|
51241
|
+
if (this.opts.transforms.length === 0)
|
|
51242
|
+
return processedData;
|
|
51243
|
+
return processedData.map((row) => this.preprocessRow(row)).reduce(flattenReducer, []);
|
|
51244
|
+
}
|
|
51245
|
+
processData(data) {
|
|
51246
|
+
return fastJoin(data.map((row) => this.processRow(row)).filter((row) => row), this.opts.eol);
|
|
51247
|
+
}
|
|
51248
|
+
}
|
|
51249
|
+
// node_modules/@streamparser/json/dist/mjs/utils/utf-8.js
|
|
51250
|
+
var charset;
|
|
51251
|
+
(function(charset2) {
|
|
51252
|
+
charset2[charset2["BACKSPACE"] = 8] = "BACKSPACE";
|
|
51253
|
+
charset2[charset2["FORM_FEED"] = 12] = "FORM_FEED";
|
|
51254
|
+
charset2[charset2["NEWLINE"] = 10] = "NEWLINE";
|
|
51255
|
+
charset2[charset2["CARRIAGE_RETURN"] = 13] = "CARRIAGE_RETURN";
|
|
51256
|
+
charset2[charset2["TAB"] = 9] = "TAB";
|
|
51257
|
+
charset2[charset2["SPACE"] = 32] = "SPACE";
|
|
51258
|
+
charset2[charset2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
|
|
51259
|
+
charset2[charset2["QUOTATION_MARK"] = 34] = "QUOTATION_MARK";
|
|
51260
|
+
charset2[charset2["NUMBER_SIGN"] = 35] = "NUMBER_SIGN";
|
|
51261
|
+
charset2[charset2["DOLLAR_SIGN"] = 36] = "DOLLAR_SIGN";
|
|
51262
|
+
charset2[charset2["PERCENT_SIGN"] = 37] = "PERCENT_SIGN";
|
|
51263
|
+
charset2[charset2["AMPERSAND"] = 38] = "AMPERSAND";
|
|
51264
|
+
charset2[charset2["APOSTROPHE"] = 39] = "APOSTROPHE";
|
|
51265
|
+
charset2[charset2["LEFT_PARENTHESIS"] = 40] = "LEFT_PARENTHESIS";
|
|
51266
|
+
charset2[charset2["RIGHT_PARENTHESIS"] = 41] = "RIGHT_PARENTHESIS";
|
|
51267
|
+
charset2[charset2["ASTERISK"] = 42] = "ASTERISK";
|
|
51268
|
+
charset2[charset2["PLUS_SIGN"] = 43] = "PLUS_SIGN";
|
|
51269
|
+
charset2[charset2["COMMA"] = 44] = "COMMA";
|
|
51270
|
+
charset2[charset2["HYPHEN_MINUS"] = 45] = "HYPHEN_MINUS";
|
|
51271
|
+
charset2[charset2["FULL_STOP"] = 46] = "FULL_STOP";
|
|
51272
|
+
charset2[charset2["SOLIDUS"] = 47] = "SOLIDUS";
|
|
51273
|
+
charset2[charset2["DIGIT_ZERO"] = 48] = "DIGIT_ZERO";
|
|
51274
|
+
charset2[charset2["DIGIT_ONE"] = 49] = "DIGIT_ONE";
|
|
51275
|
+
charset2[charset2["DIGIT_TWO"] = 50] = "DIGIT_TWO";
|
|
51276
|
+
charset2[charset2["DIGIT_THREE"] = 51] = "DIGIT_THREE";
|
|
51277
|
+
charset2[charset2["DIGIT_FOUR"] = 52] = "DIGIT_FOUR";
|
|
51278
|
+
charset2[charset2["DIGIT_FIVE"] = 53] = "DIGIT_FIVE";
|
|
51279
|
+
charset2[charset2["DIGIT_SIX"] = 54] = "DIGIT_SIX";
|
|
51280
|
+
charset2[charset2["DIGIT_SEVEN"] = 55] = "DIGIT_SEVEN";
|
|
51281
|
+
charset2[charset2["DIGIT_EIGHT"] = 56] = "DIGIT_EIGHT";
|
|
51282
|
+
charset2[charset2["DIGIT_NINE"] = 57] = "DIGIT_NINE";
|
|
51283
|
+
charset2[charset2["COLON"] = 58] = "COLON";
|
|
51284
|
+
charset2[charset2["SEMICOLON"] = 59] = "SEMICOLON";
|
|
51285
|
+
charset2[charset2["LESS_THAN_SIGN"] = 60] = "LESS_THAN_SIGN";
|
|
51286
|
+
charset2[charset2["EQUALS_SIGN"] = 61] = "EQUALS_SIGN";
|
|
51287
|
+
charset2[charset2["GREATER_THAN_SIGN"] = 62] = "GREATER_THAN_SIGN";
|
|
51288
|
+
charset2[charset2["QUESTION_MARK"] = 63] = "QUESTION_MARK";
|
|
51289
|
+
charset2[charset2["COMMERCIAL_AT"] = 64] = "COMMERCIAL_AT";
|
|
51290
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_A"] = 65] = "LATIN_CAPITAL_LETTER_A";
|
|
51291
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_B"] = 66] = "LATIN_CAPITAL_LETTER_B";
|
|
51292
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_C"] = 67] = "LATIN_CAPITAL_LETTER_C";
|
|
51293
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_D"] = 68] = "LATIN_CAPITAL_LETTER_D";
|
|
51294
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_E"] = 69] = "LATIN_CAPITAL_LETTER_E";
|
|
51295
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_F"] = 70] = "LATIN_CAPITAL_LETTER_F";
|
|
51296
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_G"] = 71] = "LATIN_CAPITAL_LETTER_G";
|
|
51297
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_H"] = 72] = "LATIN_CAPITAL_LETTER_H";
|
|
51298
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_I"] = 73] = "LATIN_CAPITAL_LETTER_I";
|
|
51299
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_J"] = 74] = "LATIN_CAPITAL_LETTER_J";
|
|
51300
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_K"] = 75] = "LATIN_CAPITAL_LETTER_K";
|
|
51301
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_L"] = 76] = "LATIN_CAPITAL_LETTER_L";
|
|
51302
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_M"] = 77] = "LATIN_CAPITAL_LETTER_M";
|
|
51303
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_N"] = 78] = "LATIN_CAPITAL_LETTER_N";
|
|
51304
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_O"] = 79] = "LATIN_CAPITAL_LETTER_O";
|
|
51305
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_P"] = 80] = "LATIN_CAPITAL_LETTER_P";
|
|
51306
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_Q"] = 81] = "LATIN_CAPITAL_LETTER_Q";
|
|
51307
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_R"] = 82] = "LATIN_CAPITAL_LETTER_R";
|
|
51308
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_S"] = 83] = "LATIN_CAPITAL_LETTER_S";
|
|
51309
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_T"] = 84] = "LATIN_CAPITAL_LETTER_T";
|
|
51310
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_U"] = 85] = "LATIN_CAPITAL_LETTER_U";
|
|
51311
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_V"] = 86] = "LATIN_CAPITAL_LETTER_V";
|
|
51312
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_W"] = 87] = "LATIN_CAPITAL_LETTER_W";
|
|
51313
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_X"] = 88] = "LATIN_CAPITAL_LETTER_X";
|
|
51314
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_Y"] = 89] = "LATIN_CAPITAL_LETTER_Y";
|
|
51315
|
+
charset2[charset2["LATIN_CAPITAL_LETTER_Z"] = 90] = "LATIN_CAPITAL_LETTER_Z";
|
|
51316
|
+
charset2[charset2["LEFT_SQUARE_BRACKET"] = 91] = "LEFT_SQUARE_BRACKET";
|
|
51317
|
+
charset2[charset2["REVERSE_SOLIDUS"] = 92] = "REVERSE_SOLIDUS";
|
|
51318
|
+
charset2[charset2["RIGHT_SQUARE_BRACKET"] = 93] = "RIGHT_SQUARE_BRACKET";
|
|
51319
|
+
charset2[charset2["CIRCUMFLEX_ACCENT"] = 94] = "CIRCUMFLEX_ACCENT";
|
|
51320
|
+
charset2[charset2["LOW_LINE"] = 95] = "LOW_LINE";
|
|
51321
|
+
charset2[charset2["GRAVE_ACCENT"] = 96] = "GRAVE_ACCENT";
|
|
51322
|
+
charset2[charset2["LATIN_SMALL_LETTER_A"] = 97] = "LATIN_SMALL_LETTER_A";
|
|
51323
|
+
charset2[charset2["LATIN_SMALL_LETTER_B"] = 98] = "LATIN_SMALL_LETTER_B";
|
|
51324
|
+
charset2[charset2["LATIN_SMALL_LETTER_C"] = 99] = "LATIN_SMALL_LETTER_C";
|
|
51325
|
+
charset2[charset2["LATIN_SMALL_LETTER_D"] = 100] = "LATIN_SMALL_LETTER_D";
|
|
51326
|
+
charset2[charset2["LATIN_SMALL_LETTER_E"] = 101] = "LATIN_SMALL_LETTER_E";
|
|
51327
|
+
charset2[charset2["LATIN_SMALL_LETTER_F"] = 102] = "LATIN_SMALL_LETTER_F";
|
|
51328
|
+
charset2[charset2["LATIN_SMALL_LETTER_G"] = 103] = "LATIN_SMALL_LETTER_G";
|
|
51329
|
+
charset2[charset2["LATIN_SMALL_LETTER_H"] = 104] = "LATIN_SMALL_LETTER_H";
|
|
51330
|
+
charset2[charset2["LATIN_SMALL_LETTER_I"] = 105] = "LATIN_SMALL_LETTER_I";
|
|
51331
|
+
charset2[charset2["LATIN_SMALL_LETTER_J"] = 106] = "LATIN_SMALL_LETTER_J";
|
|
51332
|
+
charset2[charset2["LATIN_SMALL_LETTER_K"] = 107] = "LATIN_SMALL_LETTER_K";
|
|
51333
|
+
charset2[charset2["LATIN_SMALL_LETTER_L"] = 108] = "LATIN_SMALL_LETTER_L";
|
|
51334
|
+
charset2[charset2["LATIN_SMALL_LETTER_M"] = 109] = "LATIN_SMALL_LETTER_M";
|
|
51335
|
+
charset2[charset2["LATIN_SMALL_LETTER_N"] = 110] = "LATIN_SMALL_LETTER_N";
|
|
51336
|
+
charset2[charset2["LATIN_SMALL_LETTER_O"] = 111] = "LATIN_SMALL_LETTER_O";
|
|
51337
|
+
charset2[charset2["LATIN_SMALL_LETTER_P"] = 112] = "LATIN_SMALL_LETTER_P";
|
|
51338
|
+
charset2[charset2["LATIN_SMALL_LETTER_Q"] = 113] = "LATIN_SMALL_LETTER_Q";
|
|
51339
|
+
charset2[charset2["LATIN_SMALL_LETTER_R"] = 114] = "LATIN_SMALL_LETTER_R";
|
|
51340
|
+
charset2[charset2["LATIN_SMALL_LETTER_S"] = 115] = "LATIN_SMALL_LETTER_S";
|
|
51341
|
+
charset2[charset2["LATIN_SMALL_LETTER_T"] = 116] = "LATIN_SMALL_LETTER_T";
|
|
51342
|
+
charset2[charset2["LATIN_SMALL_LETTER_U"] = 117] = "LATIN_SMALL_LETTER_U";
|
|
51343
|
+
charset2[charset2["LATIN_SMALL_LETTER_V"] = 118] = "LATIN_SMALL_LETTER_V";
|
|
51344
|
+
charset2[charset2["LATIN_SMALL_LETTER_W"] = 119] = "LATIN_SMALL_LETTER_W";
|
|
51345
|
+
charset2[charset2["LATIN_SMALL_LETTER_X"] = 120] = "LATIN_SMALL_LETTER_X";
|
|
51346
|
+
charset2[charset2["LATIN_SMALL_LETTER_Y"] = 121] = "LATIN_SMALL_LETTER_Y";
|
|
51347
|
+
charset2[charset2["LATIN_SMALL_LETTER_Z"] = 122] = "LATIN_SMALL_LETTER_Z";
|
|
51348
|
+
charset2[charset2["LEFT_CURLY_BRACKET"] = 123] = "LEFT_CURLY_BRACKET";
|
|
51349
|
+
charset2[charset2["VERTICAL_LINE"] = 124] = "VERTICAL_LINE";
|
|
51350
|
+
charset2[charset2["RIGHT_CURLY_BRACKET"] = 125] = "RIGHT_CURLY_BRACKET";
|
|
51351
|
+
charset2[charset2["TILDE"] = 126] = "TILDE";
|
|
51352
|
+
})(charset || (charset = {}));
|
|
51353
|
+
var escapedSequences = {
|
|
51354
|
+
[charset.QUOTATION_MARK]: charset.QUOTATION_MARK,
|
|
51355
|
+
[charset.REVERSE_SOLIDUS]: charset.REVERSE_SOLIDUS,
|
|
51356
|
+
[charset.SOLIDUS]: charset.SOLIDUS,
|
|
51357
|
+
[charset.LATIN_SMALL_LETTER_B]: charset.BACKSPACE,
|
|
51358
|
+
[charset.LATIN_SMALL_LETTER_F]: charset.FORM_FEED,
|
|
51359
|
+
[charset.LATIN_SMALL_LETTER_N]: charset.NEWLINE,
|
|
51360
|
+
[charset.LATIN_SMALL_LETTER_R]: charset.CARRIAGE_RETURN,
|
|
51361
|
+
[charset.LATIN_SMALL_LETTER_T]: charset.TAB
|
|
51362
|
+
};
|
|
51363
|
+
|
|
51364
|
+
// node_modules/@streamparser/json/dist/mjs/utils/types/tokenType.js
|
|
51365
|
+
var TokenType;
|
|
51366
|
+
(function(TokenType2) {
|
|
51367
|
+
TokenType2[TokenType2["LEFT_BRACE"] = 0] = "LEFT_BRACE";
|
|
51368
|
+
TokenType2[TokenType2["RIGHT_BRACE"] = 1] = "RIGHT_BRACE";
|
|
51369
|
+
TokenType2[TokenType2["LEFT_BRACKET"] = 2] = "LEFT_BRACKET";
|
|
51370
|
+
TokenType2[TokenType2["RIGHT_BRACKET"] = 3] = "RIGHT_BRACKET";
|
|
51371
|
+
TokenType2[TokenType2["COLON"] = 4] = "COLON";
|
|
51372
|
+
TokenType2[TokenType2["COMMA"] = 5] = "COMMA";
|
|
51373
|
+
TokenType2[TokenType2["TRUE"] = 6] = "TRUE";
|
|
51374
|
+
TokenType2[TokenType2["FALSE"] = 7] = "FALSE";
|
|
51375
|
+
TokenType2[TokenType2["NULL"] = 8] = "NULL";
|
|
51376
|
+
TokenType2[TokenType2["STRING"] = 9] = "STRING";
|
|
51377
|
+
TokenType2[TokenType2["NUMBER"] = 10] = "NUMBER";
|
|
51378
|
+
TokenType2[TokenType2["SEPARATOR"] = 11] = "SEPARATOR";
|
|
51379
|
+
})(TokenType || (TokenType = {}));
|
|
51380
|
+
|
|
51381
|
+
// node_modules/@streamparser/json/dist/mjs/tokenizer.js
|
|
51382
|
+
var TokenizerStates;
|
|
51383
|
+
(function(TokenizerStates2) {
|
|
51384
|
+
TokenizerStates2[TokenizerStates2["START"] = 0] = "START";
|
|
51385
|
+
TokenizerStates2[TokenizerStates2["ENDED"] = 1] = "ENDED";
|
|
51386
|
+
TokenizerStates2[TokenizerStates2["ERROR"] = 2] = "ERROR";
|
|
51387
|
+
TokenizerStates2[TokenizerStates2["TRUE1"] = 3] = "TRUE1";
|
|
51388
|
+
TokenizerStates2[TokenizerStates2["TRUE2"] = 4] = "TRUE2";
|
|
51389
|
+
TokenizerStates2[TokenizerStates2["TRUE3"] = 5] = "TRUE3";
|
|
51390
|
+
TokenizerStates2[TokenizerStates2["FALSE1"] = 6] = "FALSE1";
|
|
51391
|
+
TokenizerStates2[TokenizerStates2["FALSE2"] = 7] = "FALSE2";
|
|
51392
|
+
TokenizerStates2[TokenizerStates2["FALSE3"] = 8] = "FALSE3";
|
|
51393
|
+
TokenizerStates2[TokenizerStates2["FALSE4"] = 9] = "FALSE4";
|
|
51394
|
+
TokenizerStates2[TokenizerStates2["NULL1"] = 10] = "NULL1";
|
|
51395
|
+
TokenizerStates2[TokenizerStates2["NULL2"] = 11] = "NULL2";
|
|
51396
|
+
TokenizerStates2[TokenizerStates2["NULL3"] = 12] = "NULL3";
|
|
51397
|
+
TokenizerStates2[TokenizerStates2["STRING_DEFAULT"] = 13] = "STRING_DEFAULT";
|
|
51398
|
+
TokenizerStates2[TokenizerStates2["STRING_AFTER_BACKSLASH"] = 14] = "STRING_AFTER_BACKSLASH";
|
|
51399
|
+
TokenizerStates2[TokenizerStates2["STRING_UNICODE_DIGIT_1"] = 15] = "STRING_UNICODE_DIGIT_1";
|
|
51400
|
+
TokenizerStates2[TokenizerStates2["STRING_UNICODE_DIGIT_2"] = 16] = "STRING_UNICODE_DIGIT_2";
|
|
51401
|
+
TokenizerStates2[TokenizerStates2["STRING_UNICODE_DIGIT_3"] = 17] = "STRING_UNICODE_DIGIT_3";
|
|
51402
|
+
TokenizerStates2[TokenizerStates2["STRING_UNICODE_DIGIT_4"] = 18] = "STRING_UNICODE_DIGIT_4";
|
|
51403
|
+
TokenizerStates2[TokenizerStates2["STRING_INCOMPLETE_CHAR"] = 19] = "STRING_INCOMPLETE_CHAR";
|
|
51404
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_INITIAL_MINUS"] = 20] = "NUMBER_AFTER_INITIAL_MINUS";
|
|
51405
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_INITIAL_ZERO"] = 21] = "NUMBER_AFTER_INITIAL_ZERO";
|
|
51406
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_INITIAL_NON_ZERO"] = 22] = "NUMBER_AFTER_INITIAL_NON_ZERO";
|
|
51407
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_FULL_STOP"] = 23] = "NUMBER_AFTER_FULL_STOP";
|
|
51408
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_DECIMAL"] = 24] = "NUMBER_AFTER_DECIMAL";
|
|
51409
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_E"] = 25] = "NUMBER_AFTER_E";
|
|
51410
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_E_AND_SIGN"] = 26] = "NUMBER_AFTER_E_AND_SIGN";
|
|
51411
|
+
TokenizerStates2[TokenizerStates2["NUMBER_AFTER_E_AND_DIGIT"] = 27] = "NUMBER_AFTER_E_AND_DIGIT";
|
|
51412
|
+
TokenizerStates2[TokenizerStates2["SEPARATOR"] = 28] = "SEPARATOR";
|
|
51413
|
+
TokenizerStates2[TokenizerStates2["BOM_OR_START"] = 29] = "BOM_OR_START";
|
|
51414
|
+
TokenizerStates2[TokenizerStates2["BOM"] = 30] = "BOM";
|
|
51415
|
+
})(TokenizerStates || (TokenizerStates = {}));
|
|
51416
|
+
|
|
51417
|
+
// node_modules/@streamparser/json/dist/mjs/utils/types/stackElement.js
|
|
51418
|
+
var TokenParserMode;
|
|
51419
|
+
(function(TokenParserMode2) {
|
|
51420
|
+
TokenParserMode2[TokenParserMode2["OBJECT"] = 0] = "OBJECT";
|
|
51421
|
+
TokenParserMode2[TokenParserMode2["ARRAY"] = 1] = "ARRAY";
|
|
51422
|
+
})(TokenParserMode || (TokenParserMode = {}));
|
|
51423
|
+
|
|
51424
|
+
// node_modules/@streamparser/json/dist/mjs/tokenparser.js
|
|
51425
|
+
var TokenParserState;
|
|
51426
|
+
(function(TokenParserState2) {
|
|
51427
|
+
TokenParserState2[TokenParserState2["VALUE"] = 0] = "VALUE";
|
|
51428
|
+
TokenParserState2[TokenParserState2["KEY"] = 1] = "KEY";
|
|
51429
|
+
TokenParserState2[TokenParserState2["COLON"] = 2] = "COLON";
|
|
51430
|
+
TokenParserState2[TokenParserState2["COMMA"] = 3] = "COMMA";
|
|
51431
|
+
TokenParserState2[TokenParserState2["ENDED"] = 4] = "ENDED";
|
|
51432
|
+
TokenParserState2[TokenParserState2["ERROR"] = 5] = "ERROR";
|
|
51433
|
+
TokenParserState2[TokenParserState2["SEPARATOR"] = 6] = "SEPARATOR";
|
|
51434
|
+
})(TokenParserState || (TokenParserState = {}));
|
|
51435
|
+
// src/functions/jsonToCsv.ts
|
|
51436
|
+
function jsonToCsv(json, options3) {
|
|
51437
|
+
const jsonArray = compact_default(castArray_default(json));
|
|
51438
|
+
if (isEmpty_default(jsonArray)) {
|
|
51439
|
+
return "";
|
|
51440
|
+
}
|
|
51441
|
+
const parser3 = new JSON2CSVParser(options3);
|
|
51442
|
+
return parser3.parse(jsonArray);
|
|
51443
|
+
}
|
|
51444
|
+
|
|
50918
51445
|
// src/functions/jsToXml.ts
|
|
50919
51446
|
var import_xml_js = __toESM(require_lib3(), 1);
|
|
50920
51447
|
function jsToXml_default(json, options3 = { compact: true, spaces: 4 }) {
|
|
@@ -55056,7 +55583,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
55056
55583
|
});
|
|
55057
55584
|
|
|
55058
55585
|
// node_modules/@langchain/core/dist/runnables/base.js
|
|
55059
|
-
var
|
|
55586
|
+
var import_p_retry6 = __toESM(require_p_retry(), 1);
|
|
55060
55587
|
|
|
55061
55588
|
// node_modules/uuid/dist/esm-browser/regex.js
|
|
55062
55589
|
var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
@@ -55116,7 +55643,7 @@ function v4(options3, buf, offset2) {
|
|
|
55116
55643
|
}
|
|
55117
55644
|
var v4_default = v4;
|
|
55118
55645
|
// node_modules/langsmith/dist/utils/async_caller.js
|
|
55119
|
-
var
|
|
55646
|
+
var import_p_retry4 = __toESM(require_p_retry2(), 1);
|
|
55120
55647
|
var import_p_queue = __toESM(require_dist(), 1);
|
|
55121
55648
|
|
|
55122
55649
|
// node_modules/langsmith/dist/singletons/fetch.js
|
|
@@ -55180,7 +55707,7 @@ class AsyncCaller {
|
|
|
55180
55707
|
}
|
|
55181
55708
|
call(callable, ...args) {
|
|
55182
55709
|
const onFailedResponseHook = this.onFailedResponseHook;
|
|
55183
|
-
return this.queue.add(() =>
|
|
55710
|
+
return this.queue.add(() => import_p_retry4.default(() => callable(...args).catch((error) => {
|
|
55184
55711
|
if (error instanceof Error) {
|
|
55185
55712
|
throw error;
|
|
55186
55713
|
} else {
|
|
@@ -62794,7 +63321,7 @@ class EventStreamCallbackHandler extends BaseTracer {
|
|
|
62794
63321
|
}
|
|
62795
63322
|
|
|
62796
63323
|
// node_modules/@langchain/core/dist/utils/async_caller.js
|
|
62797
|
-
var
|
|
63324
|
+
var import_p_retry5 = __toESM(require_p_retry(), 1);
|
|
62798
63325
|
var import_p_queue3 = __toESM(require_dist(), 1);
|
|
62799
63326
|
var STATUS_NO_RETRY2 = [
|
|
62800
63327
|
400,
|
|
@@ -62858,7 +63385,7 @@ class AsyncCaller2 {
|
|
|
62858
63385
|
this.queue = new PQueue({ concurrency: this.maxConcurrency });
|
|
62859
63386
|
}
|
|
62860
63387
|
call(callable, ...args) {
|
|
62861
|
-
return this.queue.add(() =>
|
|
63388
|
+
return this.queue.add(() => import_p_retry5.default(() => callable(...args).catch((error) => {
|
|
62862
63389
|
if (error instanceof Error) {
|
|
62863
63390
|
throw error;
|
|
62864
63391
|
} else {
|
|
@@ -65360,7 +65887,7 @@ class RunnableRetry extends RunnableBinding {
|
|
|
65360
65887
|
return patchConfig(config, { callbacks: runManager?.getChild(tag3) });
|
|
65361
65888
|
}
|
|
65362
65889
|
async _invoke(input, config, runManager) {
|
|
65363
|
-
return
|
|
65890
|
+
return import_p_retry6.default((attemptNumber) => super.invoke(input, this._patchConfigForRetry(attemptNumber, config, runManager)), {
|
|
65364
65891
|
onFailedAttempt: (error) => this.onFailedAttempt(error, input),
|
|
65365
65892
|
retries: Math.max(this.maxAttemptNumber - 1, 0),
|
|
65366
65893
|
randomize: true
|
|
@@ -65372,7 +65899,7 @@ class RunnableRetry extends RunnableBinding {
|
|
|
65372
65899
|
async _batch(inputs, configs, runManagers, batchOptions) {
|
|
65373
65900
|
const resultsMap = {};
|
|
65374
65901
|
try {
|
|
65375
|
-
await
|
|
65902
|
+
await import_p_retry6.default(async (attemptNumber) => {
|
|
65376
65903
|
const remainingIndexes = inputs.map((_, i3) => i3).filter((i3) => resultsMap[i3.toString()] === undefined || resultsMap[i3.toString()] instanceof Error);
|
|
65377
65904
|
const remainingInputs = remainingIndexes.map((i3) => inputs[i3]);
|
|
65378
65905
|
const patchedConfigs = remainingIndexes.map((i3) => this._patchConfigForRetry(attemptNumber, configs?.[i3], runManagers?.[i3]));
|
|
@@ -67318,94 +67845,6 @@ function zipSqlResponse(columns, data, key) {
|
|
|
67318
67845
|
}
|
|
67319
67846
|
var zipSqlResponse_default = zipSqlResponse;
|
|
67320
67847
|
|
|
67321
|
-
// src/functions/convertMdToPdf.ts
|
|
67322
|
-
function getFilenameFromHeaders(resp, fallback) {
|
|
67323
|
-
const cd = resp.headers.get("content-disposition") || "";
|
|
67324
|
-
const matchStar = cd.match(/filename\*=([^;]+)/i);
|
|
67325
|
-
if (matchStar) {
|
|
67326
|
-
const value = trim_default(matchStar[1]);
|
|
67327
|
-
const parts = split_default(value, "''");
|
|
67328
|
-
if (parts.length === 2) {
|
|
67329
|
-
try {
|
|
67330
|
-
return decodeURIComponent(parts[1]);
|
|
67331
|
-
} catch {
|
|
67332
|
-
return parts[1];
|
|
67333
|
-
}
|
|
67334
|
-
}
|
|
67335
|
-
return trim_default(value, `'"`);
|
|
67336
|
-
}
|
|
67337
|
-
const match2 = cd.match(/filename="?([^";]+)"?/i);
|
|
67338
|
-
if (match2)
|
|
67339
|
-
return match2[1];
|
|
67340
|
-
return fallback || "document.pdf";
|
|
67341
|
-
}
|
|
67342
|
-
async function convertMdToPdf(markdown, options3 = {}, assetHeaders = {}) {
|
|
67343
|
-
const documentParserApiUrl = this.environment.lookup("documentParserApiUrl");
|
|
67344
|
-
const documentParserApiKey = this.environment.lookup("documentParserApiKey");
|
|
67345
|
-
if (!documentParserApiKey) {
|
|
67346
|
-
throw new Error("Document parser API key not found in environment");
|
|
67347
|
-
}
|
|
67348
|
-
if (!documentParserApiUrl) {
|
|
67349
|
-
throw new Error("Document parser API URL not found in environment");
|
|
67350
|
-
}
|
|
67351
|
-
if (!markdown || typeof markdown !== "string") {
|
|
67352
|
-
throw new AbortError("Markdown content is required and must be a string");
|
|
67353
|
-
}
|
|
67354
|
-
const requestBody = {
|
|
67355
|
-
markdown,
|
|
67356
|
-
options: options3,
|
|
67357
|
-
assetHeaders
|
|
67358
|
-
};
|
|
67359
|
-
return await pRetry(async () => {
|
|
67360
|
-
const response = await fetch(`${documentParserApiUrl}/md-to-pdf`, {
|
|
67361
|
-
method: "POST",
|
|
67362
|
-
headers: {
|
|
67363
|
-
Authorization: `Bearer ${documentParserApiKey}`,
|
|
67364
|
-
"Content-Type": "application/json",
|
|
67365
|
-
Accept: "application/pdf",
|
|
67366
|
-
"User-Agent": "truto"
|
|
67367
|
-
},
|
|
67368
|
-
body: JSON.stringify(requestBody)
|
|
67369
|
-
});
|
|
67370
|
-
if (!response.ok) {
|
|
67371
|
-
if (response.status === 429) {
|
|
67372
|
-
throw new Error("Rate limit exceeded");
|
|
67373
|
-
}
|
|
67374
|
-
if (response.status >= 500) {
|
|
67375
|
-
throw new Error(`Server error: ${response.status}`);
|
|
67376
|
-
}
|
|
67377
|
-
const errorText = await response.text();
|
|
67378
|
-
let errorMessage = `PDF conversion failed (${response.status})`;
|
|
67379
|
-
try {
|
|
67380
|
-
const errorData = JSON.parse(errorText);
|
|
67381
|
-
errorMessage = errorData.error || errorMessage;
|
|
67382
|
-
if (errorData.details) {
|
|
67383
|
-
errorMessage += `: ${errorData.details}`;
|
|
67384
|
-
}
|
|
67385
|
-
} catch {
|
|
67386
|
-
errorMessage += `: ${errorText}`;
|
|
67387
|
-
}
|
|
67388
|
-
throw new AbortError(errorMessage);
|
|
67389
|
-
}
|
|
67390
|
-
const contentType = response.headers.get("content-type");
|
|
67391
|
-
if (!contentType || !includes_default(contentType, "application/pdf")) {
|
|
67392
|
-
throw new AbortError(`Expected PDF but received: ${contentType}`);
|
|
67393
|
-
}
|
|
67394
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
67395
|
-
const filename = getFilenameFromHeaders(response, options3.filename);
|
|
67396
|
-
const blob2 = new Blob([arrayBuffer], { type: "application/pdf" });
|
|
67397
|
-
blob2.name = filename;
|
|
67398
|
-
return blob2;
|
|
67399
|
-
}, {
|
|
67400
|
-
retries: 5,
|
|
67401
|
-
maxTimeout: 30000,
|
|
67402
|
-
minTimeout: 2500,
|
|
67403
|
-
onFailedAttempt: (error) => {
|
|
67404
|
-
console.warn(`PDF conversion attempt ${error.attemptNumber} failed:`, error.message);
|
|
67405
|
-
}
|
|
67406
|
-
});
|
|
67407
|
-
}
|
|
67408
|
-
|
|
67409
67848
|
// src/registerJsonataExtensions.ts
|
|
67410
67849
|
function registerJsonataExtensions(expression) {
|
|
67411
67850
|
expression.registerFunction("dtFromIso", dtFromIso_default);
|
|
@@ -67499,6 +67938,7 @@ function registerJsonataExtensions(expression) {
|
|
|
67499
67938
|
expression.registerFunction("flattenDepth", function(arr2, depth) {
|
|
67500
67939
|
return flattenDepth_default(castArray_default(arr2), depth);
|
|
67501
67940
|
});
|
|
67941
|
+
expression.registerFunction("jsonToCsv", jsonToCsv);
|
|
67502
67942
|
return expression;
|
|
67503
67943
|
}
|
|
67504
67944
|
|
|
@@ -67510,4 +67950,4 @@ export {
|
|
|
67510
67950
|
trutoJsonata as default
|
|
67511
67951
|
};
|
|
67512
67952
|
|
|
67513
|
-
//# debugId=
|
|
67953
|
+
//# debugId=E22AACED232C3A8A64756E2164756E21
|