aws-service-stack 0.18.325 → 0.18.326
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 +57 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ npm install aws-service-stack
|
|
|
49
49
|
This package requires the following AWS SDK v3 packages as peer dependencies:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
npm install
|
|
52
|
+
npm install
|
|
53
53
|
@aws-sdk/client-dynamodb
|
|
54
54
|
@aws-sdk/client-cognito-identity-provider
|
|
55
55
|
@aws-sdk/client-secrets-manager
|
|
@@ -84,7 +84,6 @@ export class ProductControllerApi extends ControllerApi<Product, ProductService>
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
87
|
```
|
|
89
88
|
|
|
90
89
|
### 2. Entity Configuration
|
|
@@ -138,7 +137,6 @@ export class ProductConfig extends EntityConfigImpl {
|
|
|
138
137
|
|
|
139
138
|
// Export default Product configuration
|
|
140
139
|
export const CONFIG_PRODUCT = new ProductConfig();
|
|
141
|
-
|
|
142
140
|
```
|
|
143
141
|
|
|
144
142
|
### 3. Repository Definition - DynamoDB
|
|
@@ -151,8 +149,7 @@ import { ProductRepoDB } from "./product-repo-db.interface";
|
|
|
151
149
|
import "./product-repo-db";
|
|
152
150
|
|
|
153
151
|
@Service("ProductRepoDB")
|
|
154
|
-
export class ProductRepoDBImpl extends BaseRepoDBImpl<Product> implements ProductRepoDB {
|
|
155
|
-
}
|
|
152
|
+
export class ProductRepoDBImpl extends BaseRepoDBImpl<Product> implements ProductRepoDB {}
|
|
156
153
|
|
|
157
154
|
/** additional custom repo methode for dynamodb integration**/
|
|
158
155
|
//...
|
|
@@ -168,8 +165,7 @@ import { ProductRepoES } from "./product-repo-es.interface";
|
|
|
168
165
|
import "./product-repo-es";
|
|
169
166
|
|
|
170
167
|
@Service("ProductRepoES")
|
|
171
|
-
export class ProductRepoESImpl extends BaseRepoESImpl<Product> implements ProductRepoES {
|
|
172
|
-
}
|
|
168
|
+
export class ProductRepoESImpl extends BaseRepoESImpl<Product> implements ProductRepoES {}
|
|
173
169
|
|
|
174
170
|
/** additional custom repo methode for openSearch integration**/
|
|
175
171
|
//...
|
|
@@ -189,14 +185,16 @@ import { CrudServiceImpl } from "@chinggis/core";
|
|
|
189
185
|
import { Product } from "../model-shared/example.model";
|
|
190
186
|
|
|
191
187
|
@Service("ProfileService")
|
|
192
|
-
export class ProductServiceImpl
|
|
188
|
+
export class ProductServiceImpl
|
|
189
|
+
extends CrudServiceImpl<Product, ProductRepoDB, ProductRepoES>
|
|
190
|
+
implements ProductService
|
|
191
|
+
{
|
|
193
192
|
constructor() {
|
|
194
193
|
super(Container.get("ProductRepoDB"), Container.get("ProductRepoES"));
|
|
195
194
|
}
|
|
196
195
|
|
|
197
196
|
/** Custom service methode **/
|
|
198
197
|
//...
|
|
199
|
-
|
|
200
198
|
}
|
|
201
199
|
```
|
|
202
200
|
|
|
@@ -211,6 +209,7 @@ POST /products # Insert new product (create)
|
|
|
211
209
|
GET /products/{id} # Get single product by ID
|
|
212
210
|
GET /products # List products via DynamoDB Query (by categoryId, ProductId, status, …)
|
|
213
211
|
GET /products/search # Search products via OpenSearch (full-text, sort, pagination)
|
|
212
|
+
GET /products/search/query # Search Query products via OpenSearch (aggregations, multi-filters, full-text, sort, pagination)
|
|
214
213
|
GET /products/scan # Scan all products (Admin only, expensive in DynamoDB)
|
|
215
214
|
PUT /products/{id} # Update full product (replace all fields)
|
|
216
215
|
PATCH /products/{id} # Update partial product (only specific fields)
|
|
@@ -233,10 +232,50 @@ dynamoDB: .../products/?category=Toys&color=red&age_from=5&age_to=8&size=50&la
|
|
|
233
232
|
- **[customFieldName]**=[matchValue]
|
|
234
233
|
- **size**=20
|
|
235
234
|
- **page**=3 or **lastKey**=...
|
|
236
|
-
- **[dateOrNumberFieldName]_from**=[Value]
|
|
237
|
-
- **[dateOrNumberFieldName]_to**=[Value]
|
|
238
|
-
- **
|
|
239
|
-
- **
|
|
235
|
+
- **[dateOrNumberFieldName]\_from**=[Value]
|
|
236
|
+
- **[dateOrNumberFieldName]\_to**=[Value]
|
|
237
|
+
- **begin\_[dateOrNumberFieldName]**=[Value]
|
|
238
|
+
- **end\_[dateOrNumberFieldName]**=[Value]
|
|
239
|
+
|
|
240
|
+
### **OpenSearch V2 List Operation - URL Filter**
|
|
241
|
+
|
|
242
|
+
multi-filter, aggregations, search keyword, multi-sort
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
openSearch v2: .../products/search/query?category__eq=Toys&color__in=red,yellow&age__gte=5&age__lte=8&page=5&size=50&agg__terms=status&agg__terms__sub=customerId
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
- **field\_\_in**=red,yellow
|
|
249
|
+
- **field\_\_eq**=Toys
|
|
250
|
+
- **field\_\_gte**=5
|
|
251
|
+
- **field\_\_lte**=8
|
|
252
|
+
- **field\_\_ne**=Book
|
|
253
|
+
- **field\_\_exists**=true
|
|
254
|
+
- **field\_\_exists**=false
|
|
255
|
+
- **field\_\_regex**=^Foo.\*
|
|
256
|
+
|
|
257
|
+
- **agg\_\_terms**=status
|
|
258
|
+
- **agg\_\_terms\_\_sub**=customerId
|
|
259
|
+
- **agg\_\_sum**=price
|
|
260
|
+
- **agg\_\_avg**=price
|
|
261
|
+
- **agg\_\_min**=price
|
|
262
|
+
- **agg\_\_max**=price
|
|
263
|
+
|
|
264
|
+
- **search**=marvel
|
|
265
|
+
- **searchFields**=name,manufacture,description
|
|
266
|
+
- **searchOperator**=or
|
|
267
|
+
- **searchOperator**=and
|
|
268
|
+
|
|
269
|
+
- **sort**=desc,asc
|
|
270
|
+
- **sortField**=price,category
|
|
271
|
+
|
|
272
|
+
- **color\_\_in**=red,yellow
|
|
273
|
+
- **category\_\_eq**=Toys
|
|
274
|
+
- **status\_\_exists**=true
|
|
275
|
+
- **age\_\_gte**=5
|
|
276
|
+
- **age\_\_lte**=8
|
|
277
|
+
- **size**=20
|
|
278
|
+
- **page**=3
|
|
240
279
|
|
|
241
280
|
### **Advanced Features**
|
|
242
281
|
|
|
@@ -372,12 +411,12 @@ functions:
|
|
|
372
411
|
### AWS CDK
|
|
373
412
|
|
|
374
413
|
```typescript
|
|
375
|
-
import { Function, Runtime } from
|
|
414
|
+
import { Function, Runtime } from "aws-cdk-lib/aws-lambda";
|
|
376
415
|
|
|
377
|
-
new Function(this,
|
|
416
|
+
new Function(this, "MyFunction", {
|
|
378
417
|
runtime: Runtime.NODEJS_18_X,
|
|
379
|
-
handler:
|
|
380
|
-
code: Code.fromAsset(
|
|
418
|
+
handler: "dist/handler.handler",
|
|
419
|
+
code: Code.fromAsset("dist"),
|
|
381
420
|
});
|
|
382
421
|
```
|
|
383
422
|
|
|
@@ -422,4 +461,4 @@ Built by [Chinggis Systems](https://chinggis.systems) - Enterprise software solu
|
|
|
422
461
|
|
|
423
462
|
---
|
|
424
463
|
|
|
425
|
-
**Made with ❤️ for the AWS community**
|
|
464
|
+
**Made with ❤️ for the AWS community**
|