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