Skip to content

Commit d4805b2

Browse files
Merge pull request #30 from sparrowapp-dev/release/2.33.0
merge release/2.33.0 into development
2 parents 4133807 + 1ee29ab commit d4805b2

File tree

14 files changed

+2239
-7
lines changed

14 files changed

+2239
-7
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@
2424
"@nestjs/common": "^10.0.0",
2525
"@nestjs/core": "^10.0.0",
2626
"@nestjs/platform-express": "^10.0.0",
27+
"@nestjs/platform-fastify": "^11.1.6",
2728
"@nestjs/platform-socket.io": "^10.4.8",
2829
"@nestjs/platform-ws": "^10.4.8",
2930
"@nestjs/swagger": "^8.0.7",
3031
"@nestjs/websockets": "^10.4.8",
3132
"@types/ws": "^8.5.13",
3233
"axios": "^1.7.7",
34+
"class-transformer": "0.5.1",
35+
"class-transformer-validator": "^0.9.1",
36+
"class-validator": "^0.14.0",
37+
"fastify": "4.28.1",
3338
"form-data": "^4.0.1",
3439
"ipaddr.js": "^2.2.0",
40+
"json5": "^2.2.3",
3541
"reflect-metadata": "^0.2.0",
3642
"rxjs": "^7.8.1",
3743
"socket.io-client": "^4.8.1"

src/Types/http-client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export interface HttpClientResponseInterface<T> {
2+
status: "success" | "error";
3+
isSuccessful: boolean;
4+
message: string;
5+
data: T;
6+
}
7+
8+
export interface HttpClientBackendResponseInterface<T> {
9+
data: T;
10+
message: string;
11+
statusCode: number;
12+
}

src/enum/httpRequest.enum.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export interface KeyWrapper {
2+
key: string;
3+
}
4+
5+
export interface ValueWrapper {
6+
value: string;
7+
}
8+
9+
export enum RequestDataTypeEnum {
10+
JSON = "JSON",
11+
XML = "XML",
12+
HTML = "HTML",
13+
TEXT = "Text",
14+
JAVASCRIPT = "JavaScript",
15+
IMAGE = "Image",
16+
}
17+
18+
export enum ResponseStatusCode {
19+
OK = "200 OK",
20+
CREATED = "201 Created",
21+
ACCEPTED = "202 Accepted",
22+
NO_CONTENT = "204 No Content",
23+
BAD_REQUEST = "400 Bad Request",
24+
UNAUTHORIZED = "401 Unauthorized",
25+
FORBIDDEN = "403 Forbidden",
26+
NOT_FOUND = "404 Not Found",
27+
METHOD_NOT_ALLOWED = "405 Method Not Allowed",
28+
INTERNAL_SERVER_ERROR = "500 Internal Server Error",
29+
SERVICE_UNAVAILABLE = "503 Service Unavailable",
30+
ERROR = "Not Found",
31+
}
32+
33+
export interface KeyValue extends KeyWrapper, ValueWrapper {}

src/enum/httpResponseFormat.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { HttpClientResponseInterface } from "src/Types/http-client";
2+
3+
export const success = <T>(data: T): HttpClientResponseInterface<T> => {
4+
return {
5+
status: "success",
6+
isSuccessful: true,
7+
message: "",
8+
data,
9+
};
10+
};
11+
12+
export const error = <T>(
13+
error: string,
14+
data?: T,
15+
tabId: string = "",
16+
): HttpClientResponseInterface<T> => {
17+
return {
18+
status: "error",
19+
isSuccessful: false,
20+
message: error,
21+
data,
22+
};
23+
};
24+
25+

src/enum/testflow.enum.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
export enum BodyModeEnum {
2+
"none" = "none",
3+
"application/json" = "application/json",
4+
"application/xml" = "application/xml",
5+
"application/yaml" = "application/yaml",
6+
"application/x-www-form-urlencoded" = "application/x-www-form-urlencoded",
7+
"multipart/form-data" = "multipart/form-data",
8+
"application/javascript" = "application/javascript",
9+
"text/plain" = "text/plain",
10+
"text/html" = "text/html",
11+
}
12+
13+
export enum AuthModeEnum {
14+
"No Auth" = "No Auth",
15+
"Inherit Auth" = "Inherit Auth",
16+
"API Key" = "API Key",
17+
"Bearer Token" = "Bearer Token",
18+
"Basic Auth" = "Basic Auth",
19+
}
20+
21+
22+
export enum AddTo {
23+
Header = "Header",
24+
QueryParameter = "Query Parameter",
25+
}
26+
27+
export class Auth {
28+
bearerToken?: string;
29+
basicAuth?: {
30+
username: string;
31+
password: string;
32+
};
33+
apiKey?: {
34+
authKey: string;
35+
authValue: string | unknown;
36+
addTo: AddTo;
37+
};
38+
}
39+
40+
export type TFKeyValueStoreType = {
41+
key: string;
42+
value: string;
43+
checked?: boolean;
44+
};
45+
46+
export interface TFAPIResponseType {
47+
body?: string;
48+
headers?: object;
49+
status?: string;
50+
}
51+
52+
export enum RequestDataTypeEnum {
53+
JSON = "JSON",
54+
XML = "XML",
55+
HTML = "HTML",
56+
TEXT = "Text",
57+
JAVASCRIPT = "JavaScript",
58+
IMAGE = "Image",
59+
}

0 commit comments

Comments
 (0)