@native-systems/utility 2.0.2 → 2.1.1
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/dist/index.cjs +65 -74
- package/dist/index.d.ts +84 -61
- package/dist/index.esm.js +65 -74
- package/package.json +1 -3
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var Handlebars = require('handlebars');
|
|
4
|
-
var sanitizeHtml = require('sanitize-html');
|
|
5
|
-
var MarkdownIt = require('markdown-it');
|
|
6
4
|
|
|
7
5
|
var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
8
6
|
PostgresError['SUCCESSFUL_COMPLETION'] = '00000';
|
|
@@ -279,6 +277,66 @@ var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
|
279
277
|
return PostgresError;
|
|
280
278
|
})({});
|
|
281
279
|
|
|
280
|
+
var HttpStatus = /*#__PURE__*/ (function (HttpStatus) {
|
|
281
|
+
HttpStatus[(HttpStatus['CONTINUE'] = 100)] = 'CONTINUE';
|
|
282
|
+
HttpStatus[(HttpStatus['SWITCHING_PROTOCOLS'] = 101)] = 'SWITCHING_PROTOCOLS';
|
|
283
|
+
HttpStatus[(HttpStatus['PROCESSING'] = 102)] = 'PROCESSING';
|
|
284
|
+
HttpStatus[(HttpStatus['EARLYHINTS'] = 103)] = 'EARLYHINTS';
|
|
285
|
+
HttpStatus[(HttpStatus['OK'] = 200)] = 'OK';
|
|
286
|
+
HttpStatus[(HttpStatus['CREATED'] = 201)] = 'CREATED';
|
|
287
|
+
HttpStatus[(HttpStatus['ACCEPTED'] = 202)] = 'ACCEPTED';
|
|
288
|
+
HttpStatus[(HttpStatus['NON_AUTHORITATIVE_INFORMATION'] = 203)] =
|
|
289
|
+
'NON_AUTHORITATIVE_INFORMATION';
|
|
290
|
+
HttpStatus[(HttpStatus['NO_CONTENT'] = 204)] = 'NO_CONTENT';
|
|
291
|
+
HttpStatus[(HttpStatus['RESET_CONTENT'] = 205)] = 'RESET_CONTENT';
|
|
292
|
+
HttpStatus[(HttpStatus['PARTIAL_CONTENT'] = 206)] = 'PARTIAL_CONTENT';
|
|
293
|
+
HttpStatus[(HttpStatus['AMBIGUOUS'] = 300)] = 'AMBIGUOUS';
|
|
294
|
+
HttpStatus[(HttpStatus['MOVED_PERMANENTLY'] = 301)] = 'MOVED_PERMANENTLY';
|
|
295
|
+
HttpStatus[(HttpStatus['FOUND'] = 302)] = 'FOUND';
|
|
296
|
+
HttpStatus[(HttpStatus['SEE_OTHER'] = 303)] = 'SEE_OTHER';
|
|
297
|
+
HttpStatus[(HttpStatus['NOT_MODIFIED'] = 304)] = 'NOT_MODIFIED';
|
|
298
|
+
HttpStatus[(HttpStatus['TEMPORARY_REDIRECT'] = 307)] = 'TEMPORARY_REDIRECT';
|
|
299
|
+
HttpStatus[(HttpStatus['PERMANENT_REDIRECT'] = 308)] = 'PERMANENT_REDIRECT';
|
|
300
|
+
HttpStatus[(HttpStatus['BAD_REQUEST'] = 400)] = 'BAD_REQUEST';
|
|
301
|
+
HttpStatus[(HttpStatus['UNAUTHORIZED'] = 401)] = 'UNAUTHORIZED';
|
|
302
|
+
HttpStatus[(HttpStatus['PAYMENT_REQUIRED'] = 402)] = 'PAYMENT_REQUIRED';
|
|
303
|
+
HttpStatus[(HttpStatus['FORBIDDEN'] = 403)] = 'FORBIDDEN';
|
|
304
|
+
HttpStatus[(HttpStatus['NOT_FOUND'] = 404)] = 'NOT_FOUND';
|
|
305
|
+
HttpStatus[(HttpStatus['METHOD_NOT_ALLOWED'] = 405)] = 'METHOD_NOT_ALLOWED';
|
|
306
|
+
HttpStatus[(HttpStatus['NOT_ACCEPTABLE'] = 406)] = 'NOT_ACCEPTABLE';
|
|
307
|
+
HttpStatus[(HttpStatus['PROXY_AUTHENTICATION_REQUIRED'] = 407)] =
|
|
308
|
+
'PROXY_AUTHENTICATION_REQUIRED';
|
|
309
|
+
HttpStatus[(HttpStatus['REQUEST_TIMEOUT'] = 408)] = 'REQUEST_TIMEOUT';
|
|
310
|
+
HttpStatus[(HttpStatus['CONFLICT'] = 409)] = 'CONFLICT';
|
|
311
|
+
HttpStatus[(HttpStatus['GONE'] = 410)] = 'GONE';
|
|
312
|
+
HttpStatus[(HttpStatus['LENGTH_REQUIRED'] = 411)] = 'LENGTH_REQUIRED';
|
|
313
|
+
HttpStatus[(HttpStatus['PRECONDITION_FAILED'] = 412)] = 'PRECONDITION_FAILED';
|
|
314
|
+
HttpStatus[(HttpStatus['PAYLOAD_TOO_LARGE'] = 413)] = 'PAYLOAD_TOO_LARGE';
|
|
315
|
+
HttpStatus[(HttpStatus['URI_TOO_LONG'] = 414)] = 'URI_TOO_LONG';
|
|
316
|
+
HttpStatus[(HttpStatus['UNSUPPORTED_MEDIA_TYPE'] = 415)] =
|
|
317
|
+
'UNSUPPORTED_MEDIA_TYPE';
|
|
318
|
+
HttpStatus[(HttpStatus['REQUESTED_RANGE_NOT_SATISFIABLE'] = 416)] =
|
|
319
|
+
'REQUESTED_RANGE_NOT_SATISFIABLE';
|
|
320
|
+
HttpStatus[(HttpStatus['EXPECTATION_FAILED'] = 417)] = 'EXPECTATION_FAILED';
|
|
321
|
+
HttpStatus[(HttpStatus['I_AM_A_TEAPOT'] = 418)] = 'I_AM_A_TEAPOT';
|
|
322
|
+
HttpStatus[(HttpStatus['MISDIRECTED'] = 421)] = 'MISDIRECTED';
|
|
323
|
+
HttpStatus[(HttpStatus['UNPROCESSABLE_ENTITY'] = 422)] =
|
|
324
|
+
'UNPROCESSABLE_ENTITY';
|
|
325
|
+
HttpStatus[(HttpStatus['FAILED_DEPENDENCY'] = 424)] = 'FAILED_DEPENDENCY';
|
|
326
|
+
HttpStatus[(HttpStatus['PRECONDITION_REQUIRED'] = 428)] =
|
|
327
|
+
'PRECONDITION_REQUIRED';
|
|
328
|
+
HttpStatus[(HttpStatus['TOO_MANY_REQUESTS'] = 429)] = 'TOO_MANY_REQUESTS';
|
|
329
|
+
HttpStatus[(HttpStatus['INTERNAL_SERVER_ERROR'] = 500)] =
|
|
330
|
+
'INTERNAL_SERVER_ERROR';
|
|
331
|
+
HttpStatus[(HttpStatus['NOT_IMPLEMENTED'] = 501)] = 'NOT_IMPLEMENTED';
|
|
332
|
+
HttpStatus[(HttpStatus['BAD_GATEWAY'] = 502)] = 'BAD_GATEWAY';
|
|
333
|
+
HttpStatus[(HttpStatus['SERVICE_UNAVAILABLE'] = 503)] = 'SERVICE_UNAVAILABLE';
|
|
334
|
+
HttpStatus[(HttpStatus['GATEWAY_TIMEOUT'] = 504)] = 'GATEWAY_TIMEOUT';
|
|
335
|
+
HttpStatus[(HttpStatus['HTTP_VERSION_NOT_SUPPORTED'] = 505)] =
|
|
336
|
+
'HTTP_VERSION_NOT_SUPPORTED';
|
|
337
|
+
return HttpStatus;
|
|
338
|
+
})({});
|
|
339
|
+
|
|
282
340
|
function _assert_this_initialized$1(self) {
|
|
283
341
|
if (self === void 0) {
|
|
284
342
|
throw new ReferenceError(
|
|
@@ -772,7 +830,7 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
772
830
|
logger.error('Request failed because of a network error.');
|
|
773
831
|
var _response_toString;
|
|
774
832
|
var nativeError = new NativeException(
|
|
775
|
-
|
|
833
|
+
HttpStatus.NOT_IMPLEMENTED,
|
|
776
834
|
(_response_toString = response.toString()) !== null &&
|
|
777
835
|
_response_toString !== void 0
|
|
778
836
|
? _response_toString
|
|
@@ -1094,79 +1152,11 @@ var eqPlugin = function (handlebars) {
|
|
|
1094
1152
|
});
|
|
1095
1153
|
};
|
|
1096
1154
|
|
|
1097
|
-
function
|
|
1098
|
-
|
|
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) {
|
|
1155
|
+
var markdownPlugin = function (handlebars, param) {
|
|
1156
|
+
var renderAndSanitize = param.renderAndSanitize;
|
|
1136
1157
|
handlebars.registerHelper('md', function (markdownText) {
|
|
1137
1158
|
if (!markdownText) return '';
|
|
1138
|
-
var cleanHtml =
|
|
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
|
-
});
|
|
1159
|
+
var cleanHtml = renderAndSanitize(markdownText);
|
|
1170
1160
|
return new Handlebars.SafeString(cleanHtml);
|
|
1171
1161
|
});
|
|
1172
1162
|
};
|
|
@@ -1456,6 +1446,7 @@ var userTimezonePlugin = function (handlebars, param) {
|
|
|
1456
1446
|
exports.CookieHelper = CookieHelper;
|
|
1457
1447
|
exports.DateFormatter = DateFormatter;
|
|
1458
1448
|
exports.HttpHandler = HttpHandler;
|
|
1449
|
+
exports.HttpStatus = HttpStatus;
|
|
1459
1450
|
exports.NativeException = NativeException;
|
|
1460
1451
|
exports.PatternCompiler = PatternCompiler;
|
|
1461
1452
|
exports.PgException = PgException;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
declare module "@native-systems/utility" {
|
|
2
|
+
type Paginated<T> = {
|
|
3
|
+
hasNextPage: boolean;
|
|
4
|
+
hasPrevPage: boolean;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
data: T;
|
|
7
|
+
};
|
|
8
|
+
export type { Paginated };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module "@native-systems/utility" {
|
|
12
|
+
type CancelableComponent<T> = {
|
|
13
|
+
value: T;
|
|
14
|
+
cancel: () => void;
|
|
15
|
+
};
|
|
16
|
+
export type { CancelableComponent };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module "@native-systems/utility" {
|
|
20
|
+
type CRUDCompontent<T, U = T, V = U> = {
|
|
21
|
+
value: T;
|
|
22
|
+
add: (value: U) => void;
|
|
23
|
+
delete: (id: string) => void;
|
|
24
|
+
update: (id: string, value: V) => void;
|
|
25
|
+
};
|
|
26
|
+
export type { CRUDCompontent };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module "@native-systems/utility" {
|
|
30
|
+
import { Dispatch, SetStateAction } from "react";
|
|
31
|
+
type UseStateComponent<T, U = T> = {
|
|
32
|
+
current: T;
|
|
33
|
+
update: (value: U) => void;
|
|
34
|
+
};
|
|
35
|
+
/** Same grouping type as the UseStateComponent type, with the difference,
|
|
36
|
+
* that here the update function is directly linked with the useState variable. */
|
|
37
|
+
type DirectUseStateComponent<T> = {
|
|
38
|
+
current: T;
|
|
39
|
+
update: Dispatch<SetStateAction<T>>;
|
|
40
|
+
};
|
|
41
|
+
export type { DirectUseStateComponent, UseStateComponent };
|
|
42
|
+
}
|
|
43
|
+
|
|
1
44
|
declare module "@native-systems/utility" {
|
|
2
45
|
export enum PostgresError {
|
|
3
46
|
/** Class 00 - Successful Completion: [S] successful_completion */
|
|
@@ -594,6 +637,21 @@ declare module "@native-systems/utility" {
|
|
|
594
637
|
}
|
|
595
638
|
}
|
|
596
639
|
|
|
640
|
+
declare module "@native-systems/utility" {
|
|
641
|
+
namespace native {
|
|
642
|
+
type Error = ErrorConstructor & {
|
|
643
|
+
status: number;
|
|
644
|
+
message: string;
|
|
645
|
+
error: string;
|
|
646
|
+
};
|
|
647
|
+
interface ErrorResponse extends Response {
|
|
648
|
+
isNativeError: boolean;
|
|
649
|
+
}
|
|
650
|
+
export { Error, ErrorResponse };
|
|
651
|
+
}
|
|
652
|
+
export { type native, Paginated, CancelableComponent, CRUDCompontent, UseStateComponent, DirectUseStateComponent, HttpStatus, PostgresError, };
|
|
653
|
+
}
|
|
654
|
+
|
|
597
655
|
declare module "@native-systems/utility" {
|
|
598
656
|
/**
|
|
599
657
|
* Custom exception object used by Native Systems, which extends the Error interface
|
|
@@ -664,65 +722,6 @@ declare module "@native-systems/utility" {
|
|
|
664
722
|
}
|
|
665
723
|
|
|
666
724
|
declare module "@native-systems/utility" {
|
|
667
|
-
namespace native {
|
|
668
|
-
type Error = ErrorConstructor & {
|
|
669
|
-
status: number;
|
|
670
|
-
message: string;
|
|
671
|
-
error: string;
|
|
672
|
-
};
|
|
673
|
-
interface ErrorResponse extends Response {
|
|
674
|
-
isNativeError: boolean;
|
|
675
|
-
}
|
|
676
|
-
export { Error, ErrorResponse };
|
|
677
|
-
}
|
|
678
|
-
export type { native };
|
|
679
|
-
}
|
|
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
|
-
|
|
724
|
-
declare module "@native-systems/utility" {
|
|
725
|
-
import { native } from "@/types";
|
|
726
725
|
class HttpHandler {
|
|
727
726
|
/**
|
|
728
727
|
* Http request response handler, which checks if the given response is in status range 'ok'.
|
|
@@ -736,7 +735,7 @@ declare module "@native-systems/utility" {
|
|
|
736
735
|
static response<T>(response: Response): Promise<T>;
|
|
737
736
|
/**
|
|
738
737
|
* Http request error handler, that always returns the correct error object.
|
|
739
|
-
* Either fast forwards the already correctly formatted
|
|
738
|
+
* Either fast forwards the already correctly formatted native error or set up a new native error, based on the provided info.
|
|
740
739
|
* The generic typing is just used to prevent type errors.
|
|
741
740
|
* @param response {Response | native.ErrorResponse} The Response object that errored. Can either be a default object, or the modified native version.
|
|
742
741
|
* @throws {native.Error} Always throws an error, which is always of this type.
|
|
@@ -809,7 +808,31 @@ declare module "@native-systems/utility" {
|
|
|
809
808
|
}
|
|
810
809
|
|
|
811
810
|
declare module "@native-systems/utility" {
|
|
812
|
-
export
|
|
811
|
+
export type MarkdownHelpers = {
|
|
812
|
+
renderAndSanitize: (inp: string) => string;
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Example usage:
|
|
816
|
+
* sanitizeHtml(renderMarkdown(markdownText), {
|
|
817
|
+
* allowedTags: [
|
|
818
|
+
* ...['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'b'],
|
|
819
|
+
* ...['i', 'strong', 'em', 'a', 'ul', 'ol', 'li', 'p', 'br'],
|
|
820
|
+
* ],
|
|
821
|
+
* allowedAttributes: {
|
|
822
|
+
* a: ['href', 'title', 'target'],
|
|
823
|
+
* },
|
|
824
|
+
* // enforce target="_blank" on links
|
|
825
|
+
* transformTags: {
|
|
826
|
+
* a: sanitizeHtml.simpleTransform('a', {
|
|
827
|
+
* target: '_blank',
|
|
828
|
+
* rel: 'noopener',
|
|
829
|
+
* }),
|
|
830
|
+
* },
|
|
831
|
+
* });
|
|
832
|
+
* @param handlebars
|
|
833
|
+
* @param renderAndSanitize
|
|
834
|
+
*/
|
|
835
|
+
export const markdownPlugin: CompilerPlugin<MarkdownHelpers>;
|
|
813
836
|
}
|
|
814
837
|
|
|
815
838
|
declare module "@native-systems/utility" {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import Handlebars from 'handlebars';
|
|
2
|
-
import sanitizeHtml from 'sanitize-html';
|
|
3
|
-
import MarkdownIt from 'markdown-it';
|
|
4
2
|
|
|
5
3
|
var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
6
4
|
PostgresError['SUCCESSFUL_COMPLETION'] = '00000';
|
|
@@ -277,6 +275,66 @@ var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
|
277
275
|
return PostgresError;
|
|
278
276
|
})({});
|
|
279
277
|
|
|
278
|
+
var HttpStatus = /*#__PURE__*/ (function (HttpStatus) {
|
|
279
|
+
HttpStatus[(HttpStatus['CONTINUE'] = 100)] = 'CONTINUE';
|
|
280
|
+
HttpStatus[(HttpStatus['SWITCHING_PROTOCOLS'] = 101)] = 'SWITCHING_PROTOCOLS';
|
|
281
|
+
HttpStatus[(HttpStatus['PROCESSING'] = 102)] = 'PROCESSING';
|
|
282
|
+
HttpStatus[(HttpStatus['EARLYHINTS'] = 103)] = 'EARLYHINTS';
|
|
283
|
+
HttpStatus[(HttpStatus['OK'] = 200)] = 'OK';
|
|
284
|
+
HttpStatus[(HttpStatus['CREATED'] = 201)] = 'CREATED';
|
|
285
|
+
HttpStatus[(HttpStatus['ACCEPTED'] = 202)] = 'ACCEPTED';
|
|
286
|
+
HttpStatus[(HttpStatus['NON_AUTHORITATIVE_INFORMATION'] = 203)] =
|
|
287
|
+
'NON_AUTHORITATIVE_INFORMATION';
|
|
288
|
+
HttpStatus[(HttpStatus['NO_CONTENT'] = 204)] = 'NO_CONTENT';
|
|
289
|
+
HttpStatus[(HttpStatus['RESET_CONTENT'] = 205)] = 'RESET_CONTENT';
|
|
290
|
+
HttpStatus[(HttpStatus['PARTIAL_CONTENT'] = 206)] = 'PARTIAL_CONTENT';
|
|
291
|
+
HttpStatus[(HttpStatus['AMBIGUOUS'] = 300)] = 'AMBIGUOUS';
|
|
292
|
+
HttpStatus[(HttpStatus['MOVED_PERMANENTLY'] = 301)] = 'MOVED_PERMANENTLY';
|
|
293
|
+
HttpStatus[(HttpStatus['FOUND'] = 302)] = 'FOUND';
|
|
294
|
+
HttpStatus[(HttpStatus['SEE_OTHER'] = 303)] = 'SEE_OTHER';
|
|
295
|
+
HttpStatus[(HttpStatus['NOT_MODIFIED'] = 304)] = 'NOT_MODIFIED';
|
|
296
|
+
HttpStatus[(HttpStatus['TEMPORARY_REDIRECT'] = 307)] = 'TEMPORARY_REDIRECT';
|
|
297
|
+
HttpStatus[(HttpStatus['PERMANENT_REDIRECT'] = 308)] = 'PERMANENT_REDIRECT';
|
|
298
|
+
HttpStatus[(HttpStatus['BAD_REQUEST'] = 400)] = 'BAD_REQUEST';
|
|
299
|
+
HttpStatus[(HttpStatus['UNAUTHORIZED'] = 401)] = 'UNAUTHORIZED';
|
|
300
|
+
HttpStatus[(HttpStatus['PAYMENT_REQUIRED'] = 402)] = 'PAYMENT_REQUIRED';
|
|
301
|
+
HttpStatus[(HttpStatus['FORBIDDEN'] = 403)] = 'FORBIDDEN';
|
|
302
|
+
HttpStatus[(HttpStatus['NOT_FOUND'] = 404)] = 'NOT_FOUND';
|
|
303
|
+
HttpStatus[(HttpStatus['METHOD_NOT_ALLOWED'] = 405)] = 'METHOD_NOT_ALLOWED';
|
|
304
|
+
HttpStatus[(HttpStatus['NOT_ACCEPTABLE'] = 406)] = 'NOT_ACCEPTABLE';
|
|
305
|
+
HttpStatus[(HttpStatus['PROXY_AUTHENTICATION_REQUIRED'] = 407)] =
|
|
306
|
+
'PROXY_AUTHENTICATION_REQUIRED';
|
|
307
|
+
HttpStatus[(HttpStatus['REQUEST_TIMEOUT'] = 408)] = 'REQUEST_TIMEOUT';
|
|
308
|
+
HttpStatus[(HttpStatus['CONFLICT'] = 409)] = 'CONFLICT';
|
|
309
|
+
HttpStatus[(HttpStatus['GONE'] = 410)] = 'GONE';
|
|
310
|
+
HttpStatus[(HttpStatus['LENGTH_REQUIRED'] = 411)] = 'LENGTH_REQUIRED';
|
|
311
|
+
HttpStatus[(HttpStatus['PRECONDITION_FAILED'] = 412)] = 'PRECONDITION_FAILED';
|
|
312
|
+
HttpStatus[(HttpStatus['PAYLOAD_TOO_LARGE'] = 413)] = 'PAYLOAD_TOO_LARGE';
|
|
313
|
+
HttpStatus[(HttpStatus['URI_TOO_LONG'] = 414)] = 'URI_TOO_LONG';
|
|
314
|
+
HttpStatus[(HttpStatus['UNSUPPORTED_MEDIA_TYPE'] = 415)] =
|
|
315
|
+
'UNSUPPORTED_MEDIA_TYPE';
|
|
316
|
+
HttpStatus[(HttpStatus['REQUESTED_RANGE_NOT_SATISFIABLE'] = 416)] =
|
|
317
|
+
'REQUESTED_RANGE_NOT_SATISFIABLE';
|
|
318
|
+
HttpStatus[(HttpStatus['EXPECTATION_FAILED'] = 417)] = 'EXPECTATION_FAILED';
|
|
319
|
+
HttpStatus[(HttpStatus['I_AM_A_TEAPOT'] = 418)] = 'I_AM_A_TEAPOT';
|
|
320
|
+
HttpStatus[(HttpStatus['MISDIRECTED'] = 421)] = 'MISDIRECTED';
|
|
321
|
+
HttpStatus[(HttpStatus['UNPROCESSABLE_ENTITY'] = 422)] =
|
|
322
|
+
'UNPROCESSABLE_ENTITY';
|
|
323
|
+
HttpStatus[(HttpStatus['FAILED_DEPENDENCY'] = 424)] = 'FAILED_DEPENDENCY';
|
|
324
|
+
HttpStatus[(HttpStatus['PRECONDITION_REQUIRED'] = 428)] =
|
|
325
|
+
'PRECONDITION_REQUIRED';
|
|
326
|
+
HttpStatus[(HttpStatus['TOO_MANY_REQUESTS'] = 429)] = 'TOO_MANY_REQUESTS';
|
|
327
|
+
HttpStatus[(HttpStatus['INTERNAL_SERVER_ERROR'] = 500)] =
|
|
328
|
+
'INTERNAL_SERVER_ERROR';
|
|
329
|
+
HttpStatus[(HttpStatus['NOT_IMPLEMENTED'] = 501)] = 'NOT_IMPLEMENTED';
|
|
330
|
+
HttpStatus[(HttpStatus['BAD_GATEWAY'] = 502)] = 'BAD_GATEWAY';
|
|
331
|
+
HttpStatus[(HttpStatus['SERVICE_UNAVAILABLE'] = 503)] = 'SERVICE_UNAVAILABLE';
|
|
332
|
+
HttpStatus[(HttpStatus['GATEWAY_TIMEOUT'] = 504)] = 'GATEWAY_TIMEOUT';
|
|
333
|
+
HttpStatus[(HttpStatus['HTTP_VERSION_NOT_SUPPORTED'] = 505)] =
|
|
334
|
+
'HTTP_VERSION_NOT_SUPPORTED';
|
|
335
|
+
return HttpStatus;
|
|
336
|
+
})({});
|
|
337
|
+
|
|
280
338
|
function _assert_this_initialized$1(self) {
|
|
281
339
|
if (self === void 0) {
|
|
282
340
|
throw new ReferenceError(
|
|
@@ -770,7 +828,7 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
770
828
|
logger.error('Request failed because of a network error.');
|
|
771
829
|
var _response_toString;
|
|
772
830
|
var nativeError = new NativeException(
|
|
773
|
-
|
|
831
|
+
HttpStatus.NOT_IMPLEMENTED,
|
|
774
832
|
(_response_toString = response.toString()) !== null &&
|
|
775
833
|
_response_toString !== void 0
|
|
776
834
|
? _response_toString
|
|
@@ -1092,79 +1150,11 @@ var eqPlugin = function (handlebars) {
|
|
|
1092
1150
|
});
|
|
1093
1151
|
};
|
|
1094
1152
|
|
|
1095
|
-
function
|
|
1096
|
-
|
|
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) {
|
|
1153
|
+
var markdownPlugin = function (handlebars, param) {
|
|
1154
|
+
var renderAndSanitize = param.renderAndSanitize;
|
|
1134
1155
|
handlebars.registerHelper('md', function (markdownText) {
|
|
1135
1156
|
if (!markdownText) return '';
|
|
1136
|
-
var cleanHtml =
|
|
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: sanitizeHtml.simpleTransform('a', {
|
|
1163
|
-
target: '_blank',
|
|
1164
|
-
rel: 'noopener',
|
|
1165
|
-
}),
|
|
1166
|
-
},
|
|
1167
|
-
});
|
|
1157
|
+
var cleanHtml = renderAndSanitize(markdownText);
|
|
1168
1158
|
return new Handlebars.SafeString(cleanHtml);
|
|
1169
1159
|
});
|
|
1170
1160
|
};
|
|
@@ -1455,6 +1445,7 @@ export {
|
|
|
1455
1445
|
CookieHelper,
|
|
1456
1446
|
DateFormatter,
|
|
1457
1447
|
HttpHandler,
|
|
1448
|
+
HttpStatus,
|
|
1458
1449
|
NativeException,
|
|
1459
1450
|
PatternCompiler,
|
|
1460
1451
|
PgException,
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.1.1",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"private": false,
|
|
16
16
|
"engines": {
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"handlebars": "^4.7.8",
|
|
79
79
|
"husky": "^9.1.6",
|
|
80
80
|
"lint-staged": "^13.0.3",
|
|
81
|
-
"markdown-it": "^14.1.0",
|
|
82
81
|
"npm-run-all": "^4.1.5",
|
|
83
82
|
"prettier": "3.0.3",
|
|
84
83
|
"rollup": "^4.26.0",
|
|
@@ -89,7 +88,6 @@
|
|
|
89
88
|
"rollup-plugin-swc3": "^0.12.1",
|
|
90
89
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
91
90
|
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
92
|
-
"sanitize-html": "^2.17.0",
|
|
93
91
|
"ts-node": "^10.9.1",
|
|
94
92
|
"typescript": "5.6.3"
|
|
95
93
|
},
|