@hdriel/aws-utils 1.3.4 → 1.3.6

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 CHANGED
@@ -1,3 +1,82 @@
1
+ # AWS UTILS: S3, LAMBDA SNS, IAM
2
+
3
+ ## Quick Start
4
+
5
+ First load this file somewhere on starting server
6
+ ```typescript
7
+ // aws-utils-config.ts
8
+ import env from './dotenv.ts';
9
+ import { AWSConfigSharingUtil } from '@hdriel/aws-utils';
10
+
11
+ AWSConfigSharingUtil.setConfig({
12
+ accessKeyId: env?.AWS_ACCESS_KEY_ID,
13
+ secretAccessKey: env?.AWS_SECRET_ACCESS_KEY,
14
+ region: env?.AWS_REGION,
15
+ endpoint: env?.AWS_ENDPOINT,
16
+ });
17
+
18
+ // console.log('AWSConfigSharingUtil configuration');
19
+ // console.table(AWSConfigSharingUtil.getConfig());
20
+
21
+ ```
22
+ on your server files:
23
+ ```typescript
24
+ import './aws-utils-config';
25
+ ...
26
+ ```
27
+
28
+ then write your code...
29
+
30
+ # Lambda Utility usage
31
+
32
+ create your lambda by calling to LambdaUtil with generic type param and serviceFunctionName then usage any place your project
33
+
34
+ ```typescript
35
+ export const lambdaUtilTelegram = new LambdaUtil<TELEGRAM_REQUEST_PARAMS>({
36
+ serviceFunctionName: 'serverless-telegram-dev-directInvokeSendTextNTF',
37
+ logger,
38
+ });
39
+
40
+ ...
41
+
42
+
43
+ await lambdaUtilTelegram
44
+ .triggerLambdaEvent({
45
+ chatId: userData.telegramId,
46
+ body: `Just Like That! - Login code:\n${code}`
47
+ }).catch(console.error)
48
+
49
+ ```
50
+
51
+ lambda functionality:
52
+ ```typescript
53
+ lambdaUtilInstance.runLambdaInDryRunMode(payload?: T): Promise<LambdaPayloadResponse>;
54
+ lambdaUtilInstance.triggerLambdaEvent(payload?: T): Promise<LambdaPayloadResponse>;
55
+ lambdaUtilInstance.runAndGetLambdaResponse(payload?: T): Promise<LambdaPayloadResponse>;
56
+ ```
57
+
58
+ # SNS Utility usage
59
+
60
+ create your SNS by calling to SnsUtil with generic type param and topicArn then usage any place your project
61
+
62
+ ```typescript
63
+ export const snsUserCreatedTopic = new SnsUtil<REQUEST_PARAMS>({
64
+ topicArn: 'user-created',
65
+ logger,
66
+ });
67
+
68
+ ...
69
+
70
+
71
+ await snsUserCreatedTopic
72
+ .publishMessage({
73
+ userId: 'abc',
74
+ username: `Hadriel Benjo`
75
+ }).catch(console.error)
76
+
77
+ ```
78
+
79
+
1
80
  # S3 Utility Package
2
81
 
3
82
  A powerful, type-safe wrapper around AWS S3 SDK v3 that simplifies S3 operations with advanced features like streaming, file uploads, directory management, and LocalStack support.
@@ -18,7 +97,7 @@ A powerful, type-safe wrapper around AWS S3 SDK v3 that simplifies S3 operations
18
97
 
19
98
  # FULL DEMO PROJECT EXAMPLE:
20
99
  please see this project code before using: [aws-utils-demo github link!](https://github.com/hdriel/aws-utils-demo)
21
- ![Main Screen - Preview](https://cdn.jsdelivr.net/gh/hdriel/aws-utils-demo/readme-assets/demo-bucket-image-preview.webp)
100
+ [![Watch the video](https://cdn.jsdelivr.net/gh/hdriel/aws-utils-demo/readme-assets/demo-bucket-image-preview.webp)](https://youtu.be/5DRV6ACq9jU)
22
101
 
23
102
 
24
103
  ## Installation
@@ -27,31 +106,7 @@ please see this project code before using: [aws-utils-demo github link!](https:/
27
106
  npm install @hdriel/aws-utils
28
107
  ```
29
108
 
30
- ## Quick Start
31
-
32
- First load this file somewhere on starting server
33
- ```typescript
34
- // aws-utils-config.ts
35
- import env from './dotenv.ts';
36
- import { AWSConfigSharingUtil } from '@hdriel/aws-utils';
37
-
38
- AWSConfigSharingUtil.setConfig({
39
- accessKeyId: env?.AWS_ACCESS_KEY_ID,
40
- secretAccessKey: env?.AWS_SECRET_ACCESS_KEY,
41
- region: env?.AWS_REGION,
42
- endpoint: env?.AWS_ENDPOINT,
43
- });
44
-
45
- // console.log('AWSConfigSharingUtil configuration');
46
- // console.table(AWSConfigSharingUtil.getConfig());
47
- ```
48
- on your server files:
49
- ```typescript
50
- import './aws-utils-config';
51
- ...
52
- ```
53
109
 
54
- then write your code...
55
110
 
56
111
  for example:
57
112
 
@@ -645,6 +700,13 @@ services:
645
700
  - app-network
646
701
  ```
647
702
 
703
+ # FULL LOCALSTACK DEMO:
704
+ please see this project code before using: [aws-utils-demo github link!](https://github.com/hdriel/aws-utils-demo)
705
+
706
+ Click the image to watch localstack video
707
+ [![Watch the video](https://cdn.jsdelivr.net/gh/hdriel/aws-utils-demo/readme-assets/localstack-login.webp)](https://youtu.be/5DRV6ACq9jU)
708
+
709
+
648
710
  ## 🔧 Advanced Usage
649
711
 
650
712
  ### Dynamic Bucket Switching
@@ -681,7 +743,7 @@ The utility includes optimized HTTP/HTTPS agents:
681
743
  ## 📋 Complete Express.js Example
682
744
  # FULL DEMO PROJECT EXAMPLE:
683
745
  please see this project code before using: [aws-utils-demo github link!](https://github.com/hdriel/aws-utils-demo)
684
- ![Main Screen - Preview](https://cdn.jsdelivr.net/gh/hdriel/aws-utils-demo/readme-assets/demo-bucket-image-preview.webp)
746
+ [![Watch the video](https://cdn.jsdelivr.net/gh/hdriel/aws-utils-demo/readme-assets/demo-bucket-image-preview.webp)](https://youtu.be/5DRV6ACq9jU)
685
747
 
686
748
 
687
749
  ## 📝 TypeScript Support
package/dist/index.d.cts CHANGED
@@ -70,7 +70,7 @@ declare class LambdaEvents<T> extends LambdaBase {
70
70
  invocationType?: InvocationType;
71
71
  }): Promise<LambdaPayloadResponse>;
72
72
  runLambdaInDryRunMode(payload?: T): Promise<LambdaPayloadResponse>;
73
- triggerLambdaEvent<T>(payload?: T): Promise<LambdaPayloadResponse>;
73
+ triggerLambdaEvent(payload?: T): Promise<LambdaPayloadResponse>;
74
74
  runAndGetLambdaResponse(payload?: T): Promise<LambdaPayloadResponse>;
75
75
  }
76
76
 
package/dist/index.d.ts CHANGED
@@ -70,7 +70,7 @@ declare class LambdaEvents<T> extends LambdaBase {
70
70
  invocationType?: InvocationType;
71
71
  }): Promise<LambdaPayloadResponse>;
72
72
  runLambdaInDryRunMode(payload?: T): Promise<LambdaPayloadResponse>;
73
- triggerLambdaEvent<T>(payload?: T): Promise<LambdaPayloadResponse>;
73
+ triggerLambdaEvent(payload?: T): Promise<LambdaPayloadResponse>;
74
74
  runAndGetLambdaResponse(payload?: T): Promise<LambdaPayloadResponse>;
75
75
  }
76
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hdriel/aws-utils",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Simplified AWS SDK (v3) utilities for S3 (upload, download, streaming) with TypeScript support",
5
5
  "author": "Hadriel Benjo (https://github.com/hdriel)",
6
6
  "type": "module",