@fluentcommerce/fc-connect-sdk 0.1.51 → 0.1.53

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.
@@ -5,9 +5,10 @@
5
5
  ## Table of Contents
6
6
 
7
7
  1. [Success Response Structure](#success-response-structure)
8
- 2. [Error Response Structure](#error-response-structure)
9
- 3. [Live Examples](#live-examples)
10
- 4. [HTTP Status Codes](#http-status-codes)
8
+ 2. [Event Log Query (GET)](#event-log-query-get)
9
+ 3. [Error Response Structure](#error-response-structure)
10
+ 4. [Live Examples](#live-examples)
11
+ 5. [HTTP Status Codes](#http-status-codes)
11
12
 
12
13
  ---
13
14
 
@@ -91,6 +92,228 @@ interface EventResponse {
91
92
 
92
93
  ---
93
94
 
95
+ ## Event Log Query (GET)
96
+
97
+ Use `client.getEvents()` for Event API log search (`GET /api/v4.1/event`).
98
+
99
+ ### Input: FluentEventQueryParams
100
+
101
+ ```typescript
102
+ interface FluentEventQueryParams {
103
+ start?: number;
104
+ count?: number;
105
+ from?: string;
106
+ to?: string;
107
+ name?: string;
108
+ category?: string;
109
+ retailerId?: string | number;
110
+ eventType?: string;
111
+ eventStatus?: string;
112
+ 'context.rootEntityType'?: string;
113
+ 'context.rootEntityId'?: string | number;
114
+ 'context.rootEntityRef'?: string;
115
+ 'context.entityType'?: string;
116
+ 'context.entityId'?: string | number;
117
+ 'context.entityRef'?: string;
118
+ }
119
+ ```
120
+
121
+ > **Note:** Context parameters use dot-notation (`context.rootEntityType`). In JavaScript/TypeScript, keys with dots **must be quoted**:
122
+ > ```typescript
123
+ > // ✅ Correct - quotes required for dot-notation keys
124
+ > { 'context.rootEntityType': 'ORDER', eventType: 'ORCHESTRATION_AUDIT' }
125
+ >
126
+ > // ❌ Wrong - will cause syntax error
127
+ > { context.rootEntityType: 'ORDER' }
128
+ > ```
129
+
130
+ ### Output: FluentEventLogResponse (SUCCESS)
131
+
132
+ ```typescript
133
+ interface FluentEventLogResponse {
134
+ start: number;
135
+ count: number;
136
+ hasMore: boolean;
137
+ results: FluentEventLogItem[];
138
+ }
139
+ ```
140
+
141
+ ### When to use `getEvents()`
142
+
143
+ - Search historical events across a time window
144
+ - Investigate failed or delayed orchestration flows
145
+ - Filter by entity context to trace a specific order/job/product
146
+ - Collect event IDs for deeper inspection with `getEventById()`
147
+
148
+ ### `getEvents()` limitations and behavior
149
+
150
+ - Read-only endpoint: does not trigger workflows or mutate data
151
+ - `count` is capped by Fluent API (max `5000` per call)
152
+ - Time window constraints apply to `from` and `to`
153
+ - Empty `results` is a valid response for non-matching filters
154
+ - For large datasets, iterate with pagination (`start`, `count`)
155
+
156
+ ### Live Example: Orchestration Audit Query
157
+
158
+ **SDK Code:**
159
+ ```typescript
160
+ const result = await client.getEvents({
161
+ 'context.rootEntityType': 'JOB',
162
+ eventType: 'ORCHESTRATION_AUDIT',
163
+ start: 1,
164
+ count: 1000,
165
+ });
166
+ ```
167
+
168
+ **Output (HTTP 200):**
169
+ ```json
170
+ {
171
+ "start": 1,
172
+ "count": 1000,
173
+ "hasMore": false,
174
+ "results": [
175
+ {
176
+ "id": "e2cc5040-360b-43e9-b3c0-07bbc1934f82",
177
+ "name": "BATCH_COMPLETE",
178
+ "type": "ORCHESTRATION_AUDIT",
179
+ "accountId": "HMDEV",
180
+ "retailerId": "5",
181
+ "category": "BATCH",
182
+ "context": {
183
+ "sourceEvents": ["babc5f37-0a53-4d8e-85f2-dfab813d1e87"],
184
+ "entityType": "BATCH",
185
+ "entityId": "12",
186
+ "entityRef": "12",
187
+ "rootEntityType": "JOB",
188
+ "rootEntityId": "13",
189
+ "rootEntityRef": "13"
190
+ },
191
+ "eventStatus": "COMPLETE",
192
+ "attributes": null,
193
+ "source": null,
194
+ "generatedBy": "Rubix User",
195
+ "generatedOn": "2026-02-05T06:31:56.895+00:00"
196
+ }
197
+ ]
198
+ }
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Get Event By ID (GET)
204
+
205
+ Use `client.getEventById(eventId)` to retrieve a single event by its unique identifier (`GET /api/v4.1/event/{eventId}`).
206
+
207
+ ### Input
208
+
209
+ ```typescript
210
+ // Single string parameter - the event's unique ID
211
+ const eventId = '05838ba2-7025-11eb-b493-0f90922e985a';
212
+ const event = await client.getEventById(eventId);
213
+ ```
214
+
215
+ ### Output: FluentEventLogItem
216
+
217
+ ```typescript
218
+ interface FluentEventLogItem {
219
+ id: string; // Unique event identifier
220
+ name: string; // Event name (e.g., "DeactivateProduct")
221
+ type?: string; // ORCHESTRATION, ORCHESTRATION_AUDIT, API, GENERAL
222
+ accountId?: string; // Account identifier
223
+ retailerId?: string; // Retailer identifier
224
+ category?: string; // ruleSet, snapshot, ACTION, exception, etc.
225
+ context?: FluentEventLogContext; // Entity context information
226
+ eventStatus?: string; // SUCCESS, FAILED, PENDING, NO_MATCH, COMPLETE
227
+ attributes?: FluentEventLogAttribute[] | Record<string, AttributeValue> | null;
228
+ source?: string | null; // Event source
229
+ generatedBy?: string; // Who/what generated the event
230
+ generatedOn?: string; // ISO timestamp when event was generated
231
+ }
232
+
233
+ interface FluentEventLogContext {
234
+ sourceEvents?: string[]; // Parent event IDs (for tracing)
235
+ entityType?: string; // Entity type (ORDER, FULFILMENT, etc.)
236
+ entityId?: string; // Entity ID
237
+ entityRef?: string; // Entity reference
238
+ rootEntityType?: string; // Root entity type
239
+ rootEntityId?: string; // Root entity ID
240
+ rootEntityRef?: string; // Root entity reference
241
+ }
242
+ ```
243
+
244
+ > Note: `attributes` shape varies by event type. Some events return a key/value object, while orchestration events may return arrays or `null`.
245
+
246
+ ### Live Example: Get Event Details
247
+
248
+ **SDK Code:**
249
+ ```typescript
250
+ // Get specific event by ID
251
+ const event = await client.getEventById('e2cc5040-360b-43e9-b3c0-07bbc1934f82');
252
+
253
+ console.log(`Event: ${event.name}`);
254
+ console.log(`Status: ${event.eventStatus}`);
255
+ console.log(`Entity: ${event.context?.entityType}:${event.context?.entityRef}`);
256
+
257
+ // Trace parent events
258
+ if (event.context?.sourceEvents?.length) {
259
+ for (const parentId of event.context.sourceEvents) {
260
+ const parent = await client.getEventById(parentId);
261
+ console.log(` └─ Parent: ${parent.name} (${parent.eventStatus})`);
262
+ }
263
+ }
264
+
265
+ // Extract timing attributes (if available)
266
+ const attrs = event.attributes as Record<string, any> | null;
267
+ if (attrs) {
268
+ const startTimer = attrs['startTimer'];
269
+ const stopTimer = attrs['stopTimer'];
270
+ if (startTimer && stopTimer) {
271
+ const durationMs = parseInt(stopTimer) - parseInt(startTimer);
272
+ console.log(` Duration: ${durationMs}ms`);
273
+ }
274
+ }
275
+ ```
276
+
277
+ **Output (HTTP 200):**
278
+ ```json
279
+ {
280
+ "id": "e2cc5040-360b-43e9-b3c0-07bbc1934f82",
281
+ "name": "BATCH_COMPLETE",
282
+ "type": "ORCHESTRATION_AUDIT",
283
+ "accountId": "HMDEV",
284
+ "retailerId": "5",
285
+ "category": "BATCH",
286
+ "context": {
287
+ "sourceEvents": ["babc5f37-0a53-4d8e-85f2-dfab813d1e87"],
288
+ "entityType": "BATCH",
289
+ "entityId": "12",
290
+ "entityRef": "12",
291
+ "rootEntityType": "JOB",
292
+ "rootEntityId": "13",
293
+ "rootEntityRef": "13"
294
+ },
295
+ "eventStatus": "COMPLETE",
296
+ "attributes": null,
297
+ "source": null,
298
+ "generatedBy": "Rubix User",
299
+ "generatedOn": "2026-02-05T06:31:56.895+00:00"
300
+ }
301
+ ```
302
+
303
+ ### Error: Event Not Found (404)
304
+
305
+ ```typescript
306
+ try {
307
+ const event = await client.getEventById('non-existent-id');
308
+ } catch (error) {
309
+ if (error instanceof FluentAPIError && error.statusCode === 404) {
310
+ console.log('Event not found');
311
+ }
312
+ }
313
+ ```
314
+
315
+ ---
316
+
94
317
  ## Error Response Structure
95
318
 
96
319
  ### Output: FluentAPIError (THROWN)
@@ -101,7 +324,7 @@ When events fail, the SDK throws structured error objects:
101
324
  class FluentAPIError extends Error {
102
325
  name: 'FluentAPIError';
103
326
  message: string; // Error description (e.g., "Request failed: 400")
104
- status: number; // HTTP status code (400, 404, 500, etc.)
327
+ statusCode: number; // HTTP status code (400, 404, 500, etc.)
105
328
  details?: any; // Additional error context
106
329
  errors?: Array<any>; // Validation errors (if applicable)
107
330
  }
@@ -124,7 +347,7 @@ class FluentAPIError extends Error {
124
347
  FluentAPIError {
125
348
  name: "FluentAPIError",
126
349
  message: "Request failed: 404",
127
- status: 404,
350
+ statusCode: 404,
128
351
  details: "No workflow rule matched this event"
129
352
  }
130
353
  ```
@@ -152,7 +375,7 @@ FluentAPIError {
152
375
  FluentAPIError {
153
376
  name: "FluentAPIError",
154
377
  message: "Request failed: 400",
155
- status: 400,
378
+ statusCode: 400,
156
379
  details: "Bad Request - Invalid event configuration"
157
380
  }
158
381
  ```
@@ -285,7 +508,7 @@ POST /api/v4.1/event/sync
285
508
 
286
509
  # Output (HTTP 404) - THROWS FluentAPIError
287
510
  FluentAPIError: Request failed: 404
288
- status: 404
511
+ statusCode: 404
289
512
  message: "No workflow rule matched this event"
290
513
  ```
291
514
 
@@ -300,7 +523,7 @@ try {
300
523
  }, 'sync'); // ← Sync mode waits for workflow
301
524
  } catch (error) {
302
525
  if (error instanceof FluentAPIError) {
303
- console.error(`❌ HTTP ${error.status}: ${error.message}`);
526
+ console.error(`❌ HTTP ${error.statusCode}: ${error.message}`);
304
527
  // Output: ❌ HTTP 404: Request failed: 404
305
528
  }
306
529
  }
@@ -363,7 +586,7 @@ POST /api/v4.1/event/async
363
586
 
364
587
  # Output (HTTP 400) - THROWS FluentAPIError
365
588
  FluentAPIError: Request failed: 400
366
- status: 400
589
+ statusCode: 400
367
590
  message: "Bad Request"
368
591
  ```
369
592
 
@@ -378,7 +601,7 @@ try {
378
601
  }, 'async');
379
602
  } catch (error) {
380
603
  if (error instanceof FluentAPIError) {
381
- console.error(`❌ HTTP ${error.status}: ${error.message}`);
604
+ console.error(`❌ HTTP ${error.statusCode}: ${error.message}`);
382
605
  // Output: ❌ HTTP 400: Request failed: 400
383
606
  // SDK does NOT retry 4xx errors (client error, not transient)
384
607
  }
@@ -483,7 +706,7 @@ try {
483
706
  {
484
707
  name: "FluentAPIError",
485
708
  message: "Request failed: 404",
486
- status: 404,
709
+ statusCode: 404,
487
710
  details: "No workflow rule matched"
488
711
  }
489
712
  ```
@@ -563,7 +786,7 @@ try {
563
786
  await client.sendEvent({ name: 'InvalidEvent', ... });
564
787
  } catch (error) {
565
788
  // Throws immediately, NO retries
566
- console.error(error.status); // 400
789
+ console.error(error.statusCode); // 400
567
790
  }
568
791
  ```
569
792
 
@@ -593,8 +816,8 @@ for (const record of records) {
593
816
 
594
817
  if (error instanceof FluentAPIError) {
595
818
  // SDK already retried 401/5xx - this is non-retryable
596
- console.error(`❌ ${record.sku} - HTTP ${error.status}: ${error.message}`);
597
- results.errors.push({ sku: record.sku, status: error.status, error: error.message });
819
+ console.error(`❌ ${record.sku} - HTTP ${error.statusCode}: ${error.message}`);
820
+ results.errors.push({ sku: record.sku, statusCode: error.statusCode, error: error.message });
598
821
  } else if (error instanceof AuthenticationError) {
599
822
  // Auth failed after 3 retries - credentials issue
600
823
  console.error(`❌ Auth failure: ${error.message}`);
@@ -641,7 +864,7 @@ async function processBatch(products: Product[]): Promise<EventResult[]> {
641
864
  results.push({
642
865
  sku: product.sku,
643
866
  success: false,
644
- error: `HTTP ${error.status}: ${error.message}`
867
+ error: `HTTP ${error.statusCode}: ${error.message}`
645
868
  });
646
869
  } else {
647
870
  results.push({
@@ -689,6 +912,252 @@ async function processBatch(products: Product[]): Promise<EventResult[]> {
689
912
 
690
913
  ---
691
914
 
915
+ ## Event Log Query by ID (GET /api/v4.1/event/{eventId})
916
+
917
+ Use `client.getEventById(eventId)` to retrieve a single event by its unique identifier.
918
+
919
+ ### Input
920
+
921
+ ```typescript
922
+ const event = await client.getEventById('05838ba2-7025-11eb-b493-0f90922e985a');
923
+ ```
924
+
925
+ ### Output: FluentEventLogItem
926
+
927
+ ```typescript
928
+ interface FluentEventLogItem {
929
+ id: string;
930
+ name: string; // Event name (e.g., "BATCH_COMPLETE") — can be null
931
+ type?: string; // ORCHESTRATION_AUDIT, ORCHESTRATION, API, etc.
932
+ accountId?: string;
933
+ retailerId?: string; // String in API response
934
+ category?: string;
935
+ context?: FluentEventLogContext;
936
+ eventStatus?: string; // PENDING, SUCCESS, FAILED, COMPLETE, etc.
937
+ attributes?: FluentEventLogAttribute[] | null; // Can be null
938
+ source?: string | null;
939
+ generatedBy?: string;
940
+ generatedOn?: string; // ISO timestamp
941
+ }
942
+ ```
943
+
944
+ ### Live Example: Get Event by ID
945
+
946
+ **SDK Code:**
947
+ ```typescript
948
+ const event = await client.getEventById('e2cc5040-360b-43e9-b3c0-07bbc1934f82');
949
+ console.log(`Event: ${event.name} - Status: ${event.eventStatus}`);
950
+
951
+ // Trace parent events
952
+ if (event.context?.sourceEvents?.length) {
953
+ for (const parentId of event.context.sourceEvents) {
954
+ const parent = await client.getEventById(parentId);
955
+ console.log(`Parent: ${parent.name} (${parent.eventStatus})`);
956
+ }
957
+ }
958
+
959
+ // Extract timing from attributes
960
+ if (Array.isArray(event.attributes)) {
961
+ const startTimer = event.attributes.find(a => a.name === 'startTimer')?.value;
962
+ const stopTimer = event.attributes.find(a => a.name === 'stopTimer')?.value;
963
+ if (startTimer && stopTimer) {
964
+ console.log(`Duration: ${Number(stopTimer) - Number(startTimer)}ms`);
965
+ }
966
+ }
967
+ ```
968
+
969
+ ### Error Handling
970
+
971
+ ```typescript
972
+ try {
973
+ const event = await client.getEventById('nonexistent-id');
974
+ } catch (error) {
975
+ if (error instanceof FluentAPIError && error.statusCode === 404) {
976
+ console.log('Event not found');
977
+ }
978
+ }
979
+ ```
980
+
981
+ ---
982
+
983
+ ## Event Type / Status / Category Reference
984
+
985
+ ### Event Types (`eventType` parameter)
986
+
987
+ | Value | Description |
988
+ |-------|-------------|
989
+ | `ORCHESTRATION` | Trigger part or whole of a workflow |
990
+ | `ORCHESTRATION_AUDIT` | Audit of what happened during workflow execution |
991
+ | `API` | API interactions and system events |
992
+ | `INTEGRATION` | Integration-related events |
993
+ | `SECURITY` | Security events |
994
+ | `GENERAL` | General system events and notifications |
995
+
996
+ ### Event Statuses (`eventStatus` parameter)
997
+
998
+ | Value | Description |
999
+ |-------|-------------|
1000
+ | `PENDING` | Event is pending processing |
1001
+ | `SCHEDULED` | Event is scheduled for processing |
1002
+ | `NO_MATCH` | No matching ruleset found for this event |
1003
+ | `SUCCESS` | Event processed successfully |
1004
+ | `FAILED` | Event processing failed |
1005
+ | `COMPLETE` | Event completed |
1006
+
1007
+ ### Event Categories (`category` parameter)
1008
+
1009
+ | Value | Description |
1010
+ |-------|-------------|
1011
+ | `snapshot` | State snapshots |
1012
+ | `ruleSet` | Ruleset execution events |
1013
+ | `rule` | Individual rule execution events |
1014
+ | `ACTION` | User/system actions |
1015
+ | `CUSTOM` | Custom log actions |
1016
+ | `exception` | Error/exception events |
1017
+ | `ORDER_WORKFLOW` | Order-specific workflow events |
1018
+ | `BATCH` | Batch processing events |
1019
+
1020
+ ### Root Entity Types (`context.rootEntityType` parameter)
1021
+
1022
+ | Value | Description |
1023
+ |-------|-------------|
1024
+ | `ORDER` | Customer orders |
1025
+ | `LOCATION` | Physical locations and warehouses |
1026
+ | `FULFILMENT_OPTIONS` | Fulfillment configuration |
1027
+ | `PRODUCT_CATALOGUE` | Product definitions and catalogs |
1028
+ | `INVENTORY_CATALOGUE` | Inventory management |
1029
+ | `VIRTUAL_CATALOGUE` | Virtual inventory positions |
1030
+ | `CONTROL_GROUP` | Control and governance |
1031
+ | `RETURN_ORDER` | Return processing |
1032
+ | `BILLING_ACCOUNT` | Billing and payments |
1033
+ | `JOB` | Background jobs and batch processes |
1034
+
1035
+ ### Entity Types (`context.entityType` parameter)
1036
+
1037
+ | Value | Description |
1038
+ |-------|-------------|
1039
+ | `ORDER` | Customer orders |
1040
+ | `FULFILMENT` | Fulfillment operations |
1041
+ | `ARTICLE` | Articles within fulfillments |
1042
+ | `CONSIGNMENT` | Shipping consignments |
1043
+ | `WAVE` | Wave picking operations |
1044
+ | `BATCH` | Batch processing |
1045
+ | `LOCATION` | Location operations |
1046
+ | `PRODUCT` | Product records |
1047
+ | `CATEGORY` | Product categories |
1048
+ | `INVENTORY_POSITION` | Inventory positions |
1049
+ | `INVENTORY_QUANTITY` | Inventory quantities |
1050
+ | `VIRTUAL_POSITION` | Virtual inventory positions |
1051
+ | `CONTROL` | Individual controls |
1052
+ | `RETURN_FULFILMENT` | Return processing |
1053
+ | `CREDIT_MEMO` | Financial adjustments |
1054
+
1055
+ ---
1056
+
1057
+ ## Common Use Cases
1058
+
1059
+ ### 1. Track Batch Ingestion Results
1060
+
1061
+ ```typescript
1062
+ // Find all events for a specific job
1063
+ const events = await client.getEvents({
1064
+ 'context.rootEntityType': 'JOB',
1065
+ 'context.rootEntityId': '13',
1066
+ eventType: 'ORCHESTRATION_AUDIT',
1067
+ count: 1000,
1068
+ });
1069
+
1070
+ console.log(`Found ${events.results.length} events`);
1071
+ for (const event of events.results) {
1072
+ console.log(` ${event.name} (${event.context?.entityType}) - ${event.eventStatus}`);
1073
+ }
1074
+ ```
1075
+
1076
+ ### 2. Find Failed Workflow Events
1077
+
1078
+ ```typescript
1079
+ const failed = await client.getEvents({
1080
+ eventStatus: 'FAILED',
1081
+ eventType: 'ORCHESTRATION_AUDIT',
1082
+ from: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
1083
+ to: new Date().toISOString(),
1084
+ count: 1000,
1085
+ });
1086
+
1087
+ for (const event of failed.results) {
1088
+ console.log(`FAILED: ${event.name} on ${event.context?.entityType}:${event.context?.entityRef}`);
1089
+ }
1090
+ ```
1091
+
1092
+ ### 3. Paginate Through Large Result Sets
1093
+
1094
+ ```typescript
1095
+ let start = 0;
1096
+ const pageSize = 1000;
1097
+ let allEvents: FluentEventLogItem[] = [];
1098
+
1099
+ let hasMore = true;
1100
+ while (hasMore) {
1101
+ const page = await client.getEvents({
1102
+ 'context.rootEntityType': 'ORDER',
1103
+ eventType: 'ORCHESTRATION_AUDIT',
1104
+ start,
1105
+ count: pageSize,
1106
+ });
1107
+
1108
+ allEvents.push(...page.results);
1109
+ hasMore = page.hasMore;
1110
+ start += page.count;
1111
+ }
1112
+
1113
+ console.log(`Total events: ${allEvents.length}`);
1114
+ ```
1115
+
1116
+ ### 4. Extract Performance Timing
1117
+
1118
+ ```typescript
1119
+ const events = await client.getEvents({
1120
+ category: 'ruleSet',
1121
+ eventType: 'ORCHESTRATION_AUDIT',
1122
+ from: '2026-02-01T00:00:00.000Z',
1123
+ to: '2026-02-15T00:00:00.000Z',
1124
+ count: 5000,
1125
+ });
1126
+
1127
+ for (const event of events.results) {
1128
+ if (Array.isArray(event.attributes)) {
1129
+ const startTimer = event.attributes.find(a => a.name === 'startTimer')?.value;
1130
+ const stopTimer = event.attributes.find(a => a.name === 'stopTimer')?.value;
1131
+ if (startTimer && stopTimer) {
1132
+ const duration = Number(stopTimer) - Number(startTimer);
1133
+ console.log(`${event.name}: ${duration}ms (${event.eventStatus})`);
1134
+ }
1135
+ }
1136
+ }
1137
+ ```
1138
+
1139
+ ### 5. API Time Range Limits
1140
+
1141
+ The Event API enforces time range constraints:
1142
+ - **`from`**: Must be within **4 months back** from current date
1143
+ - **`to`**: Must be within **1 month forward** from current date
1144
+ - **Default**: If `from` is not specified, searches the **past 30 days**
1145
+ - **Max `count`**: 5000 events per request (recommended to avoid timeouts)
1146
+ - **Date format**: `YYYY-MM-DDTHH:mm:ss.SSSZ` (UTC ISO string)
1147
+
1148
+ ```typescript
1149
+ // This will fail - too far in the past
1150
+ try {
1151
+ const tooOld = await client.getEvents({
1152
+ from: '2020-01-01T00:00:00.000Z', // More than 4 months ago
1153
+ });
1154
+ } catch (error) {
1155
+ // API Error: "'from' and 'to' must be within 4 months back and 1 months forward"
1156
+ }
1157
+ ```
1158
+
1159
+ ---
1160
+
692
1161
  ## Related Documentation
693
1162
 
694
1163
  - **Event API Guide**: [fc-connect-sdk/docs/01-TEMPLATES/versori/workflows/ingestion/event-api/event-api-guide.md](../docs/01-TEMPLATES/versori/workflows/ingestion/event-api/event-api-guide.md)
@@ -697,6 +1166,6 @@ async function processBatch(products: Product[]): Promise<EventResult[]> {
697
1166
 
698
1167
  ---
699
1168
 
700
- **Generated from live test environment**: sagirish.test.api.fluentretail.com
701
- **SDK Version**: 0.1.46
702
- **Test Date**: 2025-01-19
1169
+ **Generated from live test environments**: sagirish.test.api.fluentretail.com, hmdev.sandbox.api.fluentretail.com
1170
+ **SDK Version**: 0.1.51
1171
+ **Last Updated**: 2026-02-15
@@ -310,6 +310,89 @@ const event = await client.sendEvent(
310
310
  );
311
311
  ```
312
312
 
313
+ #### getEvents Method
314
+
315
+ Search event logs and orchestration audit events using Event API filters.
316
+
317
+ ```typescript
318
+ async getEvents(params?: FluentEventQueryParams): Promise<FluentEventLogResponse>
319
+ ```
320
+
321
+ **Key Filters:**
322
+
323
+ - `eventType` - `ORCHESTRATION`, `ORCHESTRATION_AUDIT`, `API`, `GENERAL`
324
+ - `eventStatus` - `PENDING`, `SCHEDULED`, `SUCCESS`, `FAILED`, `COMPLETE`, `NO_MATCH`
325
+ - `context.rootEntityType`, `context.rootEntityId`, `context.rootEntityRef`
326
+ - `context.entityType`, `context.entityId`, `context.entityRef`
327
+ - `from`, `to`, `start`, `count`
328
+
329
+ **Example:**
330
+
331
+ ```typescript
332
+ const auditEvents = await client.getEvents({
333
+ 'context.rootEntityType': 'JOB',
334
+ eventType: 'ORCHESTRATION_AUDIT',
335
+ start: 1,
336
+ count: 1000,
337
+ });
338
+
339
+ console.log(auditEvents.hasMore);
340
+ console.log(auditEvents.results[0]?.name);
341
+ ```
342
+
343
+ **Response Shape:**
344
+
345
+ ```typescript
346
+ interface FluentEventLogResponse {
347
+ start: number;
348
+ count: number;
349
+ hasMore: boolean;
350
+ results: FluentEventLogItem[];
351
+ }
352
+ ```
353
+
354
+ **When to use `getEvents()`:**
355
+
356
+ - Investigate failed orchestration runs (`eventStatus: 'FAILED'`)
357
+ - Trace execution for jobs/orders/products using context filters
358
+ - Build operational dashboards and lightweight audit reports
359
+ - Find candidate event IDs before calling `getEventById()`
360
+
361
+ **Limitations / behavior notes:**
362
+
363
+ - Read-only API: does not trigger workflows or mutate entities
364
+ - `count` is capped by Fluent API (max `5000` per request)
365
+ - Time window constraints apply to `from`/`to` on the backend API
366
+ - Empty `results` for a valid query is normal and not treated as an error
367
+ - Use bounded time ranges and pagination (`start` + `count`) for large searches
368
+
369
+ #### getEventById Method
370
+
371
+ Fetch a single event by ID from Event API.
372
+
373
+ ```typescript
374
+ async getEventById(eventId: string): Promise<FluentEventLogItem>
375
+ ```
376
+
377
+ **Example:**
378
+
379
+ ```typescript
380
+ const event = await client.getEventById('e2cc5040-360b-43e9-b3c0-07bbc1934f82');
381
+ console.log(event.name, event.eventStatus);
382
+ ```
383
+
384
+ **When to use `getEventById()`:**
385
+
386
+ - Drill into a known event from logs, alerts, or trace tooling
387
+ - Inspect full context (`sourceEvents`, `entityRef`, `rootEntityRef`)
388
+ - Correlate parent/child orchestration events for root-cause analysis
389
+
390
+ **Limitations / behavior notes:**
391
+
392
+ - Requires a concrete event ID (it does not support filtering)
393
+ - Throws `FluentValidationError` for empty IDs
394
+ - Returns HTTP `404` (as `FluentAPIError`) when the event does not exist
395
+
313
396
  ### Job & Batch Operations
314
397
 
315
398
  #### createJob Method