aws-service-stack 0.11.151 → 0.12.155
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 +304 -20
- package/dist/_examples/controller/e-order/e-order-crud-simple.d.ts +2 -0
- package/dist/_examples/controller/e-order/e-order-crud-simple.js +288 -0
- package/dist/_examples/controller/e-order/e-order-crud-simple.js.map +1 -0
- package/dist/_examples/controller/e-order/e-order-crud.d.ts +4 -0
- package/dist/_examples/controller/e-order/e-order-crud.js +71 -0
- package/dist/_examples/controller/e-order/e-order-crud.js.map +1 -0
- package/dist/_examples/controller/e-order/e-order.config.d.ts +8 -0
- package/dist/_examples/controller/e-order/e-order.config.js +87 -0
- package/dist/_examples/controller/e-order/e-order.config.js.map +1 -0
- package/dist/_examples/controller/e-order/e-order.controller.d.ts +16 -0
- package/dist/_examples/controller/e-order/e-order.controller.js +99 -0
- package/dist/_examples/controller/e-order/e-order.controller.js.map +1 -0
- package/dist/_examples/controller/index.d.ts +3 -0
- package/dist/_examples/controller/index.js +86 -0
- package/dist/_examples/controller/index.js.map +1 -0
- package/dist/_examples/controller/product/product.config.d.ts +12 -0
- package/dist/_examples/controller/product/product.config.js +32 -0
- package/dist/_examples/controller/product/product.config.js.map +1 -0
- package/dist/_examples/controller/profile/profile-crud-simple.d.ts +2 -0
- package/dist/_examples/controller/profile/profile-crud-simple.js +288 -0
- package/dist/_examples/controller/profile/profile-crud-simple.js.map +1 -0
- package/dist/_examples/controller/profile/profile-crud.d.ts +4 -0
- package/dist/_examples/controller/profile/profile-crud.js +71 -0
- package/dist/_examples/controller/profile/profile-crud.js.map +1 -0
- package/dist/_examples/controller/profile/profile.config.d.ts +8 -0
- package/dist/_examples/controller/profile/profile.config.js +74 -0
- package/dist/_examples/controller/profile/profile.config.js.map +1 -0
- package/dist/_examples/controller/profile/profile.controller.d.ts +16 -0
- package/dist/_examples/controller/profile/profile.controller.js +99 -0
- package/dist/_examples/controller/profile/profile.controller.js.map +1 -0
- package/dist/_examples/controller/user/user.config.d.ts +12 -0
- package/dist/_examples/controller/user/user.config.js +31 -0
- package/dist/_examples/controller/user/user.config.js.map +1 -0
- package/dist/_examples/controller/user.controller.d.ts +15 -0
- package/dist/_examples/controller/user.controller.js +49 -0
- package/dist/_examples/controller/user.controller.js.map +1 -0
- package/dist/_examples/model/example.model.d.ts +47 -0
- package/dist/_examples/model/example.model.js +10 -0
- package/dist/_examples/model/example.model.js.map +1 -0
- package/dist/_examples/repositories/order/order-es.repo.d.ts +12 -0
- package/dist/_examples/repositories/order/order-es.repo.interface.d.ts +7 -0
- package/dist/_examples/repositories/order/order-es.repo.interface.js +3 -0
- package/dist/_examples/repositories/order/order-es.repo.interface.js.map +1 -0
- package/dist/_examples/repositories/order/order-es.repo.js +79 -0
- package/dist/_examples/repositories/order/order-es.repo.js.map +1 -0
- package/dist/_examples/repositories/order/order-repo-db.d.ts +6 -0
- package/dist/_examples/repositories/order/order-repo-db.interface.d.ts +4 -0
- package/dist/_examples/repositories/order/order-repo-db.interface.js +3 -0
- package/dist/_examples/repositories/order/order-repo-db.interface.js.map +1 -0
- package/dist/_examples/repositories/order/order-repo-db.js +19 -0
- package/dist/_examples/repositories/order/order-repo-db.js.map +1 -0
- package/dist/_examples/repositories/profile-repo-db.d.ts +6 -0
- package/dist/_examples/repositories/profile-repo-db.interface.d.ts +4 -0
- package/dist/_examples/repositories/profile-repo-db.interface.js +3 -0
- package/dist/_examples/repositories/profile-repo-db.interface.js.map +1 -0
- package/dist/_examples/repositories/profile-repo-db.js +19 -0
- package/dist/_examples/repositories/profile-repo-db.js.map +1 -0
- package/dist/_examples/repositories/user-repo-db.d.ts +7 -0
- package/dist/_examples/repositories/user-repo-db.interface.d.ts +5 -0
- package/dist/_examples/repositories/user-repo-db.interface.js +3 -0
- package/dist/_examples/repositories/user-repo-db.interface.js.map +1 -0
- package/dist/_examples/repositories/user-repo-db.js +35 -0
- package/dist/_examples/repositories/user-repo-db.js.map +1 -0
- package/dist/_examples/service/order-service.d.ts +13 -0
- package/dist/_examples/service/order-service.interface.d.ts +4 -0
- package/dist/_examples/service/order-service.interface.js +3 -0
- package/dist/_examples/service/order-service.interface.js.map +1 -0
- package/dist/_examples/service/order-service.js +42 -0
- package/dist/_examples/service/order-service.js.map +1 -0
- package/dist/_examples/service/profile-service.d.ts +22 -0
- package/dist/_examples/service/profile-service.interface.d.ts +8 -0
- package/dist/_examples/service/profile-service.interface.js +3 -0
- package/dist/_examples/service/profile-service.interface.js.map +1 -0
- package/dist/_examples/service/profile-service.js +194 -0
- package/dist/_examples/service/profile-service.js.map +1 -0
- package/dist/_examples/service/user-service.d.ts +12 -0
- package/dist/_examples/service/user-service.interface.d.ts +5 -0
- package/dist/_examples/service/user-service.interface.js +3 -0
- package/dist/_examples/service/user-service.interface.js.map +1 -0
- package/dist/_examples/service/user-service.js +41 -0
- package/dist/_examples/service/user-service.js.map +1 -0
- package/dist/controller/base-controller.js +2 -0
- package/dist/controller/base-controller.js.map +1 -1
- package/dist/model/base.model.d.ts +1 -1
- package/dist/repositories/base-core.repo.interface.d.ts +5 -76
- package/dist/repositories/base-db.repo.d.ts +6 -6
- package/dist/repositories/base-db.repo.interface.d.ts +68 -7
- package/dist/repositories/base-db.repo.js.map +1 -1
- package/dist/repositories/base-es.repo.d.ts +5 -14
- package/dist/repositories/base-es.repo.interface.d.ts +1 -2
- package/dist/repositories/base-es.repo.js +33 -49
- package/dist/repositories/base-es.repo.js.map +1 -1
- package/dist/service/base.service.d.ts +5 -5
- package/dist/service/base.service.interface.d.ts +5 -5
- package/dist/service/base.service.js.map +1 -1
- package/dist/utils/dynamodb.utils.d.ts +5 -5
- package/dist/utils/dynamodb.utils.js.map +1 -1
- package/dist/utils/http.util.d.ts +3 -3
- package/dist/utils/http.util.js +3 -3
- package/dist/utils/http.util.js.map +1 -1
- package/dist/utils/opensearch.utils.d.ts +3 -41
- package/dist/utils/opensearch.utils.js +122 -297
- package/dist/utils/opensearch.utils.js.map +1 -1
- package/dist/utils/reflection.util.d.ts +3 -3
- package/dist/utils/reflection.util.js.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -1,20 +1,304 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
# AWS Service Stack
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/aws-service-stack)
|
|
4
|
+
[](https://opensource.org/licenses/ISC)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
📦 **NPM Package**: [aws-service-stack](https://www.npmjs.com/package/aws-service-stack)
|
|
8
|
+
|
|
9
|
+
A comprehensive TypeScript backend framework for AWS serverless applications, providing enterprise-grade abstractions for DynamoDB, OpenSearch, API Gateway, Lambda, and Cognito integration.
|
|
10
|
+
|
|
11
|
+
## 🚀 Features
|
|
12
|
+
|
|
13
|
+
### **Core Infrastructure**
|
|
14
|
+
- **🏗️ Base Controllers** - Abstract AWS Lambda event handling for API Gateway, SQS, DynamoDB Streams, and WebSocket events
|
|
15
|
+
- **🗄️ Repository Pattern** - Unified interfaces for DynamoDB and OpenSearch with transaction support
|
|
16
|
+
- **🔐 Authentication & Authorization** - Built-in Cognito integration with role-based permissions
|
|
17
|
+
- **📊 Search & Analytics** - Full-text search with OpenSearch integration
|
|
18
|
+
- **✅ Validation** - Support for both Zod and Yup schemas with type-safe validation
|
|
19
|
+
|
|
20
|
+
### **AWS Services Integration**
|
|
21
|
+
- **DynamoDB** - Complete CRUD operations, batch processing, transactions, and advanced querying
|
|
22
|
+
- **OpenSearch** - Full-text search, faceted search, and analytics
|
|
23
|
+
- **API Gateway** - RESTful API handling with automatic request/response parsing
|
|
24
|
+
- **Lambda** - Event-driven architecture with SQS, DynamoDB Streams, and scheduled events
|
|
25
|
+
- **Cognito** - User authentication, authorization, and group management
|
|
26
|
+
- **Secrets Manager** - Secure credential management
|
|
27
|
+
|
|
28
|
+
### **Developer Experience**
|
|
29
|
+
- **🔧 TypeScript First** - Full type safety with comprehensive interfaces
|
|
30
|
+
- **🏛️ Dependency Injection** - TypeDI integration for clean architecture
|
|
31
|
+
- **📝 Comprehensive Logging** - Structured logging with different levels
|
|
32
|
+
- **🧪 Testing Ready** - Jest configuration with TypeScript support
|
|
33
|
+
- **📦 Modular Design** - Tree-shakable modules for optimal bundle size
|
|
34
|
+
|
|
35
|
+
## 📦 Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install aws-service-stack
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Peer Dependencies
|
|
42
|
+
|
|
43
|
+
This package requires the following AWS SDK v3 packages as peer dependencies:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install @aws-sdk/client-dynamodb @aws-sdk/client-cognito-identity-provider @aws-sdk/client-secrets-manager @aws-sdk/util-dynamodb @opensearch-project/opensearch
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 🏁 Quick Start
|
|
50
|
+
|
|
51
|
+
### 1. Basic Controller Setup
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { BaseController, BaseService, EntityConfig } from 'aws-service-stack';
|
|
55
|
+
|
|
56
|
+
class UserController extends BaseController<UserService> {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(new UserService());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Lambda handler
|
|
63
|
+
export const handler = async (event: APIGatewayProxyEvent) => {
|
|
64
|
+
const controller = new UserController();
|
|
65
|
+
return await controller.handleRequest(event);
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Entity Configuration
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { EntityConfigImpl, DynamoIndexMap } from 'aws-service-stack';
|
|
73
|
+
|
|
74
|
+
const userConfig = new EntityConfigImpl('User')
|
|
75
|
+
.setDynamoDB('User-table', new DynamoIndexMap())
|
|
76
|
+
.setOpenSearch('user-search', 'user-index')
|
|
77
|
+
.setPermissions([
|
|
78
|
+
{ method: 'GET', path: '/users', allowed: ['PUBLIC'] },
|
|
79
|
+
{ method: 'POST', path: '/users', allowed: ['ADMIN'] }
|
|
80
|
+
])
|
|
81
|
+
.setValidators(createUserSchema, updateUserSchema)
|
|
82
|
+
.setAdminGroup('admin');
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 3. Repository Operations
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { BaseRepoDBImpl } from 'aws-service-stack';
|
|
89
|
+
|
|
90
|
+
class UserRepository extends BaseRepoDBImpl<User> {
|
|
91
|
+
// Inherits all CRUD operations
|
|
92
|
+
// save(), update(), delete(), findById(), findAll()
|
|
93
|
+
// Advanced: batch operations, transactions, filtering
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Usage
|
|
97
|
+
const userRepo = new UserRepository();
|
|
98
|
+
const user = await userRepo.save({ name: 'John Doe', email: 'john@example.com' });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 4. Search Integration
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { BaseRepoESImpl } from 'aws-service-stack';
|
|
105
|
+
|
|
106
|
+
class UserSearchRepository extends BaseRepoESImpl<User> {
|
|
107
|
+
async searchUsers(query: string, filters: FilterAndSort) {
|
|
108
|
+
return await this.search({
|
|
109
|
+
query: {
|
|
110
|
+
multi_match: {
|
|
111
|
+
query,
|
|
112
|
+
fields: ['name^2', 'email', 'description']
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
...filters
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 🛠️ Built-in API Endpoints
|
|
122
|
+
|
|
123
|
+
Your AWS Service Stack automatically provides these RESTful endpoints for any entity:
|
|
124
|
+
|
|
125
|
+
### **Standard CRUD Operations**
|
|
126
|
+
```
|
|
127
|
+
POST /products # Insert new product (create)
|
|
128
|
+
GET /products/{id} # Get single product by ID
|
|
129
|
+
GET /products # List products via DynamoDB Query (by categoryId, supplierId, status, …)
|
|
130
|
+
GET /products/search # Search products via OpenSearch (full-text, sort, pagination)
|
|
131
|
+
GET /products/scan # Scan all products (Admin only, expensive in DynamoDB)
|
|
132
|
+
PUT /products/{id} # Update full product (replace all fields)
|
|
133
|
+
PATCH /products/{id} # Update partial product (only specific fields)
|
|
134
|
+
DELETE /products/{id} # Delete product by ID
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### **Advanced Features**
|
|
138
|
+
- **🔍 Smart Filtering** - DynamoDB queries with complex conditions
|
|
139
|
+
- **🔎 Full-Text Search** - OpenSearch integration with faceted search
|
|
140
|
+
- **📄 Pagination** - Built-in pagination with `lastKey` support
|
|
141
|
+
- **🔐 Authorization** - Role-based access control per endpoint
|
|
142
|
+
- **✅ Validation** - Automatic request/response validation
|
|
143
|
+
- **📊 Analytics** - Built-in logging and monitoring
|
|
144
|
+
|
|
145
|
+
## 🏗️ Architecture
|
|
146
|
+
|
|
147
|
+
### **Layered Architecture**
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────┐
|
|
150
|
+
│ Controllers │ ← API Gateway, Lambda Events
|
|
151
|
+
├─────────────────┤
|
|
152
|
+
│ Services │ ← Business Logic
|
|
153
|
+
├─────────────────┤
|
|
154
|
+
│ Repositories │ ← Data Access (DynamoDB, OpenSearch)
|
|
155
|
+
├─────────────────┤
|
|
156
|
+
│ Providers │ ← AWS SDK Clients
|
|
157
|
+
└─────────────────┘
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### **Event Handling**
|
|
161
|
+
- **API Gateway** - RESTful API endpoints
|
|
162
|
+
- **SQS** - Message queue processing
|
|
163
|
+
- **DynamoDB Streams** - Real-time data processing
|
|
164
|
+
- **WebSocket** - Real-time communication
|
|
165
|
+
- **Scheduled Events** - Cron-based tasks
|
|
166
|
+
|
|
167
|
+
## 🔧 Configuration
|
|
168
|
+
|
|
169
|
+
### Environment Variables
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# AWS Configuration
|
|
173
|
+
AWS_REGION=us-east-1
|
|
174
|
+
IAM_ACCESS_KEY=your-access-key
|
|
175
|
+
IAM_SECRET_ACCESS_KEY=your-secret-key
|
|
176
|
+
|
|
177
|
+
# OpenSearch
|
|
178
|
+
OPENSEARCH_ENDPOINT=https://your-domain.us-east-1.es.amazonaws.com
|
|
179
|
+
|
|
180
|
+
# API Gateway
|
|
181
|
+
WS_ENDPOINT=wss://your-websocket-api.execute-api.us-east-1.amazonaws.com/prod
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### TypeScript Configuration
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// tsconfig.json
|
|
188
|
+
{
|
|
189
|
+
"compilerOptions": {
|
|
190
|
+
"baseUrl": "./",
|
|
191
|
+
"paths": {
|
|
192
|
+
"@chinggis/core": ["node_modules/aws-service-stack/dist/index.d.ts"],
|
|
193
|
+
"@chinggis/types": ["node_modules/aws-service-stack/dist/model/index.d.ts"]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## 📚 API Reference
|
|
200
|
+
|
|
201
|
+
### **BaseController**
|
|
202
|
+
- `handleRequest(event)` - Main Lambda handler
|
|
203
|
+
- `handleSQS(event)` - SQS message processing
|
|
204
|
+
- `handleWebSocket(event)` - WebSocket connection handling
|
|
205
|
+
|
|
206
|
+
### **BaseService**
|
|
207
|
+
- `save(entity, ownerId)` - Create/update entity
|
|
208
|
+
- `findById(id, userId)` - Find entity by ID
|
|
209
|
+
- `findAll(filter, userId)` - List entities with filtering
|
|
210
|
+
- `delete(id, userId)` - Delete entity
|
|
211
|
+
|
|
212
|
+
### **Repository Interfaces**
|
|
213
|
+
- `CoreRepo<T>` - Generic CRUD operations
|
|
214
|
+
- `BaseRepoDB<T>` - DynamoDB-specific operations
|
|
215
|
+
- `BaseRepoES<T>` - OpenSearch-specific operations
|
|
216
|
+
|
|
217
|
+
## 🧪 Testing
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Run tests
|
|
221
|
+
npm test
|
|
222
|
+
|
|
223
|
+
# Run tests with coverage
|
|
224
|
+
npm run test:coverage
|
|
225
|
+
|
|
226
|
+
# Run specific test file
|
|
227
|
+
npm test -- user.test.ts
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 🚀 Deployment
|
|
231
|
+
|
|
232
|
+
### Serverless Framework
|
|
233
|
+
|
|
234
|
+
```yaml
|
|
235
|
+
# serverless.yml
|
|
236
|
+
service: my-aws-service
|
|
237
|
+
provider:
|
|
238
|
+
name: aws
|
|
239
|
+
runtime: nodejs18.x
|
|
240
|
+
region: us-east-1
|
|
241
|
+
|
|
242
|
+
functions:
|
|
243
|
+
api:
|
|
244
|
+
handler: dist/handler.handler
|
|
245
|
+
events:
|
|
246
|
+
- http:
|
|
247
|
+
path: /{proxy+}
|
|
248
|
+
method: ANY
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### AWS CDK
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { Function, Runtime } from 'aws-cdk-lib/aws-lambda';
|
|
255
|
+
|
|
256
|
+
new Function(this, 'MyFunction', {
|
|
257
|
+
runtime: Runtime.NODEJS_18_X,
|
|
258
|
+
handler: 'dist/handler.handler',
|
|
259
|
+
code: Code.fromAsset('dist')
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🤝 Contributing
|
|
264
|
+
|
|
265
|
+
1. Fork the repository
|
|
266
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
267
|
+
3. Commit your changes (`git commit -m 'feat(core): add amazing feature'`)
|
|
268
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
269
|
+
5. Open a Pull Request
|
|
270
|
+
|
|
271
|
+
### Development Setup
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Clone the repository
|
|
275
|
+
git clone https://github.com/chinggis-systems/aws-service-stack.git
|
|
276
|
+
|
|
277
|
+
# Install dependencies
|
|
278
|
+
npm install
|
|
279
|
+
|
|
280
|
+
# Run tests
|
|
281
|
+
npm test
|
|
282
|
+
|
|
283
|
+
# Build the project
|
|
284
|
+
npm run build
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## 📄 License
|
|
288
|
+
|
|
289
|
+
This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
|
|
290
|
+
|
|
291
|
+
## 🏢 About Chinggis Systems
|
|
292
|
+
|
|
293
|
+
Built by [Chinggis Systems](https://chinggis.systems) - Enterprise software solutions for modern cloud architectures.
|
|
294
|
+
|
|
295
|
+
## 📞 Support
|
|
296
|
+
|
|
297
|
+
- 💬 Discord: [Join our community](https://discord.gg/DAPNvk4F)
|
|
298
|
+
- 📧 Email: support@chinggis.systems
|
|
299
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/chinggis-systems/aws-service-stack/issues)
|
|
300
|
+
- 📖 Documentation: [Wiki](https://github.com/chinggis-systems/aws-service-stack/wiki)
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
**Made with ❤️ for the AWS serverless community**
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handler = void 0;
|
|
13
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
14
|
+
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
15
|
+
// Initialize DynamoDB client
|
|
16
|
+
const client = new client_dynamodb_1.DynamoDBClient({ region: "ap-southeast-1" });
|
|
17
|
+
const docClient = lib_dynamodb_1.DynamoDBDocumentClient.from(client);
|
|
18
|
+
const TABLE_NAME = "Profile-s4ph7chlarhupiqw7ml47pmehq-dev";
|
|
19
|
+
const handler = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const httpMethod = event.httpMethod;
|
|
22
|
+
const path = event.path;
|
|
23
|
+
const pathParameters = event.pathParameters || {};
|
|
24
|
+
const queryStringParameters = event.queryStringParameters || {};
|
|
25
|
+
const body = event.body ? JSON.parse(event.body) : {};
|
|
26
|
+
console.log(`Processing ${httpMethod} ${path}`);
|
|
27
|
+
// Simple mock response for testing
|
|
28
|
+
const mockProfile = {
|
|
29
|
+
id: "test-profile-1",
|
|
30
|
+
email: "test@example.com",
|
|
31
|
+
firstName: "Test",
|
|
32
|
+
lastName: "User",
|
|
33
|
+
availablePoint: 100,
|
|
34
|
+
note: "Test profile",
|
|
35
|
+
createdAt: new Date().toISOString(),
|
|
36
|
+
updatedAt: new Date().toISOString()
|
|
37
|
+
};
|
|
38
|
+
switch (httpMethod) {
|
|
39
|
+
case "GET":
|
|
40
|
+
if (pathParameters.id) {
|
|
41
|
+
// GET /profiles/{id}
|
|
42
|
+
const getCommand = new lib_dynamodb_1.GetCommand({
|
|
43
|
+
TableName: TABLE_NAME,
|
|
44
|
+
Key: { id: pathParameters.id }
|
|
45
|
+
});
|
|
46
|
+
const result = yield docClient.send(getCommand);
|
|
47
|
+
if (!result.Item) {
|
|
48
|
+
return {
|
|
49
|
+
statusCode: 404,
|
|
50
|
+
headers: {
|
|
51
|
+
"Content-Type": "application/json",
|
|
52
|
+
"Access-Control-Allow-Origin": "*",
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify({ error: "Profile not found" }),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
statusCode: 200,
|
|
59
|
+
headers: {
|
|
60
|
+
"Content-Type": "application/json",
|
|
61
|
+
"Access-Control-Allow-Origin": "*",
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify(result.Item),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
else if (path.includes("/search")) {
|
|
67
|
+
// GET /profiles/search
|
|
68
|
+
const searchParams = {
|
|
69
|
+
phone: queryStringParameters.phone,
|
|
70
|
+
email: queryStringParameters.email,
|
|
71
|
+
cardNumber: queryStringParameters.cardNumber,
|
|
72
|
+
};
|
|
73
|
+
// Remove undefined values
|
|
74
|
+
const cleanParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value !== undefined));
|
|
75
|
+
if (Object.keys(cleanParams).length === 0) {
|
|
76
|
+
// No search parameters, return all profiles
|
|
77
|
+
const scanCommand = new lib_dynamodb_1.ScanCommand({
|
|
78
|
+
TableName: TABLE_NAME,
|
|
79
|
+
Limit: 100
|
|
80
|
+
});
|
|
81
|
+
const result = yield docClient.send(scanCommand);
|
|
82
|
+
return {
|
|
83
|
+
statusCode: 200,
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
"Access-Control-Allow-Origin": "*",
|
|
87
|
+
},
|
|
88
|
+
body: JSON.stringify(result.Items || []),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// Use scan with filter expressions
|
|
92
|
+
const scanCommand = new lib_dynamodb_1.ScanCommand({
|
|
93
|
+
TableName: TABLE_NAME,
|
|
94
|
+
FilterExpression: Object.keys(cleanParams).map(key => `${key} = :${key}`).join(' AND '),
|
|
95
|
+
ExpressionAttributeValues: Object.fromEntries(Object.entries(cleanParams).map(([key, value]) => [`:${key}`, value])),
|
|
96
|
+
Limit: 100
|
|
97
|
+
});
|
|
98
|
+
const result = yield docClient.send(scanCommand);
|
|
99
|
+
return {
|
|
100
|
+
statusCode: 200,
|
|
101
|
+
headers: {
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
"Access-Control-Allow-Origin": "*",
|
|
104
|
+
},
|
|
105
|
+
body: JSON.stringify(result.Items || []),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
else if (path.includes("/scan")) {
|
|
109
|
+
// GET /profiles/scan
|
|
110
|
+
const scanCommand = new lib_dynamodb_1.ScanCommand({
|
|
111
|
+
TableName: TABLE_NAME,
|
|
112
|
+
Limit: 100
|
|
113
|
+
});
|
|
114
|
+
const result = yield docClient.send(scanCommand);
|
|
115
|
+
return {
|
|
116
|
+
statusCode: 200,
|
|
117
|
+
headers: {
|
|
118
|
+
"Content-Type": "application/json",
|
|
119
|
+
"Access-Control-Allow-Origin": "*",
|
|
120
|
+
},
|
|
121
|
+
body: JSON.stringify(result.Items || []),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// GET /profiles
|
|
126
|
+
const scanCommand = new lib_dynamodb_1.ScanCommand({
|
|
127
|
+
TableName: TABLE_NAME,
|
|
128
|
+
Limit: 100
|
|
129
|
+
});
|
|
130
|
+
const result = yield docClient.send(scanCommand);
|
|
131
|
+
return {
|
|
132
|
+
statusCode: 200,
|
|
133
|
+
headers: {
|
|
134
|
+
"Content-Type": "application/json",
|
|
135
|
+
"Access-Control-Allow-Origin": "*",
|
|
136
|
+
},
|
|
137
|
+
body: JSON.stringify(result.Items || []),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
case "POST":
|
|
141
|
+
// POST /profiles
|
|
142
|
+
const newProfile = Object.assign(Object.assign({ id: body.id || `profile-${Date.now()}` }, body), { createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() });
|
|
143
|
+
const putCommand = new lib_dynamodb_1.PutCommand({
|
|
144
|
+
TableName: TABLE_NAME,
|
|
145
|
+
Item: newProfile
|
|
146
|
+
});
|
|
147
|
+
yield docClient.send(putCommand);
|
|
148
|
+
return {
|
|
149
|
+
statusCode: 201,
|
|
150
|
+
headers: {
|
|
151
|
+
"Content-Type": "application/json",
|
|
152
|
+
"Access-Control-Allow-Origin": "*",
|
|
153
|
+
},
|
|
154
|
+
body: JSON.stringify(newProfile),
|
|
155
|
+
};
|
|
156
|
+
case "PUT":
|
|
157
|
+
// PUT /profiles/{id}
|
|
158
|
+
if (!pathParameters.id) {
|
|
159
|
+
return {
|
|
160
|
+
statusCode: 400,
|
|
161
|
+
headers: {
|
|
162
|
+
"Content-Type": "application/json",
|
|
163
|
+
"Access-Control-Allow-Origin": "*",
|
|
164
|
+
},
|
|
165
|
+
body: JSON.stringify({ error: "Profile ID is required" }),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
// First check if profile exists
|
|
169
|
+
const getExistingCommand = new lib_dynamodb_1.GetCommand({
|
|
170
|
+
TableName: TABLE_NAME,
|
|
171
|
+
Key: { id: pathParameters.id }
|
|
172
|
+
});
|
|
173
|
+
const existingResult = yield docClient.send(getExistingCommand);
|
|
174
|
+
if (!existingResult.Item) {
|
|
175
|
+
return {
|
|
176
|
+
statusCode: 404,
|
|
177
|
+
headers: {
|
|
178
|
+
"Content-Type": "application/json",
|
|
179
|
+
"Access-Control-Allow-Origin": "*",
|
|
180
|
+
},
|
|
181
|
+
body: JSON.stringify({ error: "Profile not found" }),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const updatedProfile = Object.assign(Object.assign(Object.assign({}, existingResult.Item), body), { id: pathParameters.id, updatedAt: new Date().toISOString() });
|
|
185
|
+
const updateCommand = new lib_dynamodb_1.PutCommand({
|
|
186
|
+
TableName: TABLE_NAME,
|
|
187
|
+
Item: updatedProfile
|
|
188
|
+
});
|
|
189
|
+
yield docClient.send(updateCommand);
|
|
190
|
+
return {
|
|
191
|
+
statusCode: 200,
|
|
192
|
+
headers: {
|
|
193
|
+
"Content-Type": "application/json",
|
|
194
|
+
"Access-Control-Allow-Origin": "*",
|
|
195
|
+
},
|
|
196
|
+
body: JSON.stringify(updatedProfile),
|
|
197
|
+
};
|
|
198
|
+
case "PATCH":
|
|
199
|
+
// PATCH /profiles/{id}
|
|
200
|
+
if (!pathParameters.id) {
|
|
201
|
+
return {
|
|
202
|
+
statusCode: 400,
|
|
203
|
+
headers: {
|
|
204
|
+
"Content-Type": "application/json",
|
|
205
|
+
"Access-Control-Allow-Origin": "*",
|
|
206
|
+
},
|
|
207
|
+
body: JSON.stringify({ error: "Profile ID is required" }),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
// First check if profile exists
|
|
211
|
+
const getPatchCommand = new lib_dynamodb_1.GetCommand({
|
|
212
|
+
TableName: TABLE_NAME,
|
|
213
|
+
Key: { id: pathParameters.id }
|
|
214
|
+
});
|
|
215
|
+
const patchResult = yield docClient.send(getPatchCommand);
|
|
216
|
+
if (!patchResult.Item) {
|
|
217
|
+
return {
|
|
218
|
+
statusCode: 404,
|
|
219
|
+
headers: {
|
|
220
|
+
"Content-Type": "application/json",
|
|
221
|
+
"Access-Control-Allow-Origin": "*",
|
|
222
|
+
},
|
|
223
|
+
body: JSON.stringify({ error: "Profile not found" }),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const patchedProfile = Object.assign(Object.assign(Object.assign({}, patchResult.Item), body), { id: pathParameters.id, updatedAt: new Date().toISOString() });
|
|
227
|
+
const patchUpdateCommand = new lib_dynamodb_1.PutCommand({
|
|
228
|
+
TableName: TABLE_NAME,
|
|
229
|
+
Item: patchedProfile
|
|
230
|
+
});
|
|
231
|
+
yield docClient.send(patchUpdateCommand);
|
|
232
|
+
return {
|
|
233
|
+
statusCode: 200,
|
|
234
|
+
headers: {
|
|
235
|
+
"Content-Type": "application/json",
|
|
236
|
+
"Access-Control-Allow-Origin": "*",
|
|
237
|
+
},
|
|
238
|
+
body: JSON.stringify(patchedProfile),
|
|
239
|
+
};
|
|
240
|
+
case "DELETE":
|
|
241
|
+
// DELETE /profiles/{id}
|
|
242
|
+
if (!pathParameters.id) {
|
|
243
|
+
return {
|
|
244
|
+
statusCode: 400,
|
|
245
|
+
headers: {
|
|
246
|
+
"Content-Type": "application/json",
|
|
247
|
+
"Access-Control-Allow-Origin": "*",
|
|
248
|
+
},
|
|
249
|
+
body: JSON.stringify({ error: "Profile ID is required" }),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const deleteCommand = new lib_dynamodb_1.DeleteCommand({
|
|
253
|
+
TableName: TABLE_NAME,
|
|
254
|
+
Key: { id: pathParameters.id }
|
|
255
|
+
});
|
|
256
|
+
yield docClient.send(deleteCommand);
|
|
257
|
+
return {
|
|
258
|
+
statusCode: 204,
|
|
259
|
+
headers: {
|
|
260
|
+
"Access-Control-Allow-Origin": "*",
|
|
261
|
+
},
|
|
262
|
+
body: "",
|
|
263
|
+
};
|
|
264
|
+
default:
|
|
265
|
+
return {
|
|
266
|
+
statusCode: 405,
|
|
267
|
+
headers: {
|
|
268
|
+
"Content-Type": "application/json",
|
|
269
|
+
"Access-Control-Allow-Origin": "*",
|
|
270
|
+
},
|
|
271
|
+
body: JSON.stringify({ error: "Method not allowed" }),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
console.error("Error processing request:", error);
|
|
277
|
+
return {
|
|
278
|
+
statusCode: 500,
|
|
279
|
+
headers: {
|
|
280
|
+
"Content-Type": "application/json",
|
|
281
|
+
"Access-Control-Allow-Origin": "*",
|
|
282
|
+
},
|
|
283
|
+
body: JSON.stringify({ error: "Internal server error" }),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
exports.handler = handler;
|
|
288
|
+
//# sourceMappingURL=e-order-crud-simple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e-order-crud-simple.js","sourceRoot":"","sources":["../../../../src/_examples/controller/e-order/e-order-crud-simple.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8DAA0D;AAC1D,wDAAmH;AAEnH,6BAA6B;AAC7B,MAAM,MAAM,GAAG,IAAI,gCAAc,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAChE,MAAM,SAAS,GAAG,qCAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAErD,MAAM,OAAO,GAAG,CAAO,KAA2B,EAAkC,EAAE;IAC3F,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC;QAClD,MAAM,qBAAqB,GAAG,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC;QAChE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEtD,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,IAAI,IAAI,EAAE,CAAC,CAAC;QAEhD,mCAAmC;QACnC,MAAM,WAAW,GAAG;YAClB,EAAE,EAAE,gBAAgB;YACpB,KAAK,EAAE,kBAAkB;YACzB,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,MAAM;YAChB,cAAc,EAAE,GAAG;YACnB,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,IAAI,I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