@native-systems/utility 1.3.0 → 2.0.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/README.md +2 -2
- package/dist/index.cjs +409 -37
- package/dist/index.d.ts +72 -7
- package/dist/index.esm.js +409 -37
- package/package.json +16 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import Handlebars from 'handlebars';
|
|
2
|
+
import sanitizeHtml, { simpleTransform } from 'sanitize-html';
|
|
3
|
+
import MarkdownIt from 'markdown-it';
|
|
4
|
+
|
|
1
5
|
var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
2
6
|
PostgresError['SUCCESSFUL_COMPLETION'] = '00000';
|
|
3
7
|
PostgresError['WARNING'] = '01000';
|
|
@@ -294,7 +298,7 @@ function _call_super$1(_this, derived, args) {
|
|
|
294
298
|
: derived.apply(_this, args)
|
|
295
299
|
);
|
|
296
300
|
}
|
|
297
|
-
function _class_call_check$
|
|
301
|
+
function _class_call_check$6(instance, Constructor) {
|
|
298
302
|
if (!(instance instanceof Constructor)) {
|
|
299
303
|
throw new TypeError('Cannot call a class as a function');
|
|
300
304
|
}
|
|
@@ -314,7 +318,7 @@ function _construct$1(Parent, args, Class) {
|
|
|
314
318
|
}
|
|
315
319
|
return _construct$1.apply(null, arguments);
|
|
316
320
|
}
|
|
317
|
-
function _define_property$
|
|
321
|
+
function _define_property$5(obj, key, value) {
|
|
318
322
|
if (key in obj) {
|
|
319
323
|
Object.defineProperty(obj, key, {
|
|
320
324
|
value: value,
|
|
@@ -415,10 +419,10 @@ function _is_native_reflect_construct$1() {
|
|
|
415
419
|
var NativeException = /*#__PURE__*/ (function (Error1) {
|
|
416
420
|
_inherits$1(NativeException, Error1);
|
|
417
421
|
function NativeException(code, message) {
|
|
418
|
-
_class_call_check$
|
|
422
|
+
_class_call_check$6(this, NativeException);
|
|
419
423
|
var _this;
|
|
420
424
|
(_this = _call_super$1(this, NativeException, [message])),
|
|
421
|
-
_define_property$
|
|
425
|
+
_define_property$5(_this, 'code', void 0);
|
|
422
426
|
_this.name = 'NativeError';
|
|
423
427
|
_this.code = code;
|
|
424
428
|
return _this;
|
|
@@ -447,7 +451,7 @@ function _call_super(_this, derived, args) {
|
|
|
447
451
|
: derived.apply(_this, args)
|
|
448
452
|
);
|
|
449
453
|
}
|
|
450
|
-
function _class_call_check$
|
|
454
|
+
function _class_call_check$5(instance, Constructor) {
|
|
451
455
|
if (!(instance instanceof Constructor)) {
|
|
452
456
|
throw new TypeError('Cannot call a class as a function');
|
|
453
457
|
}
|
|
@@ -467,7 +471,7 @@ function _construct(Parent, args, Class) {
|
|
|
467
471
|
}
|
|
468
472
|
return _construct.apply(null, arguments);
|
|
469
473
|
}
|
|
470
|
-
function _defineProperties$
|
|
474
|
+
function _defineProperties$5(target, props) {
|
|
471
475
|
for (var i = 0; i < props.length; i++) {
|
|
472
476
|
var descriptor = props[i];
|
|
473
477
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -476,11 +480,11 @@ function _defineProperties$4(target, props) {
|
|
|
476
480
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
477
481
|
}
|
|
478
482
|
}
|
|
479
|
-
function _create_class$
|
|
480
|
-
if (protoProps) _defineProperties$
|
|
483
|
+
function _create_class$5(Constructor, protoProps, staticProps) {
|
|
484
|
+
if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
|
|
481
485
|
return Constructor;
|
|
482
486
|
}
|
|
483
|
-
function _define_property$
|
|
487
|
+
function _define_property$4(obj, key, value) {
|
|
484
488
|
if (key in obj) {
|
|
485
489
|
Object.defineProperty(obj, key, {
|
|
486
490
|
value: value,
|
|
@@ -577,17 +581,17 @@ function _is_native_reflect_construct() {
|
|
|
577
581
|
var PgException = /*#__PURE__*/ (function (Error1) {
|
|
578
582
|
_inherits(PgException, Error1);
|
|
579
583
|
function PgException(err, message, specific) {
|
|
580
|
-
_class_call_check$
|
|
584
|
+
_class_call_check$5(this, PgException);
|
|
581
585
|
var _this;
|
|
582
586
|
(_this = _call_super(this, PgException, [message])),
|
|
583
|
-
_define_property$
|
|
584
|
-
_define_property$
|
|
587
|
+
_define_property$4(_this, 'err', void 0),
|
|
588
|
+
_define_property$4(_this, 'specific', void 0);
|
|
585
589
|
_this.name = 'PgError';
|
|
586
590
|
_this.err = err;
|
|
587
591
|
_this.specific = specific;
|
|
588
592
|
return _this;
|
|
589
593
|
}
|
|
590
|
-
_create_class$
|
|
594
|
+
_create_class$5(PgException, [
|
|
591
595
|
{
|
|
592
596
|
key: 'getStatus',
|
|
593
597
|
value: function getStatus() {
|
|
@@ -614,12 +618,12 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
614
618
|
return PgException;
|
|
615
619
|
})(_wrap_native_super(Error));
|
|
616
620
|
|
|
617
|
-
function _class_call_check$
|
|
621
|
+
function _class_call_check$4(instance, Constructor) {
|
|
618
622
|
if (!(instance instanceof Constructor)) {
|
|
619
623
|
throw new TypeError('Cannot call a class as a function');
|
|
620
624
|
}
|
|
621
625
|
}
|
|
622
|
-
function _defineProperties$
|
|
626
|
+
function _defineProperties$4(target, props) {
|
|
623
627
|
for (var i = 0; i < props.length; i++) {
|
|
624
628
|
var descriptor = props[i];
|
|
625
629
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -628,11 +632,11 @@ function _defineProperties$3(target, props) {
|
|
|
628
632
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
629
633
|
}
|
|
630
634
|
}
|
|
631
|
-
function _create_class$
|
|
632
|
-
if (protoProps) _defineProperties$
|
|
635
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
636
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
633
637
|
return Constructor;
|
|
634
638
|
}
|
|
635
|
-
function _define_property$
|
|
639
|
+
function _define_property$3(obj, key, value) {
|
|
636
640
|
if (key in obj) {
|
|
637
641
|
Object.defineProperty(obj, key, {
|
|
638
642
|
value: value,
|
|
@@ -660,10 +664,10 @@ var NO_OP = function (_message) {
|
|
|
660
664
|
};
|
|
661
665
|
var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
662
666
|
function ConsoleLogger(options) {
|
|
663
|
-
_class_call_check$
|
|
664
|
-
_define_property$
|
|
665
|
-
_define_property$
|
|
666
|
-
_define_property$
|
|
667
|
+
_class_call_check$4(this, ConsoleLogger);
|
|
668
|
+
_define_property$3(this, 'log', void 0);
|
|
669
|
+
_define_property$3(this, 'warn', void 0);
|
|
670
|
+
_define_property$3(this, 'error', void 0);
|
|
667
671
|
var level = (options || {}).level;
|
|
668
672
|
this.error = console.error.bind(console);
|
|
669
673
|
this.warn = NO_OP;
|
|
@@ -678,7 +682,7 @@ var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
|
678
682
|
break;
|
|
679
683
|
}
|
|
680
684
|
}
|
|
681
|
-
_create_class$
|
|
685
|
+
_create_class$4(ConsoleLogger, [
|
|
682
686
|
{
|
|
683
687
|
key: 'disable',
|
|
684
688
|
value: function disable() {
|
|
@@ -714,12 +718,12 @@ var logger = new ConsoleLogger({
|
|
|
714
718
|
level: LOG_LEVEL,
|
|
715
719
|
});
|
|
716
720
|
|
|
717
|
-
function _class_call_check$
|
|
721
|
+
function _class_call_check$3(instance, Constructor) {
|
|
718
722
|
if (!(instance instanceof Constructor)) {
|
|
719
723
|
throw new TypeError('Cannot call a class as a function');
|
|
720
724
|
}
|
|
721
725
|
}
|
|
722
|
-
function _defineProperties$
|
|
726
|
+
function _defineProperties$3(target, props) {
|
|
723
727
|
for (var i = 0; i < props.length; i++) {
|
|
724
728
|
var descriptor = props[i];
|
|
725
729
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -728,15 +732,15 @@ function _defineProperties$2(target, props) {
|
|
|
728
732
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
729
733
|
}
|
|
730
734
|
}
|
|
731
|
-
function _create_class$
|
|
732
|
-
if (staticProps) _defineProperties$
|
|
735
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
736
|
+
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
733
737
|
return Constructor;
|
|
734
738
|
}
|
|
735
739
|
var HttpHandler = /*#__PURE__*/ (function () {
|
|
736
740
|
function HttpHandler() {
|
|
737
|
-
_class_call_check$
|
|
741
|
+
_class_call_check$3(this, HttpHandler);
|
|
738
742
|
}
|
|
739
|
-
_create_class$
|
|
743
|
+
_create_class$3(HttpHandler, null, [
|
|
740
744
|
{
|
|
741
745
|
key: 'response',
|
|
742
746
|
value: function response(response) {
|
|
@@ -780,12 +784,12 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
780
784
|
return HttpHandler;
|
|
781
785
|
})();
|
|
782
786
|
|
|
783
|
-
function _class_call_check$
|
|
787
|
+
function _class_call_check$2(instance, Constructor) {
|
|
784
788
|
if (!(instance instanceof Constructor)) {
|
|
785
789
|
throw new TypeError('Cannot call a class as a function');
|
|
786
790
|
}
|
|
787
791
|
}
|
|
788
|
-
function _defineProperties$
|
|
792
|
+
function _defineProperties$2(target, props) {
|
|
789
793
|
for (var i = 0; i < props.length; i++) {
|
|
790
794
|
var descriptor = props[i];
|
|
791
795
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -794,11 +798,11 @@ function _defineProperties$1(target, props) {
|
|
|
794
798
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
795
799
|
}
|
|
796
800
|
}
|
|
797
|
-
function _create_class$
|
|
798
|
-
if (staticProps) _defineProperties$
|
|
801
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
802
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
799
803
|
return Constructor;
|
|
800
804
|
}
|
|
801
|
-
function _define_property(obj, key, value) {
|
|
805
|
+
function _define_property$2(obj, key, value) {
|
|
802
806
|
if (key in obj) {
|
|
803
807
|
Object.defineProperty(obj, key, {
|
|
804
808
|
value: value,
|
|
@@ -813,9 +817,9 @@ function _define_property(obj, key, value) {
|
|
|
813
817
|
}
|
|
814
818
|
var CookieHelper = /*#__PURE__*/ (function () {
|
|
815
819
|
function CookieHelper() {
|
|
816
|
-
_class_call_check$
|
|
820
|
+
_class_call_check$2(this, CookieHelper);
|
|
817
821
|
}
|
|
818
|
-
_create_class$
|
|
822
|
+
_create_class$2(CookieHelper, null, [
|
|
819
823
|
{
|
|
820
824
|
key: 'isProduction',
|
|
821
825
|
value: function isProduction() {
|
|
@@ -831,7 +835,7 @@ var CookieHelper = /*#__PURE__*/ (function () {
|
|
|
831
835
|
]);
|
|
832
836
|
return CookieHelper;
|
|
833
837
|
})();
|
|
834
|
-
_define_property(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
838
|
+
_define_property$2(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
835
839
|
|
|
836
840
|
function _type_of(obj) {
|
|
837
841
|
'@swc/helpers - typeof';
|
|
@@ -994,6 +998,189 @@ function parseTemplate(template) {
|
|
|
994
998
|
};
|
|
995
999
|
}
|
|
996
1000
|
|
|
1001
|
+
function _class_call_check$1(instance, Constructor) {
|
|
1002
|
+
if (!(instance instanceof Constructor)) {
|
|
1003
|
+
throw new TypeError('Cannot call a class as a function');
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
function _defineProperties$1(target, props) {
|
|
1007
|
+
for (var i = 0; i < props.length; i++) {
|
|
1008
|
+
var descriptor = props[i];
|
|
1009
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1010
|
+
descriptor.configurable = true;
|
|
1011
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
1012
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
1016
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
1017
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
1018
|
+
return Constructor;
|
|
1019
|
+
}
|
|
1020
|
+
function _define_property$1(obj, key, value) {
|
|
1021
|
+
if (key in obj) {
|
|
1022
|
+
Object.defineProperty(obj, key, {
|
|
1023
|
+
value: value,
|
|
1024
|
+
enumerable: true,
|
|
1025
|
+
configurable: true,
|
|
1026
|
+
writable: true,
|
|
1027
|
+
});
|
|
1028
|
+
} else {
|
|
1029
|
+
obj[key] = value;
|
|
1030
|
+
}
|
|
1031
|
+
return obj;
|
|
1032
|
+
}
|
|
1033
|
+
function _object_spread(target) {
|
|
1034
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1035
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1036
|
+
var ownKeys = Object.keys(source);
|
|
1037
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
1038
|
+
ownKeys = ownKeys.concat(
|
|
1039
|
+
Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
1040
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1041
|
+
})
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
ownKeys.forEach(function (key) {
|
|
1045
|
+
_define_property$1(target, key, source[key]);
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
return target;
|
|
1049
|
+
}
|
|
1050
|
+
var PatternCompiler = /*#__PURE__*/ (function () {
|
|
1051
|
+
function PatternCompiler(defaultView, installPlugins) {
|
|
1052
|
+
_class_call_check$1(this, PatternCompiler);
|
|
1053
|
+
_define_property$1(this, 'defaultView', void 0);
|
|
1054
|
+
_define_property$1(this, 'handlebars', void 0);
|
|
1055
|
+
this.defaultView = defaultView;
|
|
1056
|
+
this.handlebars = Handlebars.create();
|
|
1057
|
+
installPlugins(this.handlebars);
|
|
1058
|
+
}
|
|
1059
|
+
_create_class$1(
|
|
1060
|
+
PatternCompiler,
|
|
1061
|
+
[
|
|
1062
|
+
{
|
|
1063
|
+
key: 'compile',
|
|
1064
|
+
value: function compile(source, partialView) {
|
|
1065
|
+
if (!source) return '';
|
|
1066
|
+
var compiler = this.handlebars.compile(source);
|
|
1067
|
+
return compiler(_object_spread({}, this.defaultView, partialView));
|
|
1068
|
+
},
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
key: 'keyToTemplate',
|
|
1072
|
+
value: function keyToTemplate(key) {
|
|
1073
|
+
return PatternCompiler.keyToTemplate(key);
|
|
1074
|
+
},
|
|
1075
|
+
},
|
|
1076
|
+
],
|
|
1077
|
+
[
|
|
1078
|
+
{
|
|
1079
|
+
key: 'keyToTemplate',
|
|
1080
|
+
value: function keyToTemplate(key) {
|
|
1081
|
+
return '{{'.concat(key, '}}');
|
|
1082
|
+
},
|
|
1083
|
+
},
|
|
1084
|
+
]
|
|
1085
|
+
);
|
|
1086
|
+
return PatternCompiler;
|
|
1087
|
+
})();
|
|
1088
|
+
|
|
1089
|
+
var eqPlugin = function (handlebars) {
|
|
1090
|
+
handlebars.registerHelper('eq', function (a, b) {
|
|
1091
|
+
return a === b;
|
|
1092
|
+
});
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
function _array_like_to_array(arr, len) {
|
|
1096
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1097
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1098
|
+
return arr2;
|
|
1099
|
+
}
|
|
1100
|
+
function _array_without_holes(arr) {
|
|
1101
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
1102
|
+
}
|
|
1103
|
+
function _iterable_to_array(iter) {
|
|
1104
|
+
if (
|
|
1105
|
+
(typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||
|
|
1106
|
+
iter['@@iterator'] != null
|
|
1107
|
+
)
|
|
1108
|
+
return Array.from(iter);
|
|
1109
|
+
}
|
|
1110
|
+
function _non_iterable_spread() {
|
|
1111
|
+
throw new TypeError(
|
|
1112
|
+
'Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
function _to_consumable_array(arr) {
|
|
1116
|
+
return (
|
|
1117
|
+
_array_without_holes(arr) ||
|
|
1118
|
+
_iterable_to_array(arr) ||
|
|
1119
|
+
_unsupported_iterable_to_array(arr) ||
|
|
1120
|
+
_non_iterable_spread()
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
1124
|
+
if (!o) return;
|
|
1125
|
+
if (typeof o === 'string') return _array_like_to_array(o, minLen);
|
|
1126
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1127
|
+
if (n === 'Object' && o.constructor) n = o.constructor.name;
|
|
1128
|
+
if (n === 'Map' || n === 'Set') return Array.from(n);
|
|
1129
|
+
if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
1130
|
+
return _array_like_to_array(o, minLen);
|
|
1131
|
+
}
|
|
1132
|
+
var mdParser = new MarkdownIt();
|
|
1133
|
+
var markdownPlugin = function (handlebars) {
|
|
1134
|
+
handlebars.registerHelper('md', function (markdownText) {
|
|
1135
|
+
if (!markdownText) return '';
|
|
1136
|
+
var cleanHtml = sanitizeHtml(mdParser.render(markdownText), {
|
|
1137
|
+
allowedTags: _to_consumable_array([
|
|
1138
|
+
'h1',
|
|
1139
|
+
'h2',
|
|
1140
|
+
'h3',
|
|
1141
|
+
'h4',
|
|
1142
|
+
'h5',
|
|
1143
|
+
'h6',
|
|
1144
|
+
'b',
|
|
1145
|
+
]).concat(
|
|
1146
|
+
_to_consumable_array([
|
|
1147
|
+
'i',
|
|
1148
|
+
'strong',
|
|
1149
|
+
'em',
|
|
1150
|
+
'a',
|
|
1151
|
+
'ul',
|
|
1152
|
+
'ol',
|
|
1153
|
+
'li',
|
|
1154
|
+
'p',
|
|
1155
|
+
'br',
|
|
1156
|
+
])
|
|
1157
|
+
),
|
|
1158
|
+
allowedAttributes: {
|
|
1159
|
+
a: ['href', 'title', 'target'],
|
|
1160
|
+
},
|
|
1161
|
+
transformTags: {
|
|
1162
|
+
a: simpleTransform('a', {
|
|
1163
|
+
target: '_blank',
|
|
1164
|
+
rel: 'noopener',
|
|
1165
|
+
}),
|
|
1166
|
+
},
|
|
1167
|
+
});
|
|
1168
|
+
return new Handlebars.SafeString(cleanHtml);
|
|
1169
|
+
});
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
var stringPlugin = function (handlebars) {
|
|
1173
|
+
handlebars.registerHelper('subString', function (passedString, start, end) {
|
|
1174
|
+
var theString =
|
|
1175
|
+
passedString === null || passedString === void 0
|
|
1176
|
+
? void 0
|
|
1177
|
+
: passedString.substring(start, end);
|
|
1178
|
+
return new Handlebars.SafeString(
|
|
1179
|
+
theString !== null && theString !== void 0 ? theString : ''
|
|
1180
|
+
);
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
|
|
997
1184
|
function _class_call_check(instance, Constructor) {
|
|
998
1185
|
if (!(instance instanceof Constructor)) {
|
|
999
1186
|
throw new TypeError('Cannot call a class as a function');
|
|
@@ -1012,6 +1199,19 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
1012
1199
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1013
1200
|
return Constructor;
|
|
1014
1201
|
}
|
|
1202
|
+
function _define_property(obj, key, value) {
|
|
1203
|
+
if (key in obj) {
|
|
1204
|
+
Object.defineProperty(obj, key, {
|
|
1205
|
+
value: value,
|
|
1206
|
+
enumerable: true,
|
|
1207
|
+
configurable: true,
|
|
1208
|
+
writable: true,
|
|
1209
|
+
});
|
|
1210
|
+
} else {
|
|
1211
|
+
obj[key] = value;
|
|
1212
|
+
}
|
|
1213
|
+
return obj;
|
|
1214
|
+
}
|
|
1015
1215
|
function _instanceof(left, right) {
|
|
1016
1216
|
if (
|
|
1017
1217
|
right != null &&
|
|
@@ -1085,14 +1285,186 @@ var DateFormatter = /*#__PURE__*/ (function () {
|
|
|
1085
1285
|
]);
|
|
1086
1286
|
return DateFormatter;
|
|
1087
1287
|
})();
|
|
1288
|
+
_define_property(
|
|
1289
|
+
DateFormatter,
|
|
1290
|
+
'getZoneAdjustedWeekday',
|
|
1291
|
+
function (dateString, options) {
|
|
1292
|
+
var timezone = options.timezone;
|
|
1293
|
+
return new Date(dateString).toLocaleDateString(options.locale, {
|
|
1294
|
+
weekday: 'long',
|
|
1295
|
+
timeZone: timezone,
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
);
|
|
1299
|
+
_define_property(
|
|
1300
|
+
DateFormatter,
|
|
1301
|
+
'getZoneAdjustedDate',
|
|
1302
|
+
function (dateString, options) {
|
|
1303
|
+
var timezone = options.timezone;
|
|
1304
|
+
return new Date(dateString).toLocaleDateString(options.locale, {
|
|
1305
|
+
month: 'long',
|
|
1306
|
+
day: 'numeric',
|
|
1307
|
+
timeZone: timezone,
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
_define_property(
|
|
1312
|
+
DateFormatter,
|
|
1313
|
+
'getZoneAdjustedTime',
|
|
1314
|
+
function (dateString, options) {
|
|
1315
|
+
var timezone = options.timezone;
|
|
1316
|
+
return new Date(dateString)
|
|
1317
|
+
.toLocaleTimeString(options.locale, {
|
|
1318
|
+
hour: '2-digit',
|
|
1319
|
+
minute: '2-digit',
|
|
1320
|
+
hour12: false,
|
|
1321
|
+
timeZone: timezone,
|
|
1322
|
+
})
|
|
1323
|
+
.replace(/^0/, '');
|
|
1324
|
+
}
|
|
1325
|
+
);
|
|
1326
|
+
|
|
1327
|
+
var timezonePlugin = function (handlebars, param) {
|
|
1328
|
+
var timezone = param.timezone,
|
|
1329
|
+
locale = param.locale;
|
|
1330
|
+
handlebars.registerHelper('getZoneAdjustedWeekday', function (dateString) {
|
|
1331
|
+
return DateFormatter.getZoneAdjustedWeekday(dateString, {
|
|
1332
|
+
timezone: timezone,
|
|
1333
|
+
locale: locale,
|
|
1334
|
+
});
|
|
1335
|
+
});
|
|
1336
|
+
handlebars.registerHelper('getZoneAdjustedDate', function (dateString) {
|
|
1337
|
+
return DateFormatter.getZoneAdjustedDate(dateString, {
|
|
1338
|
+
timezone: timezone,
|
|
1339
|
+
locale: locale,
|
|
1340
|
+
});
|
|
1341
|
+
});
|
|
1342
|
+
handlebars.registerHelper('getZoneAdjustedTime', function (dateString) {
|
|
1343
|
+
return DateFormatter.getZoneAdjustedTime(dateString, {
|
|
1344
|
+
timezone: timezone,
|
|
1345
|
+
locale: locale,
|
|
1346
|
+
});
|
|
1347
|
+
});
|
|
1348
|
+
};
|
|
1349
|
+
|
|
1350
|
+
var urlPlugin = function (handlebars) {
|
|
1351
|
+
handlebars.registerHelper('urlSafe', function (inputString) {
|
|
1352
|
+
return encodeURIComponent(String(inputString));
|
|
1353
|
+
});
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
var userTimezonePlugin = function (handlebars, param) {
|
|
1357
|
+
var timezone = param.timezone,
|
|
1358
|
+
locale = param.locale;
|
|
1359
|
+
handlebars.registerHelper(
|
|
1360
|
+
'getUserZoneAdjustedWeekday',
|
|
1361
|
+
function (dateString, options) {
|
|
1362
|
+
var _options_hash, _options_hash1;
|
|
1363
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1364
|
+
return DateFormatter.getZoneAdjustedWeekday(dateString, {
|
|
1365
|
+
timezone:
|
|
1366
|
+
(_options_hash_timezone =
|
|
1367
|
+
options === null || options === void 0
|
|
1368
|
+
? void 0
|
|
1369
|
+
: (_options_hash = options.hash) === null ||
|
|
1370
|
+
_options_hash === void 0
|
|
1371
|
+
? void 0
|
|
1372
|
+
: _options_hash.timezone) !== null &&
|
|
1373
|
+
_options_hash_timezone !== void 0
|
|
1374
|
+
? _options_hash_timezone
|
|
1375
|
+
: timezone,
|
|
1376
|
+
locale:
|
|
1377
|
+
(_options_hash_locale =
|
|
1378
|
+
options === null || options === void 0
|
|
1379
|
+
? void 0
|
|
1380
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1381
|
+
_options_hash1 === void 0
|
|
1382
|
+
? void 0
|
|
1383
|
+
: _options_hash1.locale) !== null &&
|
|
1384
|
+
_options_hash_locale !== void 0
|
|
1385
|
+
? _options_hash_locale
|
|
1386
|
+
: locale,
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
handlebars.registerHelper(
|
|
1391
|
+
'getUserZoneAdjustedDate',
|
|
1392
|
+
function (dateString, options) {
|
|
1393
|
+
var _options_hash, _options_hash1;
|
|
1394
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1395
|
+
return DateFormatter.getZoneAdjustedDate(dateString, {
|
|
1396
|
+
timezone:
|
|
1397
|
+
(_options_hash_timezone =
|
|
1398
|
+
options === null || options === void 0
|
|
1399
|
+
? void 0
|
|
1400
|
+
: (_options_hash = options.hash) === null ||
|
|
1401
|
+
_options_hash === void 0
|
|
1402
|
+
? void 0
|
|
1403
|
+
: _options_hash.timezone) !== null &&
|
|
1404
|
+
_options_hash_timezone !== void 0
|
|
1405
|
+
? _options_hash_timezone
|
|
1406
|
+
: timezone,
|
|
1407
|
+
locale:
|
|
1408
|
+
(_options_hash_locale =
|
|
1409
|
+
options === null || options === void 0
|
|
1410
|
+
? void 0
|
|
1411
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1412
|
+
_options_hash1 === void 0
|
|
1413
|
+
? void 0
|
|
1414
|
+
: _options_hash1.locale) !== null &&
|
|
1415
|
+
_options_hash_locale !== void 0
|
|
1416
|
+
? _options_hash_locale
|
|
1417
|
+
: locale,
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
);
|
|
1421
|
+
handlebars.registerHelper(
|
|
1422
|
+
'getUserZoneAdjustedTime',
|
|
1423
|
+
function (dateString, options) {
|
|
1424
|
+
var _options_hash, _options_hash1;
|
|
1425
|
+
var _options_hash_timezone, _options_hash_locale;
|
|
1426
|
+
return DateFormatter.getZoneAdjustedTime(dateString, {
|
|
1427
|
+
timezone:
|
|
1428
|
+
(_options_hash_timezone =
|
|
1429
|
+
options === null || options === void 0
|
|
1430
|
+
? void 0
|
|
1431
|
+
: (_options_hash = options.hash) === null ||
|
|
1432
|
+
_options_hash === void 0
|
|
1433
|
+
? void 0
|
|
1434
|
+
: _options_hash.timezone) !== null &&
|
|
1435
|
+
_options_hash_timezone !== void 0
|
|
1436
|
+
? _options_hash_timezone
|
|
1437
|
+
: timezone,
|
|
1438
|
+
locale:
|
|
1439
|
+
(_options_hash_locale =
|
|
1440
|
+
options === null || options === void 0
|
|
1441
|
+
? void 0
|
|
1442
|
+
: (_options_hash1 = options.hash) === null ||
|
|
1443
|
+
_options_hash1 === void 0
|
|
1444
|
+
? void 0
|
|
1445
|
+
: _options_hash1.locale) !== null &&
|
|
1446
|
+
_options_hash_locale !== void 0
|
|
1447
|
+
? _options_hash_locale
|
|
1448
|
+
: locale,
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
);
|
|
1452
|
+
};
|
|
1088
1453
|
|
|
1089
1454
|
export {
|
|
1090
1455
|
CookieHelper,
|
|
1091
1456
|
DateFormatter,
|
|
1092
1457
|
HttpHandler,
|
|
1093
1458
|
NativeException,
|
|
1459
|
+
PatternCompiler,
|
|
1094
1460
|
PgException,
|
|
1095
1461
|
PostgresError,
|
|
1462
|
+
eqPlugin,
|
|
1096
1463
|
logger,
|
|
1464
|
+
markdownPlugin,
|
|
1097
1465
|
parseTemplate,
|
|
1466
|
+
stringPlugin,
|
|
1467
|
+
timezonePlugin,
|
|
1468
|
+
urlPlugin,
|
|
1469
|
+
userTimezonePlugin,
|
|
1098
1470
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-systems/utility",
|
|
3
|
-
"description": "Utility functions and types for native
|
|
3
|
+
"description": "Utility functions and types for native systems projects.",
|
|
4
4
|
"author": "AACN Software- und Systementwicklung GmbH",
|
|
5
5
|
"homepage": "https://github.com/aacn/utility#readme",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"version": "
|
|
13
|
+
"version": "2.0.0",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"private": false,
|
|
16
16
|
"engines": {
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"main"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"dependencies": {
|
|
65
|
+
"dependencies": {
|
|
66
|
+
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
68
69
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -70,9 +71,15 @@
|
|
|
70
71
|
"@swc/cli": "^0.5.0",
|
|
71
72
|
"@swc/core": "^1.3.77",
|
|
72
73
|
"@swc/jest": "^0.2.37",
|
|
74
|
+
"@types/react": "^19.1.12",
|
|
75
|
+
"@types/react-dom": "^19.1.9",
|
|
76
|
+
"@types/markdown-it": "^14.1.2",
|
|
73
77
|
"@types/node": "^20",
|
|
78
|
+
"@types/sanitize-html": "^2.16.0",
|
|
79
|
+
"handlebars": "^4.7.8",
|
|
74
80
|
"husky": "^9.1.6",
|
|
75
81
|
"lint-staged": "^13.0.3",
|
|
82
|
+
"markdown-it": "^14.1.0",
|
|
76
83
|
"npm-run-all": "^4.1.5",
|
|
77
84
|
"prettier": "3.0.3",
|
|
78
85
|
"rollup": "^4.26.0",
|
|
@@ -83,7 +90,13 @@
|
|
|
83
90
|
"rollup-plugin-swc3": "^0.12.1",
|
|
84
91
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
85
92
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
93
|
+
"sanitize-html": "^2.17.0",
|
|
86
94
|
"ts-node": "^10.9.1",
|
|
87
95
|
"typescript": "5.6.3"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"handlebars": "^4",
|
|
99
|
+
"markdown-it": "^14",
|
|
100
|
+
"sanitize-html": "^2.17"
|
|
88
101
|
}
|
|
89
102
|
}
|