@carecard/common-util 3.0.4 → 3.0.6
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/index.d.ts +86 -55
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,72 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new object containing only the specified properties from the source object.
|
|
3
|
+
* @param obj - The source object.
|
|
4
|
+
* @param arrayOfProperties - An array of property names to extract.
|
|
5
|
+
* @returns A new object with the extracted properties.
|
|
6
|
+
*/
|
|
7
|
+
export function extractObjectWithProperties(obj: any, arrayOfProperties: string[]): Record<string, any>;
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* Utility functions for object manipulation.
|
|
11
|
+
* @deprecated Use direct imports instead.
|
|
3
12
|
*/
|
|
4
13
|
export const util: {
|
|
5
|
-
|
|
6
|
-
* Creates a new object containing only the specified properties from the source object.
|
|
7
|
-
* @param obj - The source object.
|
|
8
|
-
* @param arrayOfProperties - An array of property names to extract.
|
|
9
|
-
* @returns A new object with the extracted properties.
|
|
10
|
-
*/
|
|
11
|
-
extractObjectWithProperties: (obj: any, arrayOfProperties: string[]) => Record<string, any>;
|
|
14
|
+
extractObjectWithProperties: typeof extractObjectWithProperties;
|
|
12
15
|
};
|
|
13
16
|
|
|
17
|
+
/** Throws an Account_Suspended error. */
|
|
18
|
+
export function throwAccountSuspendedError(params?: { userMessage?: string, details?: any }): never;
|
|
19
|
+
/** Throws an Account_Blocked error. */
|
|
20
|
+
export function throwAccountBlockedError(params?: { userMessage?: string, details?: any }): never;
|
|
21
|
+
/** Throws an Account_Inactive error. */
|
|
22
|
+
export function throwAccountInactiveError(params?: { userMessage?: string, details?: any }): never;
|
|
23
|
+
/** Middleware to handle 404 Not Found. */
|
|
24
|
+
export function notFound404(req: any, res: any, next: any): void;
|
|
25
|
+
/** Central application error handler middleware. */
|
|
26
|
+
export function appErrorHandler(err: any, req: any, res: any, next: any): void;
|
|
27
|
+
/** Throws a Validation_Failure error. */
|
|
28
|
+
export function throwValidationFailureError(params?: { userMessage?: string, details?: any }): never;
|
|
29
|
+
/** Throws a Record_Exist error. */
|
|
30
|
+
export function throwRecordExistError(params?: { userMessage?: string, details?: any }): never;
|
|
31
|
+
/** Throws a Wrong_Credentials error. */
|
|
32
|
+
export function throwWrongCredentialsError(params?: { userMessage?: string, details?: any }): never;
|
|
33
|
+
/** Throws a Login_Required error. */
|
|
34
|
+
export function throwLoginRequiredError(params?: { userMessage?: string, details?: any }): never;
|
|
35
|
+
/** Throws a Record_NotFound error. */
|
|
36
|
+
export function throwRecordNotFoundError(params?: { userMessage?: string, details?: any }): never;
|
|
37
|
+
/** Throws a Record_NotSaved error. */
|
|
38
|
+
export function throwRecordNotSavedError(params?: { userMessage?: string, details?: any }): never;
|
|
39
|
+
/** Throws an Update_Failed error. */
|
|
40
|
+
export function throwUpdateFailedError(params?: { userMessage?: string, details?: any }): never;
|
|
41
|
+
/** Throws a Transaction_Failed error. */
|
|
42
|
+
export function throwTransactionFailedError(params?: { userMessage?: string, details?: any }): never;
|
|
43
|
+
/** Throws a Used_Token error. */
|
|
44
|
+
export function throwUsedTokenError(params?: { userMessage?: string, details?: any }): never;
|
|
45
|
+
/** Throws a Bad_Visitor_Token error. */
|
|
46
|
+
export function throwBadVisitorTokenError(params?: { userMessage?: string, details?: any }): never;
|
|
47
|
+
/** Throws a File_Format_Not_Supported error. */
|
|
48
|
+
export function throwFileFormatNotSupportedError(params?: { userMessage?: string, details?: any }): never;
|
|
49
|
+
/** Throws a Not_Authorized error. */
|
|
50
|
+
export function throwNotAuthorizedError(params?: { userMessage?: string, details?: any }): never;
|
|
51
|
+
/** Throws a Bad_Input error. */
|
|
52
|
+
export function throwBadInputError(params?: { userMessage?: string, details?: any }): never;
|
|
53
|
+
/** Throws an Input_Not_Uuid error. */
|
|
54
|
+
export function throwInputNotUuidError(params?: { userMessage?: string, details?: any }): never;
|
|
55
|
+
/** Throws a File_Too_Large error. */
|
|
56
|
+
export function throwFileTooLargeError(params?: { userMessage?: string, details?: any }): never;
|
|
57
|
+
/** Throws an Invalid_Time_Value error. */
|
|
58
|
+
export function throwInvalidTimeValueError(params?: { userMessage?: string, details?: any }): never;
|
|
59
|
+
|
|
14
60
|
/**
|
|
15
61
|
* Application-level error handlers and throwers.
|
|
62
|
+
* @deprecated Use direct imports instead.
|
|
16
63
|
*/
|
|
17
64
|
export const error: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
throwRecordNotSavedError: (params?: { userMessage?: string, details?: any }) => never;
|
|
40
|
-
/** Throws an Update_Failed error. */
|
|
41
|
-
throwUpdateFailedError: (params?: { userMessage?: string, details?: any }) => never;
|
|
42
|
-
/** Throws a Transaction_Failed error. */
|
|
43
|
-
throwTransactionFailedError: (params?: { userMessage?: string, details?: any }) => never;
|
|
44
|
-
/** Throws a Used_Token error. */
|
|
45
|
-
throwUsedTokenError: (params?: { userMessage?: string, details?: any }) => never;
|
|
46
|
-
/** Throws a Bad_Visitor_Token error. */
|
|
47
|
-
throwBadVisitorTokenError: (params?: { userMessage?: string, details?: any }) => never;
|
|
48
|
-
/** Throws a File_Format_Not_Supported error. */
|
|
49
|
-
throwFileFormatNotSupportedError: (params?: { userMessage?: string, details?: any }) => never;
|
|
50
|
-
/** Throws a Not_Authorized error. */
|
|
51
|
-
throwNotAuthorizedError: (params?: { userMessage?: string, details?: any }) => never;
|
|
52
|
-
/** Throws a Bad_Input error. */
|
|
53
|
-
throwBadInputError: (params?: { userMessage?: string, details?: any }) => never;
|
|
54
|
-
/** Throws an Input_Not_Uuid error. */
|
|
55
|
-
throwInputNotUuidError: (params?: { userMessage?: string, details?: any }) => never;
|
|
56
|
-
/** Throws a File_Too_Large error. */
|
|
57
|
-
throwFileTooLargeError: (params?: { userMessage?: string, details?: any }) => never;
|
|
58
|
-
/** Throws an Invalid_Time_Value error. */
|
|
59
|
-
throwInvalidTimeValueError: (params?: { userMessage?: string, details?: any }) => never;
|
|
65
|
+
throwAccountSuspendedError: typeof throwAccountSuspendedError;
|
|
66
|
+
throwAccountBlockedError: typeof throwAccountBlockedError;
|
|
67
|
+
throwAccountInactiveError: typeof throwAccountInactiveError;
|
|
68
|
+
notFound404: typeof notFound404;
|
|
69
|
+
appErrorHandler: typeof appErrorHandler;
|
|
70
|
+
throwValidationFailureError: typeof throwValidationFailureError;
|
|
71
|
+
throwRecordExistError: typeof throwRecordExistError;
|
|
72
|
+
throwWrongCredentialsError: typeof throwWrongCredentialsError;
|
|
73
|
+
throwLoginRequiredError: typeof throwLoginRequiredError;
|
|
74
|
+
throwRecordNotFoundError: typeof throwRecordNotFoundError;
|
|
75
|
+
throwRecordNotSavedError: typeof throwRecordNotSavedError;
|
|
76
|
+
throwUpdateFailedError: typeof throwUpdateFailedError;
|
|
77
|
+
throwTransactionFailedError: typeof throwTransactionFailedError;
|
|
78
|
+
throwUsedTokenError: typeof throwUsedTokenError;
|
|
79
|
+
throwBadVisitorTokenError: typeof throwBadVisitorTokenError;
|
|
80
|
+
throwFileFormatNotSupportedError: typeof throwFileFormatNotSupportedError;
|
|
81
|
+
throwNotAuthorizedError: typeof throwNotAuthorizedError;
|
|
82
|
+
throwBadInputError: typeof throwBadInputError;
|
|
83
|
+
throwInputNotUuidError: typeof throwInputNotUuidError;
|
|
84
|
+
throwFileTooLargeError: typeof throwFileTooLargeError;
|
|
85
|
+
throwInvalidTimeValueError: typeof throwInvalidTimeValueError;
|
|
60
86
|
};
|
|
61
87
|
|
|
88
|
+
/** Sets 200 OK status and optionally an ETag header. */
|
|
89
|
+
export function setOk200(res: any, ETag?: string): any;
|
|
90
|
+
/** Sets 201 Created status. */
|
|
91
|
+
export function setCreated201(res: any): any;
|
|
92
|
+
/** Sets 400 Bad Request status. */
|
|
93
|
+
export function setBadRequest400ClientError(res: any): any;
|
|
94
|
+
|
|
62
95
|
/**
|
|
63
96
|
* Utility functions for setting HTTP response status codes and headers.
|
|
97
|
+
* @deprecated Use direct imports instead.
|
|
64
98
|
*/
|
|
65
99
|
export const resCode: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setCreated201: (res: any) => any;
|
|
70
|
-
/** Sets 400 Bad Request status. */
|
|
71
|
-
setBadRequest400ClientError: (res: any) => any;
|
|
100
|
+
setOk200: typeof setOk200;
|
|
101
|
+
setCreated201: typeof setCreated201;
|
|
102
|
+
setBadRequest400ClientError: typeof setBadRequest400ClientError;
|
|
72
103
|
};
|