@bts-soft/core 1.0.2 → 1.0.4
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 +26 -99
- package/license +19 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,189 +1,116 @@
|
|
|
1
|
-
## @bts-soft/core | The BTS Software Core Toolkit
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
## @bts-soft/core | The BTS Software Core Toolkit
|
|
4
3
|
|
|
5
4
|
The **`@bts-soft/core`** package serves as the unified entry point for all high-quality, pre-configured modules developed by BTS Software.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
6
|
This package simplifies development by bundling essential backend components (like email queuing, security guards, and utilities) into one dependency, ensuring a consistent and robust NestJS architecture out-of-the-box.
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
8
|
---
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
10
|
## Features and Included Modules
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
21
12
|
By installing `@bts-soft/core`, you automatically gain access to all the following specialized modules and services:
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| Module | NPM Package (Internal) | Description |
|
|
26
|
-
|
|
14
|
+
| Module | NPM Package (Internal) | Description |
|
|
27
15
|
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------------- |
|
|
28
|
-
|
|
29
16
|
| **Email Queue** | `@bts-soft/mail-queue` | Reliable, asynchronous email sending using BullMQ and Nodemailer, preventing request blocking. |
|
|
30
17
|
|
|
31
|
-
|
|
32
|
-
|
|
33
18
|
|
|
34
19
|
---
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
|
|
38
21
|
## Getting Started
|
|
39
22
|
|
|
40
|
-
|
|
41
|
-
|
|
42
23
|
### 1. Installation
|
|
43
24
|
|
|
44
|
-
|
|
45
|
-
|
|
46
25
|
Install the core package and its required peer dependencies (BullMQ, Nodemailer, etc. are installed automatically as dependencies of `@bts-soft/mail-queue`):
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
|
|
50
27
|
|
|
51
28
|
```
|
|
52
|
-
|
|
53
29
|
npm install @bts-soft/core
|
|
54
|
-
|
|
55
30
|
```
|
|
56
31
|
|
|
57
|
-
|
|
58
|
-
|
|
59
32
|
### 2. Configuration (Environment Variables)
|
|
60
33
|
|
|
61
|
-
|
|
62
|
-
|
|
63
34
|
Your application must define the following environment variables (required primarily by the `mail-queue` module):
|
|
64
35
|
|
|
65
|
-
|
|
66
|
-
|
|
67
36
|
|Variable|Usage|
|
|
68
|
-
|
|
69
37
|
|---|---|
|
|
70
|
-
|
|
71
38
|
|`REDIS_HOST`, `REDIS_PORT`|Required for BullMQ queue management.|
|
|
72
|
-
|
|
73
39
|
|`MAIL_HOST`, `MAIL_USER`, `MAIL_PASS`|Required for Nodemailer SMTP connection.|
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
|
|
77
41
|
### 3. Usage in `AppModule`
|
|
78
42
|
|
|
79
|
-
|
|
80
|
-
|
|
81
43
|
All modules are designed to be imported directly from the `@bts-soft/core` package.
|
|
82
44
|
|
|
83
|
-
|
|
84
|
-
|
|
85
45
|
|
|
86
46
|
```
|
|
87
|
-
|
|
88
47
|
// app.module.ts
|
|
89
|
-
|
|
90
48
|
import { Module } from '@nestjs/common';
|
|
91
|
-
|
|
92
49
|
// Import all modules and services from the unified Core package
|
|
93
|
-
|
|
94
|
-
import { EmailModule } from '@bts-soft/core';
|
|
95
|
-
|
|
96
|
-
|
|
50
|
+
import { EmailModule } from '@bts-soft/core';
|
|
97
51
|
|
|
98
52
|
@Module({
|
|
99
|
-
|
|
100
53
|
imports: [
|
|
101
|
-
|
|
102
54
|
// Example: Registering the Email Module
|
|
103
|
-
|
|
104
55
|
EmailModule.register({
|
|
105
|
-
|
|
106
56
|
// Optional: Custom connection settings can be passed here
|
|
107
|
-
|
|
108
57
|
}),
|
|
109
|
-
|
|
110
58
|
// ... Other application modules
|
|
111
|
-
|
|
112
59
|
],
|
|
113
|
-
|
|
114
60
|
// ...
|
|
115
|
-
|
|
116
61
|
})
|
|
117
|
-
|
|
118
62
|
export class AppModule {}
|
|
119
|
-
|
|
120
63
|
```
|
|
121
64
|
|
|
122
|
-
|
|
123
|
-
|
|
124
65
|
### 4. Injecting Services
|
|
125
66
|
|
|
126
|
-
|
|
127
|
-
|
|
128
67
|
Access services (like the email sender) by importing them directly from the core package:
|
|
129
68
|
|
|
130
|
-
|
|
131
|
-
|
|
132
69
|
TypeScript
|
|
133
70
|
|
|
134
|
-
|
|
135
|
-
|
|
136
71
|
```
|
|
137
|
-
|
|
138
72
|
// my.service.ts
|
|
139
|
-
|
|
140
73
|
import { Injectable } from '@nestjs/common';
|
|
141
|
-
|
|
142
|
-
import { SendEmailService } from '@bts-soft/core'; // ⬅️ Imported from @bts-soft/core
|
|
143
|
-
|
|
144
|
-
|
|
74
|
+
import { SendEmailService } from '@bts-soft/core'; // Imported from @bts-soft/core
|
|
145
75
|
|
|
146
76
|
@Injectable()
|
|
147
|
-
|
|
148
77
|
export class MyService {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
user.email,
|
|
163
|
-
|
|
164
|
-
'Welcome!',
|
|
165
|
-
|
|
166
|
-
'Thanks for signing up to our platform.'
|
|
167
|
-
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
78
|
+
constructor(private readonly emailService: SendEmailService) {}
|
|
79
|
+
|
|
80
|
+
async handleSignup(user: any) {
|
|
81
|
+
// Logic...
|
|
82
|
+
|
|
83
|
+
// Queue the email job
|
|
84
|
+
await this.emailService.sendEmail(
|
|
85
|
+
user.email,
|
|
86
|
+
'Welcome!',
|
|
87
|
+
'Thanks for signing up to our platform.'
|
|
88
|
+
);
|
|
89
|
+
}
|
|
172
90
|
}
|
|
173
|
-
|
|
174
91
|
```
|
|
175
92
|
|
|
93
|
+
|
|
176
94
|
|
|
177
95
|
|
|
178
96
|
## Contact
|
|
179
97
|
|
|
98
|
+
|
|
99
|
+
|
|
180
100
|
**Author:** Omar Sabry
|
|
101
|
+
|
|
181
102
|
**Email:** omar.sabry.dev@gmail.com
|
|
103
|
+
|
|
182
104
|
**LinkedIn:** [(1) Omar Sabry | LinkedIn](https://www.linkedin.com/in/omarsa6ry/)
|
|
105
|
+
|
|
183
106
|
Portfolio: https://omarsabry.netlify.app/
|
|
184
107
|
|
|
185
108
|
|
|
186
109
|
|
|
110
|
+
|
|
111
|
+
|
|
187
112
|
## Repository
|
|
188
113
|
|
|
114
|
+
|
|
115
|
+
|
|
189
116
|
**GitHub:** [bts-soft/packages/core at main · Omar-Sa6ry/bts-soft](https://github.com/Omar-Sa6ry/bts-soft/tree/main/packages/core)
|
package/license
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) [2025] [BTS Software]
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bts-soft/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"author": "Omar Sabry",
|
|
5
|
+
"description": "All bts-soft packages",
|
|
4
6
|
"main": "dist/index.js",
|
|
5
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
6
9
|
"dependencies": {
|
|
7
|
-
"@bts-soft/mail-queue": "^1.0.
|
|
10
|
+
"@bts-soft/mail-queue": "^1.0.5"
|
|
8
11
|
},
|
|
9
12
|
"peerDependencies": {
|
|
10
13
|
"@nestjs/common": "^10.0.0",
|