@arkyn/server 2.0.1-beta.13 → 2.0.1-beta.15
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/README.md +116 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
The `@arkyn/server` package provides utilities and services to streamline backend application development. It includes API configurations, HTTP error handlers, and various services for file manipulation.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
Install the package using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @arkyn/server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✨ Features
|
|
16
|
+
|
|
17
|
+
### Settings
|
|
18
|
+
|
|
19
|
+
- **`ApiInstance`**
|
|
20
|
+
Pre-configured instance for API calls.
|
|
21
|
+
|
|
22
|
+
- **`InboxFlowInstance`**
|
|
23
|
+
Pre-configured instance for integration with Inbox Flow.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### HTTP Responses - Errors
|
|
28
|
+
|
|
29
|
+
- **`BadGateway(message: string): Error`**
|
|
30
|
+
Represents an HTTP 502 error.
|
|
31
|
+
|
|
32
|
+
- **`BadRequest(message: string): Error`**
|
|
33
|
+
Represents an HTTP 400 error.
|
|
34
|
+
|
|
35
|
+
- **`Conflict(message: string): Error`**
|
|
36
|
+
Represents an HTTP 409 error.
|
|
37
|
+
|
|
38
|
+
- **`Forbidden(message: string): Error`**
|
|
39
|
+
Represents an HTTP 403 error.
|
|
40
|
+
|
|
41
|
+
- **`NotFound(message: string): Error`**
|
|
42
|
+
Represents an HTTP 404 error.
|
|
43
|
+
|
|
44
|
+
- **`NotImplemented(message: string): Error`**
|
|
45
|
+
Represents an HTTP 501 error.
|
|
46
|
+
|
|
47
|
+
- **`ServerError(message: string): Error`**
|
|
48
|
+
Represents an HTTP 500 error.
|
|
49
|
+
|
|
50
|
+
- **`Unauthorized(message: string): Error`**
|
|
51
|
+
Represents an HTTP 401 error.
|
|
52
|
+
|
|
53
|
+
- **`UnprocessableEntity(message: string): Error`**
|
|
54
|
+
Represents an HTTP 422 error.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### HTTP Responses - Success
|
|
59
|
+
|
|
60
|
+
- **`Created(data: any): Response`**
|
|
61
|
+
Represents an HTTP 201 response.
|
|
62
|
+
|
|
63
|
+
- **`Found(data: any): Response`**
|
|
64
|
+
Represents an HTTP 302 response.
|
|
65
|
+
|
|
66
|
+
- **`NoContent(): Response`**
|
|
67
|
+
Represents an HTTP 204 response.
|
|
68
|
+
|
|
69
|
+
- **`Success(data: any): Response`**
|
|
70
|
+
Represents an HTTP 200 response.
|
|
71
|
+
|
|
72
|
+
- **`Updated(data: any): Response`**
|
|
73
|
+
Represents an HTTP 200 response for updates.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Services
|
|
78
|
+
|
|
79
|
+
- **`decodeErrorMessageFromRequest(request: Request): string`**
|
|
80
|
+
Decodes error messages from a request.
|
|
81
|
+
|
|
82
|
+
- **`decodeRequestBody(request: Request): any`**
|
|
83
|
+
Decodes the body of a request.
|
|
84
|
+
|
|
85
|
+
- **`errorHandler(error: Error): Response`**
|
|
86
|
+
Handles errors and returns an appropriate response.
|
|
87
|
+
|
|
88
|
+
- **`formParse(request: Request): FormData`**
|
|
89
|
+
Parses form data.
|
|
90
|
+
|
|
91
|
+
- **`getCaller(): string`**
|
|
92
|
+
Returns the name of the function that invoked the method.
|
|
93
|
+
|
|
94
|
+
- **`getScopedParams(request: Request): URLSearchParams`**
|
|
95
|
+
Retrieves scoped parameters from a request.
|
|
96
|
+
|
|
97
|
+
- **`httpDebug(request: Request): void`**
|
|
98
|
+
Displays debug information for an HTTP request.
|
|
99
|
+
|
|
100
|
+
- **`SchemaValidator(schema: any, data: any): boolean`**
|
|
101
|
+
Validates data against a schema.
|
|
102
|
+
|
|
103
|
+
- **`sendFileToS3(file: File, config: AwsConfig): Promise<{ url: string }>`**
|
|
104
|
+
Uploads a file to AWS S3.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 🤝 Contribution
|
|
109
|
+
|
|
110
|
+
Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 📄 License
|
|
115
|
+
|
|
116
|
+
This project is licensed under the MIT License. See the `LICENSE` file for more details.
|