@arkyn/server 2.0.1-beta.17 → 2.0.1-beta.19
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/LICENSE.txt +24 -0
- package/README.md +1 -1
- package/dist/config/apiInstance.d.ts +5 -5
- package/dist/config/apiInstance.d.ts.map +1 -1
- package/dist/config/apiInstance.js +9 -9
- package/package.json +2 -2
- package/src/config/apiInstance.ts +14 -14
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
Copyright 2025 Lucas Gonçalves
|
|
8
|
+
|
|
9
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License.
|
|
11
|
+
You may obtain a copy of the License at
|
|
12
|
+
|
|
13
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
|
|
15
|
+
Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
See the License for the specific language governing permissions and
|
|
19
|
+
limitations under the License.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
For more information or to contribute, visit:
|
|
24
|
+
https://github.com/Lucas-Eduardo-Goncalves
|
package/README.md
CHANGED
|
@@ -113,4 +113,4 @@ Contributions are welcome! Feel free to open issues or submit pull requests to i
|
|
|
113
113
|
|
|
114
114
|
## License
|
|
115
115
|
|
|
116
|
-
This project is licensed under the
|
|
116
|
+
This project is licensed under the Apache 2.0 License. See the `LICENSE` file for more details.
|
|
@@ -46,35 +46,35 @@ declare class ApiInstance {
|
|
|
46
46
|
* @param data - The request data, including optional headers and token.
|
|
47
47
|
* @returns The API response data.
|
|
48
48
|
*/
|
|
49
|
-
GET(route: string, data
|
|
49
|
+
GET(route: string, data?: ApiRequestDataWithoutBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
50
50
|
/**
|
|
51
51
|
* Sends a POST request to the specified route.
|
|
52
52
|
* @param route - The API route to send the POST request to.
|
|
53
53
|
* @param data - The request data, including body, optional headers, and token.
|
|
54
54
|
* @returns The API response data.
|
|
55
55
|
*/
|
|
56
|
-
POST(route: string, data
|
|
56
|
+
POST(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
57
57
|
/**
|
|
58
58
|
* Sends a PUT request to the specified route.
|
|
59
59
|
* @param route - The API route to send the PUT request to.
|
|
60
60
|
* @param data - The request data, including body, optional headers, and token.
|
|
61
61
|
* @returns The API response data.
|
|
62
62
|
*/
|
|
63
|
-
PUT(route: string, data
|
|
63
|
+
PUT(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
64
64
|
/**
|
|
65
65
|
* Sends a PATCH request to the specified route.
|
|
66
66
|
* @param route - The API route to send the PATCH request to.
|
|
67
67
|
* @param data - The request data, including body, optional headers, and token.
|
|
68
68
|
* @returns The API response data.
|
|
69
69
|
*/
|
|
70
|
-
PATCH(route: string, data
|
|
70
|
+
PATCH(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
71
71
|
/**
|
|
72
72
|
* Sends a DELETE request to the specified route.
|
|
73
73
|
* @param route - The API route to send the DELETE request to.
|
|
74
74
|
* @param data - The request data, including body, optional headers, and token.
|
|
75
75
|
* @returns The API response data.
|
|
76
76
|
*/
|
|
77
|
-
DELETE(route: string, data
|
|
77
|
+
DELETE(route: string, data?: ApiRequestDataWithBodyProps): Promise<import("@arkyn/types").ApiResponseDTO<any>>;
|
|
78
78
|
}
|
|
79
79
|
export { ApiInstance };
|
|
80
80
|
//# sourceMappingURL=apiInstance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiInstance.d.ts","sourceRoot":"","sources":["../../src/config/apiInstance.ts"],"names":[],"mappings":"AAMA,KAAK,2BAA2B,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AAEH,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B;;;;;;OAMG;gBAES,KAAK,EAAE,2BAA2B;IAM9C;;;;OAIG;IAEH,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IAEH,OAAO,CAAC,eAAe;IAcvB;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"apiInstance.d.ts","sourceRoot":"","sources":["../../src/config/apiInstance.ts"],"names":[],"mappings":"AAMA,KAAK,2BAA2B,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AAEH,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,SAAS,CAAC,CAAS;IAE3B;;;;;;OAMG;gBAES,KAAK,EAAE,2BAA2B;IAM9C;;;;OAIG;IAEH,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IAEH,OAAO,CAAC,eAAe;IAcvB;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,8BAA8B;IAM9D;;;;;OAKG;IAEG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO5D;;;;;OAKG;IAEG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO3D;;;;;OAKG;IAEG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;IAO7D;;;;;OAKG;IAEG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,2BAA2B;CAM/D;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -56,7 +56,7 @@ class ApiInstance {
|
|
|
56
56
|
*/
|
|
57
57
|
async GET(route, data) {
|
|
58
58
|
const url = this.generateURL(route);
|
|
59
|
-
const headers = this.generateHeaders(data
|
|
59
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
60
60
|
return await getRequest(url, headers);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -67,8 +67,8 @@ class ApiInstance {
|
|
|
67
67
|
*/
|
|
68
68
|
async POST(route, data) {
|
|
69
69
|
const url = this.generateURL(route);
|
|
70
|
-
const headers = this.generateHeaders(data
|
|
71
|
-
const body = data
|
|
70
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
71
|
+
const body = data?.body;
|
|
72
72
|
return await postRequest(url, headers, body);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
@@ -79,8 +79,8 @@ class ApiInstance {
|
|
|
79
79
|
*/
|
|
80
80
|
async PUT(route, data) {
|
|
81
81
|
const url = this.generateURL(route);
|
|
82
|
-
const headers = this.generateHeaders(data
|
|
83
|
-
const body = data
|
|
82
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
83
|
+
const body = data?.body;
|
|
84
84
|
return await putRequest(url, headers, body);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -91,8 +91,8 @@ class ApiInstance {
|
|
|
91
91
|
*/
|
|
92
92
|
async PATCH(route, data) {
|
|
93
93
|
const url = this.generateURL(route);
|
|
94
|
-
const headers = this.generateHeaders(data
|
|
95
|
-
const body = data
|
|
94
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
95
|
+
const body = data?.body;
|
|
96
96
|
return await patchRequest(url, headers, body);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -103,8 +103,8 @@ class ApiInstance {
|
|
|
103
103
|
*/
|
|
104
104
|
async DELETE(route, data) {
|
|
105
105
|
const url = this.generateURL(route);
|
|
106
|
-
const headers = this.generateHeaders(data
|
|
107
|
-
const body = data
|
|
106
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
107
|
+
const body = data?.body;
|
|
108
108
|
return await deleteRequest(url, headers, body);
|
|
109
109
|
}
|
|
110
110
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkyn/server",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.19",
|
|
4
4
|
"main": "./dist/bundle.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"license": "
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
9
|
"author": "Arkyn | Lucas Gonçalves",
|
|
10
10
|
"description": "Server-side utilities for projects.",
|
|
11
11
|
"scripts": {
|
|
@@ -82,9 +82,9 @@ class ApiInstance {
|
|
|
82
82
|
* @returns The API response data.
|
|
83
83
|
*/
|
|
84
84
|
|
|
85
|
-
async GET(route: string, data
|
|
85
|
+
async GET(route: string, data?: ApiRequestDataWithoutBodyProps) {
|
|
86
86
|
const url = this.generateURL(route);
|
|
87
|
-
const headers = this.generateHeaders(data
|
|
87
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
88
88
|
return await getRequest(url, headers);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -95,10 +95,10 @@ class ApiInstance {
|
|
|
95
95
|
* @returns The API response data.
|
|
96
96
|
*/
|
|
97
97
|
|
|
98
|
-
async POST(route: string, data
|
|
98
|
+
async POST(route: string, data?: ApiRequestDataWithBodyProps) {
|
|
99
99
|
const url = this.generateURL(route);
|
|
100
|
-
const headers = this.generateHeaders(data
|
|
101
|
-
const body = data
|
|
100
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
101
|
+
const body = data?.body;
|
|
102
102
|
return await postRequest(url, headers, body);
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -109,10 +109,10 @@ class ApiInstance {
|
|
|
109
109
|
* @returns The API response data.
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
|
-
async PUT(route: string, data
|
|
112
|
+
async PUT(route: string, data?: ApiRequestDataWithBodyProps) {
|
|
113
113
|
const url = this.generateURL(route);
|
|
114
|
-
const headers = this.generateHeaders(data
|
|
115
|
-
const body = data
|
|
114
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
115
|
+
const body = data?.body;
|
|
116
116
|
return await putRequest(url, headers, body);
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -123,10 +123,10 @@ class ApiInstance {
|
|
|
123
123
|
* @returns The API response data.
|
|
124
124
|
*/
|
|
125
125
|
|
|
126
|
-
async PATCH(route: string, data
|
|
126
|
+
async PATCH(route: string, data?: ApiRequestDataWithBodyProps) {
|
|
127
127
|
const url = this.generateURL(route);
|
|
128
|
-
const headers = this.generateHeaders(data
|
|
129
|
-
const body = data
|
|
128
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
129
|
+
const body = data?.body;
|
|
130
130
|
return await patchRequest(url, headers, body);
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -137,10 +137,10 @@ class ApiInstance {
|
|
|
137
137
|
* @returns The API response data.
|
|
138
138
|
*/
|
|
139
139
|
|
|
140
|
-
async DELETE(route: string, data
|
|
140
|
+
async DELETE(route: string, data?: ApiRequestDataWithBodyProps) {
|
|
141
141
|
const url = this.generateURL(route);
|
|
142
|
-
const headers = this.generateHeaders(data
|
|
143
|
-
const body = data
|
|
142
|
+
const headers = this.generateHeaders(data?.headers || {}, data?.token);
|
|
143
|
+
const body = data?.body;
|
|
144
144
|
return await deleteRequest(url, headers, body);
|
|
145
145
|
}
|
|
146
146
|
}
|