@native-systems/utility 2.1.0 → 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 +62 -1
- package/dist/index.d.ts +58 -59
- package/dist/index.esm.js +62 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -277,6 +277,66 @@ var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
|
277
277
|
return PostgresError;
|
|
278
278
|
})({});
|
|
279
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
|
+
|
|
280
340
|
function _assert_this_initialized$1(self) {
|
|
281
341
|
if (self === void 0) {
|
|
282
342
|
throw new ReferenceError(
|
|
@@ -770,7 +830,7 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
770
830
|
logger.error('Request failed because of a network error.');
|
|
771
831
|
var _response_toString;
|
|
772
832
|
var nativeError = new NativeException(
|
|
773
|
-
|
|
833
|
+
HttpStatus.NOT_IMPLEMENTED,
|
|
774
834
|
(_response_toString = response.toString()) !== null &&
|
|
775
835
|
_response_toString !== void 0
|
|
776
836
|
? _response_toString
|
|
@@ -1386,6 +1446,7 @@ var userTimezonePlugin = function (handlebars, param) {
|
|
|
1386
1446
|
exports.CookieHelper = CookieHelper;
|
|
1387
1447
|
exports.DateFormatter = DateFormatter;
|
|
1388
1448
|
exports.HttpHandler = HttpHandler;
|
|
1449
|
+
exports.HttpStatus = HttpStatus;
|
|
1389
1450
|
exports.NativeException = NativeException;
|
|
1390
1451
|
exports.PatternCompiler = PatternCompiler;
|
|
1391
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'.
|
package/dist/index.esm.js
CHANGED
|
@@ -275,6 +275,66 @@ var PostgresError = /*#__PURE__*/ (function (PostgresError) {
|
|
|
275
275
|
return PostgresError;
|
|
276
276
|
})({});
|
|
277
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
|
+
|
|
278
338
|
function _assert_this_initialized$1(self) {
|
|
279
339
|
if (self === void 0) {
|
|
280
340
|
throw new ReferenceError(
|
|
@@ -768,7 +828,7 @@ var HttpHandler = /*#__PURE__*/ (function () {
|
|
|
768
828
|
logger.error('Request failed because of a network error.');
|
|
769
829
|
var _response_toString;
|
|
770
830
|
var nativeError = new NativeException(
|
|
771
|
-
|
|
831
|
+
HttpStatus.NOT_IMPLEMENTED,
|
|
772
832
|
(_response_toString = response.toString()) !== null &&
|
|
773
833
|
_response_toString !== void 0
|
|
774
834
|
? _response_toString
|
|
@@ -1385,6 +1445,7 @@ export {
|
|
|
1385
1445
|
CookieHelper,
|
|
1386
1446
|
DateFormatter,
|
|
1387
1447
|
HttpHandler,
|
|
1448
|
+
HttpStatus,
|
|
1388
1449
|
NativeException,
|
|
1389
1450
|
PatternCompiler,
|
|
1390
1451
|
PgException,
|