@felloh-org/lambda-wrapper 1.11.192 → 1.11.194

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.
@@ -0,0 +1,87 @@
1
+ # user:registration Event Specification
2
+
3
+ This event is triggered when a new user registers in the system.
4
+
5
+ ## Event Structure
6
+
7
+ ```json
8
+ {
9
+ "source": "your-service-name",
10
+ "detail-type": "user:registration",
11
+ "detail": {
12
+ "user": {
13
+ "id": "usr_abc123xyz",
14
+ "email": "newuser@example.com",
15
+ "first_name": "John",
16
+ "last_name": "Doe"
17
+ },
18
+ "userBy": {
19
+ "id": "usr_admin123",
20
+ "email": "admin@example.com"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ## Field Reference
27
+
28
+ | Field | Type | Required | Description |
29
+ |-------|------|----------|-------------|
30
+ | `user` | object | **Yes** | The user object containing registration details |
31
+ | `user.id` | string | **Yes** | Unique identifier for the new user |
32
+ | `user.email` | string | **Yes** | Email address of the new user |
33
+ | `user.first_name` | string | No | First name of the user |
34
+ | `user.last_name` | string | No | Last name of the user |
35
+ | `userBy` | object | No | The user who initiated the registration (if applicable) |
36
+
37
+ ## Usage Example
38
+
39
+ ```javascript
40
+ import { UserRegistration } from '@felloh-org/lambda-wrapper';
41
+
42
+ const event = new UserRegistration();
43
+
44
+ // Set the user details
45
+ event.setDetailParam('user', {
46
+ id: 'usr_abc123xyz',
47
+ email: 'newuser@example.com',
48
+ first_name: 'John',
49
+ last_name: 'Doe'
50
+ });
51
+
52
+ // Optionally set who initiated the registration
53
+ event.setUserBy({
54
+ id: 'usr_admin123',
55
+ email: 'admin@example.com'
56
+ });
57
+
58
+ // Get the event payload for EventBridge
59
+ const payload = event.getBase();
60
+ ```
61
+
62
+ ## Sending the Event
63
+
64
+ To dispatch this event via EventBridge, use the `EventBridgeService`:
65
+
66
+ ```javascript
67
+ import { LambdaWrapper, DEFINITIONS, UserRegistration } from '@felloh-org/lambda-wrapper';
68
+
69
+ export const handler = LambdaWrapper(configuration, async (di, request) => {
70
+ const eventBridge = di.get(DEFINITIONS.EVENT_BRIDGE);
71
+
72
+ const event = new UserRegistration();
73
+ event.setDetailParam('user', {
74
+ id: 'usr_abc123xyz',
75
+ email: 'newuser@example.com',
76
+ first_name: 'John',
77
+ last_name: 'Doe'
78
+ });
79
+
80
+ await eventBridge.send(event);
81
+ });
82
+ ```
83
+
84
+ ## Notes
85
+
86
+ - The `user` object structure can be extended with additional fields as needed
87
+ - Use `setUserBy()` to track which user (e.g., admin) initiated the registration if applicable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felloh-org/lambda-wrapper",
3
- "version": "1.11.192",
3
+ "version": "1.11.194",
4
4
  "description": "Lambda wrapper for all Felloh Serverless Projects",
5
5
  "main": "dist/index.js",
6
6
  "engines": {