@native-systems/utility 1.2.0 → 1.3.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 +6 -0
- package/dist/index.cjs +285 -30
- package/dist/index.d.ts +81 -0
- package/dist/index.esm.js +285 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
# Native system utility package
|
|
2
2
|
This package contains utility functions and types, which are used across native system software projects.
|
|
3
|
+
|
|
4
|
+
## Steps to deploy new version
|
|
5
|
+
1. Update package version.
|
|
6
|
+
2. Build project via `yarn build`
|
|
7
|
+
3. Publish build via `npm publish`
|
|
8
|
+
4. Push changes to repository
|
package/dist/index.cjs
CHANGED
|
@@ -296,7 +296,7 @@ function _call_super$1(_this, derived, args) {
|
|
|
296
296
|
: derived.apply(_this, args)
|
|
297
297
|
);
|
|
298
298
|
}
|
|
299
|
-
function _class_call_check$
|
|
299
|
+
function _class_call_check$5(instance, Constructor) {
|
|
300
300
|
if (!(instance instanceof Constructor)) {
|
|
301
301
|
throw new TypeError('Cannot call a class as a function');
|
|
302
302
|
}
|
|
@@ -354,7 +354,7 @@ function _is_native_function$1(fn) {
|
|
|
354
354
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
355
355
|
}
|
|
356
356
|
function _possible_constructor_return$1(self, call) {
|
|
357
|
-
if (call && (_type_of$
|
|
357
|
+
if (call && (_type_of$2(call) === 'object' || typeof call === 'function')) {
|
|
358
358
|
return call;
|
|
359
359
|
}
|
|
360
360
|
return _assert_this_initialized$1(self);
|
|
@@ -368,7 +368,7 @@ function _set_prototype_of$1(o, p) {
|
|
|
368
368
|
};
|
|
369
369
|
return _set_prototype_of$1(o, p);
|
|
370
370
|
}
|
|
371
|
-
function _type_of$
|
|
371
|
+
function _type_of$2(obj) {
|
|
372
372
|
'@swc/helpers - typeof';
|
|
373
373
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
374
374
|
? 'symbol'
|
|
@@ -417,7 +417,7 @@ function _is_native_reflect_construct$1() {
|
|
|
417
417
|
var NativeException = /*#__PURE__*/ (function (Error1) {
|
|
418
418
|
_inherits$1(NativeException, Error1);
|
|
419
419
|
function NativeException(code, message) {
|
|
420
|
-
_class_call_check$
|
|
420
|
+
_class_call_check$5(this, NativeException);
|
|
421
421
|
var _this;
|
|
422
422
|
(_this = _call_super$1(this, NativeException, [message])),
|
|
423
423
|
_define_property$3(_this, 'code', void 0);
|
|
@@ -449,7 +449,7 @@ function _call_super(_this, derived, args) {
|
|
|
449
449
|
: derived.apply(_this, args)
|
|
450
450
|
);
|
|
451
451
|
}
|
|
452
|
-
function _class_call_check$
|
|
452
|
+
function _class_call_check$4(instance, Constructor) {
|
|
453
453
|
if (!(instance instanceof Constructor)) {
|
|
454
454
|
throw new TypeError('Cannot call a class as a function');
|
|
455
455
|
}
|
|
@@ -469,7 +469,7 @@ function _construct(Parent, args, Class) {
|
|
|
469
469
|
}
|
|
470
470
|
return _construct.apply(null, arguments);
|
|
471
471
|
}
|
|
472
|
-
function _defineProperties$
|
|
472
|
+
function _defineProperties$4(target, props) {
|
|
473
473
|
for (var i = 0; i < props.length; i++) {
|
|
474
474
|
var descriptor = props[i];
|
|
475
475
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -478,8 +478,8 @@ function _defineProperties$3(target, props) {
|
|
|
478
478
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
function _create_class$
|
|
482
|
-
if (protoProps) _defineProperties$
|
|
481
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
482
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
483
483
|
return Constructor;
|
|
484
484
|
}
|
|
485
485
|
function _define_property$2(obj, key, value) {
|
|
@@ -520,7 +520,7 @@ function _is_native_function(fn) {
|
|
|
520
520
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
521
521
|
}
|
|
522
522
|
function _possible_constructor_return(self, call) {
|
|
523
|
-
if (call && (_type_of(call) === 'object' || typeof call === 'function')) {
|
|
523
|
+
if (call && (_type_of$1(call) === 'object' || typeof call === 'function')) {
|
|
524
524
|
return call;
|
|
525
525
|
}
|
|
526
526
|
return _assert_this_initialized(self);
|
|
@@ -534,7 +534,7 @@ function _set_prototype_of(o, p) {
|
|
|
534
534
|
};
|
|
535
535
|
return _set_prototype_of(o, p);
|
|
536
536
|
}
|
|
537
|
-
function _type_of(obj) {
|
|
537
|
+
function _type_of$1(obj) {
|
|
538
538
|
'@swc/helpers - typeof';
|
|
539
539
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
540
540
|
? 'symbol'
|
|
@@ -579,7 +579,7 @@ function _is_native_reflect_construct() {
|
|
|
579
579
|
var PgException = /*#__PURE__*/ (function (Error1) {
|
|
580
580
|
_inherits(PgException, Error1);
|
|
581
581
|
function PgException(err, message, specific) {
|
|
582
|
-
_class_call_check$
|
|
582
|
+
_class_call_check$4(this, PgException);
|
|
583
583
|
var _this;
|
|
584
584
|
(_this = _call_super(this, PgException, [message])),
|
|
585
585
|
_define_property$2(_this, 'err', void 0),
|
|
@@ -589,7 +589,7 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
589
589
|
_this.specific = specific;
|
|
590
590
|
return _this;
|
|
591
591
|
}
|
|
592
|
-
_create_class$
|
|
592
|
+
_create_class$4(PgException, [
|
|
593
593
|
{
|
|
594
594
|
key: 'getStatus',
|
|
595
595
|
value: function getStatus() {
|
|
@@ -616,12 +616,12 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
616
616
|
return PgException;
|
|
617
617
|
})(_wrap_native_super(Error));
|
|
618
618
|
|
|
619
|
-
function _class_call_check$
|
|
619
|
+
function _class_call_check$3(instance, Constructor) {
|
|
620
620
|
if (!(instance instanceof Constructor)) {
|
|
621
621
|
throw new TypeError('Cannot call a class as a function');
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
function _defineProperties$
|
|
624
|
+
function _defineProperties$3(target, props) {
|
|
625
625
|
for (var i = 0; i < props.length; i++) {
|
|
626
626
|
var descriptor = props[i];
|
|
627
627
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -630,8 +630,8 @@ function _defineProperties$2(target, props) {
|
|
|
630
630
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
function _create_class$
|
|
634
|
-
if (protoProps) _defineProperties$
|
|
633
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
634
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
635
635
|
return Constructor;
|
|
636
636
|
}
|
|
637
637
|
function _define_property$1(obj, key, value) {
|
|
@@ -662,7 +662,7 @@ var NO_OP = function (_message) {
|
|
|
662
662
|
};
|
|
663
663
|
var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
664
664
|
function ConsoleLogger(options) {
|
|
665
|
-
_class_call_check$
|
|
665
|
+
_class_call_check$3(this, ConsoleLogger);
|
|
666
666
|
_define_property$1(this, 'log', void 0);
|
|
667
667
|
_define_property$1(this, 'warn', void 0);
|
|
668
668
|
_define_property$1(this, 'error', void 0);
|
|
@@ -680,7 +680,7 @@ var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
|
680
680
|
break;
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
-
_create_class$
|
|
683
|
+
_create_class$3(ConsoleLogger, [
|
|
684
684
|
{
|
|
685
685
|
key: 'disable',
|
|
686
686
|
value: function disable() {
|
|
@@ -716,12 +716,12 @@ var logger = new ConsoleLogger({
|
|
|
716
716
|
level: LOG_LEVEL,
|
|
717
717
|
});
|
|
718
718
|
|
|
719
|
-
function _class_call_check$
|
|
719
|
+
function _class_call_check$2(instance, Constructor) {
|
|
720
720
|
if (!(instance instanceof Constructor)) {
|
|
721
721
|
throw new TypeError('Cannot call a class as a function');
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
function _defineProperties$
|
|
724
|
+
function _defineProperties$2(target, props) {
|
|
725
725
|
for (var i = 0; i < props.length; i++) {
|
|
726
726
|
var descriptor = props[i];
|
|
727
727
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -730,15 +730,15 @@ function _defineProperties$1(target, props) {
|
|
|
730
730
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
function _create_class$
|
|
734
|
-
if (staticProps) _defineProperties$
|
|
733
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
734
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
735
735
|
return Constructor;
|
|
736
736
|
}
|
|
737
737
|
var HttpHandler = /*#__PURE__*/ (function () {
|
|
738
738
|
function HttpHandler() {
|
|
739
|
-
_class_call_check$
|
|
739
|
+
_class_call_check$2(this, HttpHandler);
|
|
740
740
|
}
|
|
741
|
-
_create_class$
|
|
741
|
+
_create_class$2(HttpHandler, null, [
|
|
742
742
|
{
|
|
743
743
|
key: 'response',
|
|
744
744
|
value: function response(response) {
|
|
@@ -782,12 +782,12 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
782
782
|
return HttpHandler;
|
|
783
783
|
})();
|
|
784
784
|
|
|
785
|
-
function _class_call_check(instance, Constructor) {
|
|
785
|
+
function _class_call_check$1(instance, Constructor) {
|
|
786
786
|
if (!(instance instanceof Constructor)) {
|
|
787
787
|
throw new TypeError('Cannot call a class as a function');
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
function _defineProperties(target, props) {
|
|
790
|
+
function _defineProperties$1(target, props) {
|
|
791
791
|
for (var i = 0; i < props.length; i++) {
|
|
792
792
|
var descriptor = props[i];
|
|
793
793
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -796,8 +796,8 @@ function _defineProperties(target, props) {
|
|
|
796
796
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
800
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
799
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
800
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
801
801
|
return Constructor;
|
|
802
802
|
}
|
|
803
803
|
function _define_property(obj, key, value) {
|
|
@@ -815,9 +815,9 @@ function _define_property(obj, key, value) {
|
|
|
815
815
|
}
|
|
816
816
|
var CookieHelper = /*#__PURE__*/ (function () {
|
|
817
817
|
function CookieHelper() {
|
|
818
|
-
_class_call_check(this, CookieHelper);
|
|
818
|
+
_class_call_check$1(this, CookieHelper);
|
|
819
819
|
}
|
|
820
|
-
_create_class(CookieHelper, null, [
|
|
820
|
+
_create_class$1(CookieHelper, null, [
|
|
821
821
|
{
|
|
822
822
|
key: 'isProduction',
|
|
823
823
|
value: function isProduction() {
|
|
@@ -835,9 +835,264 @@ var CookieHelper = /*#__PURE__*/ (function () {
|
|
|
835
835
|
})();
|
|
836
836
|
_define_property(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
837
837
|
|
|
838
|
+
function _type_of(obj) {
|
|
839
|
+
'@swc/helpers - typeof';
|
|
840
|
+
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
841
|
+
? 'symbol'
|
|
842
|
+
: typeof obj;
|
|
843
|
+
}
|
|
844
|
+
function encodeReserved(str) {
|
|
845
|
+
return str
|
|
846
|
+
.split(/(%[0-9A-Fa-f]{2})/g)
|
|
847
|
+
.map(function (part) {
|
|
848
|
+
if (!/%[0-9A-Fa-f]/.test(part)) {
|
|
849
|
+
part = encodeURI(part).replace(/%5B/g, '[').replace(/%5D/g, ']');
|
|
850
|
+
}
|
|
851
|
+
return part;
|
|
852
|
+
})
|
|
853
|
+
.join('');
|
|
854
|
+
}
|
|
855
|
+
function encodeUnreserved(str) {
|
|
856
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
857
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
function encodeValue(operator, value, key) {
|
|
861
|
+
value =
|
|
862
|
+
operator === '+' || operator === '#'
|
|
863
|
+
? encodeReserved(value)
|
|
864
|
+
: encodeUnreserved(value);
|
|
865
|
+
if (key) {
|
|
866
|
+
return encodeUnreserved(key) + '=' + value;
|
|
867
|
+
} else {
|
|
868
|
+
return value;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function isDefined(value) {
|
|
872
|
+
return value !== undefined && value !== null;
|
|
873
|
+
}
|
|
874
|
+
function isKeyOperator(operator) {
|
|
875
|
+
return operator === ';' || operator === '&' || operator === '?';
|
|
876
|
+
}
|
|
877
|
+
function getValues(context, operator, key, modifier) {
|
|
878
|
+
var value = context[key],
|
|
879
|
+
result = [];
|
|
880
|
+
if (isDefined(value) && value !== '') {
|
|
881
|
+
if (
|
|
882
|
+
typeof value === 'string' ||
|
|
883
|
+
typeof value === 'number' ||
|
|
884
|
+
typeof value === 'boolean'
|
|
885
|
+
) {
|
|
886
|
+
value = value.toString();
|
|
887
|
+
if (modifier && modifier !== '*') {
|
|
888
|
+
value = value.substring(0, parseInt(modifier, 10));
|
|
889
|
+
}
|
|
890
|
+
result.push(
|
|
891
|
+
encodeValue(operator, value, isKeyOperator(operator) ? key : null)
|
|
892
|
+
);
|
|
893
|
+
} else {
|
|
894
|
+
if (modifier === '*') {
|
|
895
|
+
if (Array.isArray(value)) {
|
|
896
|
+
value.filter(isDefined).forEach(function (value) {
|
|
897
|
+
result.push(
|
|
898
|
+
encodeValue(
|
|
899
|
+
operator,
|
|
900
|
+
String(value),
|
|
901
|
+
isKeyOperator(operator) ? key : null
|
|
902
|
+
)
|
|
903
|
+
);
|
|
904
|
+
});
|
|
905
|
+
} else if (
|
|
906
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
907
|
+
'object' &&
|
|
908
|
+
value !== null
|
|
909
|
+
) {
|
|
910
|
+
Object.keys(value).forEach(function (k) {
|
|
911
|
+
if (isDefined(value[k])) {
|
|
912
|
+
result.push(encodeValue(operator, String(value[k]), k));
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
} else {
|
|
917
|
+
var tmp = [];
|
|
918
|
+
if (Array.isArray(value)) {
|
|
919
|
+
value.filter(isDefined).forEach(function (value) {
|
|
920
|
+
tmp.push(encodeValue(operator, String(value)));
|
|
921
|
+
});
|
|
922
|
+
} else if (
|
|
923
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
924
|
+
'object' &&
|
|
925
|
+
value !== null
|
|
926
|
+
) {
|
|
927
|
+
Object.keys(value).forEach(function (k) {
|
|
928
|
+
if (isDefined(value[k])) {
|
|
929
|
+
tmp.push(encodeUnreserved(k));
|
|
930
|
+
tmp.push(encodeValue(operator, String(value[k])));
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
if (isKeyOperator(operator)) {
|
|
935
|
+
result.push(encodeUnreserved(key) + '=' + tmp.join(','));
|
|
936
|
+
} else if (tmp.length !== 0) {
|
|
937
|
+
result.push(tmp.join(','));
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
} else {
|
|
942
|
+
if (operator === ';') {
|
|
943
|
+
if (isDefined(value)) {
|
|
944
|
+
result.push(encodeUnreserved(key));
|
|
945
|
+
}
|
|
946
|
+
} else if (value === '' && (operator === '&' || operator === '?')) {
|
|
947
|
+
result.push(encodeUnreserved(key) + '=');
|
|
948
|
+
} else if (value === '') {
|
|
949
|
+
result.push('');
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return result;
|
|
953
|
+
}
|
|
954
|
+
function parseTemplate(template) {
|
|
955
|
+
var operators = ['+', '#', '.', '/', ';', '?', '&'];
|
|
956
|
+
return {
|
|
957
|
+
expand: function expand(context) {
|
|
958
|
+
return template.replace(
|
|
959
|
+
/\{([^{}]+)}|([^{}]+)/g,
|
|
960
|
+
function (_, expression, literal) {
|
|
961
|
+
if (expression) {
|
|
962
|
+
var operator = null,
|
|
963
|
+
values = [];
|
|
964
|
+
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
|
965
|
+
operator = expression.charAt(0);
|
|
966
|
+
expression = expression.substring(1);
|
|
967
|
+
}
|
|
968
|
+
expression.split(/,/g).forEach(function (variable) {
|
|
969
|
+
var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
|
|
970
|
+
if (tmp) {
|
|
971
|
+
values.push.apply(
|
|
972
|
+
values,
|
|
973
|
+
getValues(context, operator, tmp[1], tmp[2] || tmp[3])
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
if (operator && operator !== '+') {
|
|
978
|
+
var separator = ',';
|
|
979
|
+
if (operator === '?') {
|
|
980
|
+
separator = '&';
|
|
981
|
+
} else if (operator !== '#') {
|
|
982
|
+
separator = operator;
|
|
983
|
+
}
|
|
984
|
+
return (
|
|
985
|
+
(values.length !== 0 ? operator : '') + values.join(separator)
|
|
986
|
+
);
|
|
987
|
+
} else {
|
|
988
|
+
return values.join(',');
|
|
989
|
+
}
|
|
990
|
+
} else {
|
|
991
|
+
return encodeReserved(literal);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
},
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function _class_call_check(instance, Constructor) {
|
|
1000
|
+
if (!(instance instanceof Constructor)) {
|
|
1001
|
+
throw new TypeError('Cannot call a class as a function');
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
function _defineProperties(target, props) {
|
|
1005
|
+
for (var i = 0; i < props.length; i++) {
|
|
1006
|
+
var descriptor = props[i];
|
|
1007
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1008
|
+
descriptor.configurable = true;
|
|
1009
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
1010
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
1014
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1015
|
+
return Constructor;
|
|
1016
|
+
}
|
|
1017
|
+
function _instanceof(left, right) {
|
|
1018
|
+
if (
|
|
1019
|
+
right != null &&
|
|
1020
|
+
typeof Symbol !== 'undefined' &&
|
|
1021
|
+
right[Symbol.hasInstance]
|
|
1022
|
+
) {
|
|
1023
|
+
return !!right[Symbol.hasInstance](left);
|
|
1024
|
+
} else {
|
|
1025
|
+
return left instanceof right;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
var DateFormatter = /*#__PURE__*/ (function () {
|
|
1029
|
+
function DateFormatter() {
|
|
1030
|
+
_class_call_check(this, DateFormatter);
|
|
1031
|
+
}
|
|
1032
|
+
_create_class(DateFormatter, null, [
|
|
1033
|
+
{
|
|
1034
|
+
key: 'format',
|
|
1035
|
+
value: function format(date) {
|
|
1036
|
+
var validDate;
|
|
1037
|
+
if (typeof date === 'string') {
|
|
1038
|
+
validDate = new Date(date);
|
|
1039
|
+
} else {
|
|
1040
|
+
validDate = date;
|
|
1041
|
+
}
|
|
1042
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1043
|
+
day: '2-digit',
|
|
1044
|
+
month: '2-digit',
|
|
1045
|
+
year: 'numeric',
|
|
1046
|
+
hour: '2-digit',
|
|
1047
|
+
minute: '2-digit',
|
|
1048
|
+
}).format(validDate);
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
key: 'formatFormal',
|
|
1053
|
+
value: function formatFormal(date) {
|
|
1054
|
+
var validDate;
|
|
1055
|
+
if (typeof date === 'string') {
|
|
1056
|
+
validDate = new Date(date);
|
|
1057
|
+
} else if (_instanceof(date, Date)) {
|
|
1058
|
+
validDate = date;
|
|
1059
|
+
} else {
|
|
1060
|
+
return 'INVALID '.concat(date);
|
|
1061
|
+
}
|
|
1062
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1063
|
+
day: '2-digit',
|
|
1064
|
+
month: '2-digit',
|
|
1065
|
+
year: 'numeric',
|
|
1066
|
+
}).format(validDate);
|
|
1067
|
+
},
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
key: 'formatMini',
|
|
1071
|
+
value: function formatMini(date) {
|
|
1072
|
+
var validDate;
|
|
1073
|
+
if (typeof date === 'string') {
|
|
1074
|
+
validDate = new Date(date);
|
|
1075
|
+
} else if (_instanceof(date, Date)) {
|
|
1076
|
+
validDate = date;
|
|
1077
|
+
} else {
|
|
1078
|
+
throw new RangeError('Invalid time value: ' + date);
|
|
1079
|
+
}
|
|
1080
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1081
|
+
day: 'numeric',
|
|
1082
|
+
month: 'long',
|
|
1083
|
+
year: 'numeric',
|
|
1084
|
+
}).format(validDate);
|
|
1085
|
+
},
|
|
1086
|
+
},
|
|
1087
|
+
]);
|
|
1088
|
+
return DateFormatter;
|
|
1089
|
+
})();
|
|
1090
|
+
|
|
838
1091
|
exports.CookieHelper = CookieHelper;
|
|
1092
|
+
exports.DateFormatter = DateFormatter;
|
|
839
1093
|
exports.HttpHandler = HttpHandler;
|
|
840
1094
|
exports.NativeException = NativeException;
|
|
841
1095
|
exports.PgException = PgException;
|
|
842
1096
|
exports.PostgresError = PostgresError;
|
|
843
1097
|
exports.logger = logger;
|
|
1098
|
+
exports.parseTemplate = parseTemplate;
|
package/dist/index.d.ts
CHANGED
|
@@ -678,6 +678,49 @@ declare module "@native-systems/utility" {
|
|
|
678
678
|
export type { Native };
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
+
declare module "@native-systems/utility" {
|
|
682
|
+
type Paginated<T> = {
|
|
683
|
+
hasNextPage: boolean;
|
|
684
|
+
hasPrevPage: boolean;
|
|
685
|
+
totalPages: number;
|
|
686
|
+
data: T;
|
|
687
|
+
};
|
|
688
|
+
export type { Paginated };
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
declare module "@native-systems/utility" {
|
|
692
|
+
type CancelableComponent<T> = {
|
|
693
|
+
value: T;
|
|
694
|
+
cancel: () => void;
|
|
695
|
+
};
|
|
696
|
+
export type { CancelableComponent };
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare module "@native-systems/utility" {
|
|
700
|
+
type CRUDCompontent<T, U = T, V = U> = {
|
|
701
|
+
value: T;
|
|
702
|
+
add: (value: U) => void;
|
|
703
|
+
delete: (id: string) => void;
|
|
704
|
+
update: (id: string, value: V) => void;
|
|
705
|
+
};
|
|
706
|
+
export type { CRUDCompontent };
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
declare module "@native-systems/utility" {
|
|
710
|
+
import { Dispatch, SetStateAction } from "react";
|
|
711
|
+
type UseStateComponent<T, U = T> = {
|
|
712
|
+
current: T;
|
|
713
|
+
update: (value: U) => void;
|
|
714
|
+
};
|
|
715
|
+
/** Same grouping type as the UseStateComponent type, with the difference,
|
|
716
|
+
* that here the update function is directly linked with the useState variable. */
|
|
717
|
+
type DirectUseStateComponent<T> = {
|
|
718
|
+
current: T;
|
|
719
|
+
update: Dispatch<SetStateAction<T>>;
|
|
720
|
+
};
|
|
721
|
+
export type { DirectUseStateComponent, UseStateComponent };
|
|
722
|
+
}
|
|
723
|
+
|
|
681
724
|
declare module "@native-systems/utility" {
|
|
682
725
|
import { Native } from "@/types";
|
|
683
726
|
class HttpHandler {
|
|
@@ -722,3 +765,41 @@ declare module "@native-systems/utility" {
|
|
|
722
765
|
}
|
|
723
766
|
export { CookieHelper };
|
|
724
767
|
}
|
|
768
|
+
|
|
769
|
+
declare module "@native-systems/utility" {
|
|
770
|
+
export function parseTemplate(template: string): {
|
|
771
|
+
expand: (context: Record<string, unknown>) => string;
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
declare module "@native-systems/utility" {
|
|
776
|
+
export class DateFormatter {
|
|
777
|
+
/**
|
|
778
|
+
* Formats a date with time in German format
|
|
779
|
+
* @param date Date object or date string to format
|
|
780
|
+
* @returns Formatted date string
|
|
781
|
+
* @example
|
|
782
|
+
* // Returns "14.08.2025, 15:30"
|
|
783
|
+
* DateFormatter.format(new Date('2025-08-14T15:30:00'))
|
|
784
|
+
*/
|
|
785
|
+
static format(date: Date | string): string;
|
|
786
|
+
/**
|
|
787
|
+
* Formats a date in formal German format without time
|
|
788
|
+
* @param date Date object or date string to format
|
|
789
|
+
* @returns Formatted date string
|
|
790
|
+
* @example
|
|
791
|
+
* // Returns "14.08.2025"
|
|
792
|
+
* DateFormatter.formatFormal(new Date('2025-08-14T15:30:00'))
|
|
793
|
+
*/
|
|
794
|
+
static formatFormal(date: Date | string): string;
|
|
795
|
+
/**
|
|
796
|
+
* Formats a date in German format with full month name
|
|
797
|
+
* @param date Date object or date string to format
|
|
798
|
+
* @returns Formatted date string
|
|
799
|
+
* @example
|
|
800
|
+
* // Returns "14. August 2025"
|
|
801
|
+
* DateFormatter.formatMini(new Date('2025-08-14T15:30:00'))
|
|
802
|
+
*/
|
|
803
|
+
static formatMini(date: Date | string): string;
|
|
804
|
+
}
|
|
805
|
+
}
|
package/dist/index.esm.js
CHANGED
|
@@ -294,7 +294,7 @@ function _call_super$1(_this, derived, args) {
|
|
|
294
294
|
: derived.apply(_this, args)
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
|
-
function _class_call_check$
|
|
297
|
+
function _class_call_check$5(instance, Constructor) {
|
|
298
298
|
if (!(instance instanceof Constructor)) {
|
|
299
299
|
throw new TypeError('Cannot call a class as a function');
|
|
300
300
|
}
|
|
@@ -352,7 +352,7 @@ function _is_native_function$1(fn) {
|
|
|
352
352
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
353
353
|
}
|
|
354
354
|
function _possible_constructor_return$1(self, call) {
|
|
355
|
-
if (call && (_type_of$
|
|
355
|
+
if (call && (_type_of$2(call) === 'object' || typeof call === 'function')) {
|
|
356
356
|
return call;
|
|
357
357
|
}
|
|
358
358
|
return _assert_this_initialized$1(self);
|
|
@@ -366,7 +366,7 @@ function _set_prototype_of$1(o, p) {
|
|
|
366
366
|
};
|
|
367
367
|
return _set_prototype_of$1(o, p);
|
|
368
368
|
}
|
|
369
|
-
function _type_of$
|
|
369
|
+
function _type_of$2(obj) {
|
|
370
370
|
'@swc/helpers - typeof';
|
|
371
371
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
372
372
|
? 'symbol'
|
|
@@ -415,7 +415,7 @@ function _is_native_reflect_construct$1() {
|
|
|
415
415
|
var NativeException = /*#__PURE__*/ (function (Error1) {
|
|
416
416
|
_inherits$1(NativeException, Error1);
|
|
417
417
|
function NativeException(code, message) {
|
|
418
|
-
_class_call_check$
|
|
418
|
+
_class_call_check$5(this, NativeException);
|
|
419
419
|
var _this;
|
|
420
420
|
(_this = _call_super$1(this, NativeException, [message])),
|
|
421
421
|
_define_property$3(_this, 'code', void 0);
|
|
@@ -447,7 +447,7 @@ function _call_super(_this, derived, args) {
|
|
|
447
447
|
: derived.apply(_this, args)
|
|
448
448
|
);
|
|
449
449
|
}
|
|
450
|
-
function _class_call_check$
|
|
450
|
+
function _class_call_check$4(instance, Constructor) {
|
|
451
451
|
if (!(instance instanceof Constructor)) {
|
|
452
452
|
throw new TypeError('Cannot call a class as a function');
|
|
453
453
|
}
|
|
@@ -467,7 +467,7 @@ function _construct(Parent, args, Class) {
|
|
|
467
467
|
}
|
|
468
468
|
return _construct.apply(null, arguments);
|
|
469
469
|
}
|
|
470
|
-
function _defineProperties$
|
|
470
|
+
function _defineProperties$4(target, props) {
|
|
471
471
|
for (var i = 0; i < props.length; i++) {
|
|
472
472
|
var descriptor = props[i];
|
|
473
473
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -476,8 +476,8 @@ function _defineProperties$3(target, props) {
|
|
|
476
476
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
function _create_class$
|
|
480
|
-
if (protoProps) _defineProperties$
|
|
479
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
480
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
481
481
|
return Constructor;
|
|
482
482
|
}
|
|
483
483
|
function _define_property$2(obj, key, value) {
|
|
@@ -518,7 +518,7 @@ function _is_native_function(fn) {
|
|
|
518
518
|
return Function.toString.call(fn).indexOf('[native code]') !== -1;
|
|
519
519
|
}
|
|
520
520
|
function _possible_constructor_return(self, call) {
|
|
521
|
-
if (call && (_type_of(call) === 'object' || typeof call === 'function')) {
|
|
521
|
+
if (call && (_type_of$1(call) === 'object' || typeof call === 'function')) {
|
|
522
522
|
return call;
|
|
523
523
|
}
|
|
524
524
|
return _assert_this_initialized(self);
|
|
@@ -532,7 +532,7 @@ function _set_prototype_of(o, p) {
|
|
|
532
532
|
};
|
|
533
533
|
return _set_prototype_of(o, p);
|
|
534
534
|
}
|
|
535
|
-
function _type_of(obj) {
|
|
535
|
+
function _type_of$1(obj) {
|
|
536
536
|
'@swc/helpers - typeof';
|
|
537
537
|
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
538
538
|
? 'symbol'
|
|
@@ -577,7 +577,7 @@ function _is_native_reflect_construct() {
|
|
|
577
577
|
var PgException = /*#__PURE__*/ (function (Error1) {
|
|
578
578
|
_inherits(PgException, Error1);
|
|
579
579
|
function PgException(err, message, specific) {
|
|
580
|
-
_class_call_check$
|
|
580
|
+
_class_call_check$4(this, PgException);
|
|
581
581
|
var _this;
|
|
582
582
|
(_this = _call_super(this, PgException, [message])),
|
|
583
583
|
_define_property$2(_this, 'err', void 0),
|
|
@@ -587,7 +587,7 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
587
587
|
_this.specific = specific;
|
|
588
588
|
return _this;
|
|
589
589
|
}
|
|
590
|
-
_create_class$
|
|
590
|
+
_create_class$4(PgException, [
|
|
591
591
|
{
|
|
592
592
|
key: 'getStatus',
|
|
593
593
|
value: function getStatus() {
|
|
@@ -614,12 +614,12 @@ var PgException = /*#__PURE__*/ (function (Error1) {
|
|
|
614
614
|
return PgException;
|
|
615
615
|
})(_wrap_native_super(Error));
|
|
616
616
|
|
|
617
|
-
function _class_call_check$
|
|
617
|
+
function _class_call_check$3(instance, Constructor) {
|
|
618
618
|
if (!(instance instanceof Constructor)) {
|
|
619
619
|
throw new TypeError('Cannot call a class as a function');
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
function _defineProperties$
|
|
622
|
+
function _defineProperties$3(target, props) {
|
|
623
623
|
for (var i = 0; i < props.length; i++) {
|
|
624
624
|
var descriptor = props[i];
|
|
625
625
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -628,8 +628,8 @@ function _defineProperties$2(target, props) {
|
|
|
628
628
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
function _create_class$
|
|
632
|
-
if (protoProps) _defineProperties$
|
|
631
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
632
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
633
633
|
return Constructor;
|
|
634
634
|
}
|
|
635
635
|
function _define_property$1(obj, key, value) {
|
|
@@ -660,7 +660,7 @@ var NO_OP = function (_message) {
|
|
|
660
660
|
};
|
|
661
661
|
var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
662
662
|
function ConsoleLogger(options) {
|
|
663
|
-
_class_call_check$
|
|
663
|
+
_class_call_check$3(this, ConsoleLogger);
|
|
664
664
|
_define_property$1(this, 'log', void 0);
|
|
665
665
|
_define_property$1(this, 'warn', void 0);
|
|
666
666
|
_define_property$1(this, 'error', void 0);
|
|
@@ -678,7 +678,7 @@ var ConsoleLogger = /*#__PURE__*/ (function () {
|
|
|
678
678
|
break;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
_create_class$
|
|
681
|
+
_create_class$3(ConsoleLogger, [
|
|
682
682
|
{
|
|
683
683
|
key: 'disable',
|
|
684
684
|
value: function disable() {
|
|
@@ -714,12 +714,12 @@ var logger = new ConsoleLogger({
|
|
|
714
714
|
level: LOG_LEVEL,
|
|
715
715
|
});
|
|
716
716
|
|
|
717
|
-
function _class_call_check$
|
|
717
|
+
function _class_call_check$2(instance, Constructor) {
|
|
718
718
|
if (!(instance instanceof Constructor)) {
|
|
719
719
|
throw new TypeError('Cannot call a class as a function');
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
function _defineProperties$
|
|
722
|
+
function _defineProperties$2(target, props) {
|
|
723
723
|
for (var i = 0; i < props.length; i++) {
|
|
724
724
|
var descriptor = props[i];
|
|
725
725
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -728,15 +728,15 @@ function _defineProperties$1(target, props) {
|
|
|
728
728
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
|
-
function _create_class$
|
|
732
|
-
if (staticProps) _defineProperties$
|
|
731
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
732
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
733
733
|
return Constructor;
|
|
734
734
|
}
|
|
735
735
|
var HttpHandler = /*#__PURE__*/ (function () {
|
|
736
736
|
function HttpHandler() {
|
|
737
|
-
_class_call_check$
|
|
737
|
+
_class_call_check$2(this, HttpHandler);
|
|
738
738
|
}
|
|
739
|
-
_create_class$
|
|
739
|
+
_create_class$2(HttpHandler, null, [
|
|
740
740
|
{
|
|
741
741
|
key: 'response',
|
|
742
742
|
value: function response(response) {
|
|
@@ -780,12 +780,12 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
780
780
|
return HttpHandler;
|
|
781
781
|
})();
|
|
782
782
|
|
|
783
|
-
function _class_call_check(instance, Constructor) {
|
|
783
|
+
function _class_call_check$1(instance, Constructor) {
|
|
784
784
|
if (!(instance instanceof Constructor)) {
|
|
785
785
|
throw new TypeError('Cannot call a class as a function');
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
|
-
function _defineProperties(target, props) {
|
|
788
|
+
function _defineProperties$1(target, props) {
|
|
789
789
|
for (var i = 0; i < props.length; i++) {
|
|
790
790
|
var descriptor = props[i];
|
|
791
791
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -794,8 +794,8 @@ function _defineProperties(target, props) {
|
|
|
794
794
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
798
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
797
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
798
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
799
799
|
return Constructor;
|
|
800
800
|
}
|
|
801
801
|
function _define_property(obj, key, value) {
|
|
@@ -813,9 +813,9 @@ function _define_property(obj, key, value) {
|
|
|
813
813
|
}
|
|
814
814
|
var CookieHelper = /*#__PURE__*/ (function () {
|
|
815
815
|
function CookieHelper() {
|
|
816
|
-
_class_call_check(this, CookieHelper);
|
|
816
|
+
_class_call_check$1(this, CookieHelper);
|
|
817
817
|
}
|
|
818
|
-
_create_class(CookieHelper, null, [
|
|
818
|
+
_create_class$1(CookieHelper, null, [
|
|
819
819
|
{
|
|
820
820
|
key: 'isProduction',
|
|
821
821
|
value: function isProduction() {
|
|
@@ -833,11 +833,266 @@ var CookieHelper = /*#__PURE__*/ (function () {
|
|
|
833
833
|
})();
|
|
834
834
|
_define_property(CookieHelper, 'cookieSecurePrefix', '__Secure-');
|
|
835
835
|
|
|
836
|
+
function _type_of(obj) {
|
|
837
|
+
'@swc/helpers - typeof';
|
|
838
|
+
return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
|
|
839
|
+
? 'symbol'
|
|
840
|
+
: typeof obj;
|
|
841
|
+
}
|
|
842
|
+
function encodeReserved(str) {
|
|
843
|
+
return str
|
|
844
|
+
.split(/(%[0-9A-Fa-f]{2})/g)
|
|
845
|
+
.map(function (part) {
|
|
846
|
+
if (!/%[0-9A-Fa-f]/.test(part)) {
|
|
847
|
+
part = encodeURI(part).replace(/%5B/g, '[').replace(/%5D/g, ']');
|
|
848
|
+
}
|
|
849
|
+
return part;
|
|
850
|
+
})
|
|
851
|
+
.join('');
|
|
852
|
+
}
|
|
853
|
+
function encodeUnreserved(str) {
|
|
854
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
855
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function encodeValue(operator, value, key) {
|
|
859
|
+
value =
|
|
860
|
+
operator === '+' || operator === '#'
|
|
861
|
+
? encodeReserved(value)
|
|
862
|
+
: encodeUnreserved(value);
|
|
863
|
+
if (key) {
|
|
864
|
+
return encodeUnreserved(key) + '=' + value;
|
|
865
|
+
} else {
|
|
866
|
+
return value;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function isDefined(value) {
|
|
870
|
+
return value !== undefined && value !== null;
|
|
871
|
+
}
|
|
872
|
+
function isKeyOperator(operator) {
|
|
873
|
+
return operator === ';' || operator === '&' || operator === '?';
|
|
874
|
+
}
|
|
875
|
+
function getValues(context, operator, key, modifier) {
|
|
876
|
+
var value = context[key],
|
|
877
|
+
result = [];
|
|
878
|
+
if (isDefined(value) && value !== '') {
|
|
879
|
+
if (
|
|
880
|
+
typeof value === 'string' ||
|
|
881
|
+
typeof value === 'number' ||
|
|
882
|
+
typeof value === 'boolean'
|
|
883
|
+
) {
|
|
884
|
+
value = value.toString();
|
|
885
|
+
if (modifier && modifier !== '*') {
|
|
886
|
+
value = value.substring(0, parseInt(modifier, 10));
|
|
887
|
+
}
|
|
888
|
+
result.push(
|
|
889
|
+
encodeValue(operator, value, isKeyOperator(operator) ? key : null)
|
|
890
|
+
);
|
|
891
|
+
} else {
|
|
892
|
+
if (modifier === '*') {
|
|
893
|
+
if (Array.isArray(value)) {
|
|
894
|
+
value.filter(isDefined).forEach(function (value) {
|
|
895
|
+
result.push(
|
|
896
|
+
encodeValue(
|
|
897
|
+
operator,
|
|
898
|
+
String(value),
|
|
899
|
+
isKeyOperator(operator) ? key : null
|
|
900
|
+
)
|
|
901
|
+
);
|
|
902
|
+
});
|
|
903
|
+
} else if (
|
|
904
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
905
|
+
'object' &&
|
|
906
|
+
value !== null
|
|
907
|
+
) {
|
|
908
|
+
Object.keys(value).forEach(function (k) {
|
|
909
|
+
if (isDefined(value[k])) {
|
|
910
|
+
result.push(encodeValue(operator, String(value[k]), k));
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
} else {
|
|
915
|
+
var tmp = [];
|
|
916
|
+
if (Array.isArray(value)) {
|
|
917
|
+
value.filter(isDefined).forEach(function (value) {
|
|
918
|
+
tmp.push(encodeValue(operator, String(value)));
|
|
919
|
+
});
|
|
920
|
+
} else if (
|
|
921
|
+
(typeof value === 'undefined' ? 'undefined' : _type_of(value)) ===
|
|
922
|
+
'object' &&
|
|
923
|
+
value !== null
|
|
924
|
+
) {
|
|
925
|
+
Object.keys(value).forEach(function (k) {
|
|
926
|
+
if (isDefined(value[k])) {
|
|
927
|
+
tmp.push(encodeUnreserved(k));
|
|
928
|
+
tmp.push(encodeValue(operator, String(value[k])));
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
if (isKeyOperator(operator)) {
|
|
933
|
+
result.push(encodeUnreserved(key) + '=' + tmp.join(','));
|
|
934
|
+
} else if (tmp.length !== 0) {
|
|
935
|
+
result.push(tmp.join(','));
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
} else {
|
|
940
|
+
if (operator === ';') {
|
|
941
|
+
if (isDefined(value)) {
|
|
942
|
+
result.push(encodeUnreserved(key));
|
|
943
|
+
}
|
|
944
|
+
} else if (value === '' && (operator === '&' || operator === '?')) {
|
|
945
|
+
result.push(encodeUnreserved(key) + '=');
|
|
946
|
+
} else if (value === '') {
|
|
947
|
+
result.push('');
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return result;
|
|
951
|
+
}
|
|
952
|
+
function parseTemplate(template) {
|
|
953
|
+
var operators = ['+', '#', '.', '/', ';', '?', '&'];
|
|
954
|
+
return {
|
|
955
|
+
expand: function expand(context) {
|
|
956
|
+
return template.replace(
|
|
957
|
+
/\{([^{}]+)}|([^{}]+)/g,
|
|
958
|
+
function (_, expression, literal) {
|
|
959
|
+
if (expression) {
|
|
960
|
+
var operator = null,
|
|
961
|
+
values = [];
|
|
962
|
+
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
|
963
|
+
operator = expression.charAt(0);
|
|
964
|
+
expression = expression.substring(1);
|
|
965
|
+
}
|
|
966
|
+
expression.split(/,/g).forEach(function (variable) {
|
|
967
|
+
var tmp = /([^:*]*)(?::(\d+)|(\*))?/.exec(variable);
|
|
968
|
+
if (tmp) {
|
|
969
|
+
values.push.apply(
|
|
970
|
+
values,
|
|
971
|
+
getValues(context, operator, tmp[1], tmp[2] || tmp[3])
|
|
972
|
+
);
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
if (operator && operator !== '+') {
|
|
976
|
+
var separator = ',';
|
|
977
|
+
if (operator === '?') {
|
|
978
|
+
separator = '&';
|
|
979
|
+
} else if (operator !== '#') {
|
|
980
|
+
separator = operator;
|
|
981
|
+
}
|
|
982
|
+
return (
|
|
983
|
+
(values.length !== 0 ? operator : '') + values.join(separator)
|
|
984
|
+
);
|
|
985
|
+
} else {
|
|
986
|
+
return values.join(',');
|
|
987
|
+
}
|
|
988
|
+
} else {
|
|
989
|
+
return encodeReserved(literal);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
},
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function _class_call_check(instance, Constructor) {
|
|
998
|
+
if (!(instance instanceof Constructor)) {
|
|
999
|
+
throw new TypeError('Cannot call a class as a function');
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
function _defineProperties(target, props) {
|
|
1003
|
+
for (var i = 0; i < props.length; i++) {
|
|
1004
|
+
var descriptor = props[i];
|
|
1005
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1006
|
+
descriptor.configurable = true;
|
|
1007
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
1008
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
1012
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1013
|
+
return Constructor;
|
|
1014
|
+
}
|
|
1015
|
+
function _instanceof(left, right) {
|
|
1016
|
+
if (
|
|
1017
|
+
right != null &&
|
|
1018
|
+
typeof Symbol !== 'undefined' &&
|
|
1019
|
+
right[Symbol.hasInstance]
|
|
1020
|
+
) {
|
|
1021
|
+
return !!right[Symbol.hasInstance](left);
|
|
1022
|
+
} else {
|
|
1023
|
+
return left instanceof right;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
var DateFormatter = /*#__PURE__*/ (function () {
|
|
1027
|
+
function DateFormatter() {
|
|
1028
|
+
_class_call_check(this, DateFormatter);
|
|
1029
|
+
}
|
|
1030
|
+
_create_class(DateFormatter, null, [
|
|
1031
|
+
{
|
|
1032
|
+
key: 'format',
|
|
1033
|
+
value: function format(date) {
|
|
1034
|
+
var validDate;
|
|
1035
|
+
if (typeof date === 'string') {
|
|
1036
|
+
validDate = new Date(date);
|
|
1037
|
+
} else {
|
|
1038
|
+
validDate = date;
|
|
1039
|
+
}
|
|
1040
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1041
|
+
day: '2-digit',
|
|
1042
|
+
month: '2-digit',
|
|
1043
|
+
year: 'numeric',
|
|
1044
|
+
hour: '2-digit',
|
|
1045
|
+
minute: '2-digit',
|
|
1046
|
+
}).format(validDate);
|
|
1047
|
+
},
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
key: 'formatFormal',
|
|
1051
|
+
value: function formatFormal(date) {
|
|
1052
|
+
var validDate;
|
|
1053
|
+
if (typeof date === 'string') {
|
|
1054
|
+
validDate = new Date(date);
|
|
1055
|
+
} else if (_instanceof(date, Date)) {
|
|
1056
|
+
validDate = date;
|
|
1057
|
+
} else {
|
|
1058
|
+
return 'INVALID '.concat(date);
|
|
1059
|
+
}
|
|
1060
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1061
|
+
day: '2-digit',
|
|
1062
|
+
month: '2-digit',
|
|
1063
|
+
year: 'numeric',
|
|
1064
|
+
}).format(validDate);
|
|
1065
|
+
},
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
key: 'formatMini',
|
|
1069
|
+
value: function formatMini(date) {
|
|
1070
|
+
var validDate;
|
|
1071
|
+
if (typeof date === 'string') {
|
|
1072
|
+
validDate = new Date(date);
|
|
1073
|
+
} else if (_instanceof(date, Date)) {
|
|
1074
|
+
validDate = date;
|
|
1075
|
+
} else {
|
|
1076
|
+
throw new RangeError('Invalid time value: ' + date);
|
|
1077
|
+
}
|
|
1078
|
+
return new Intl.DateTimeFormat('de-DE', {
|
|
1079
|
+
day: 'numeric',
|
|
1080
|
+
month: 'long',
|
|
1081
|
+
year: 'numeric',
|
|
1082
|
+
}).format(validDate);
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
]);
|
|
1086
|
+
return DateFormatter;
|
|
1087
|
+
})();
|
|
1088
|
+
|
|
836
1089
|
export {
|
|
837
1090
|
CookieHelper,
|
|
1091
|
+
DateFormatter,
|
|
838
1092
|
HttpHandler,
|
|
839
1093
|
NativeException,
|
|
840
1094
|
PgException,
|
|
841
1095
|
PostgresError,
|
|
842
1096
|
logger,
|
|
1097
|
+
parseTemplate,
|
|
843
1098
|
};
|