@fluentcommerce/fc-connect-sdk 0.1.51 → 0.1.52
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/CHANGELOG.md +18 -0
- package/README.md +217 -0
- package/dist/cjs/clients/fluent-client.js +60 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +64 -0
- package/dist/cjs/versori/fluent-versori-client.d.ts +4 -1
- package/dist/cjs/versori/fluent-versori-client.js +83 -0
- package/dist/esm/clients/fluent-client.js +60 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts +64 -0
- package/dist/esm/versori/fluent-versori-client.d.ts +4 -1
- package/dist/esm/versori/fluent-versori-client.js +83 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +64 -0
- package/dist/types/versori/fluent-versori-client.d.ts +4 -1
- package/docs/02-CORE-GUIDES/api-reference/event-api-input-output-reference.md +478 -18
- package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-01-client-api.md +83 -0
- package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-08-types.md +52 -0
- package/docs/02-CORE-GUIDES/api-reference/readme.md +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
@@ -77,6 +77,58 @@ if (result.errors) {
|
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
### FluentEventQueryParams
|
|
81
|
+
|
|
82
|
+
Query params for Event Log/Audit search (`GET /api/v4.1/event`).
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
interface FluentEventQueryParams {
|
|
86
|
+
start?: number;
|
|
87
|
+
count?: number;
|
|
88
|
+
from?: string;
|
|
89
|
+
to?: string;
|
|
90
|
+
name?: string;
|
|
91
|
+
category?: string;
|
|
92
|
+
retailerId?: string | number;
|
|
93
|
+
eventType?: string;
|
|
94
|
+
eventStatus?: string;
|
|
95
|
+
'context.rootEntityType'?: string;
|
|
96
|
+
'context.rootEntityId'?: string | number;
|
|
97
|
+
'context.rootEntityRef'?: string;
|
|
98
|
+
'context.entityType'?: string;
|
|
99
|
+
'context.entityId'?: string | number;
|
|
100
|
+
'context.entityRef'?: string;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### FluentEventLogResponse
|
|
105
|
+
|
|
106
|
+
Response from Event Log search (`client.getEvents()`).
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
interface FluentEventLogResponse {
|
|
110
|
+
start: number;
|
|
111
|
+
count: number;
|
|
112
|
+
hasMore: boolean;
|
|
113
|
+
results: FluentEventLogItem[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface FluentEventLogItem {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
type?: string;
|
|
120
|
+
accountId?: string;
|
|
121
|
+
retailerId?: string;
|
|
122
|
+
category?: string;
|
|
123
|
+
context?: FluentEventLogContext;
|
|
124
|
+
eventStatus?: string;
|
|
125
|
+
attributes?: FluentEventLogAttribute[] | Record<string, AttributeValue> | null;
|
|
126
|
+
source?: string | null;
|
|
127
|
+
generatedBy?: string;
|
|
128
|
+
generatedOn?: string;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
80
132
|
## Enums
|
|
81
133
|
|
|
82
134
|
### BatchAction
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
|
|
69
69
|
The main entry point for SDK operations. Learn how to create clients, execute GraphQL operations, send events, and manage batch jobs.
|
|
70
70
|
|
|
71
|
-
**Key APIs:** `createClient()`, `FluentClient`, `graphql(payload)`, `sendEvent()`, `createJob()`, `sendBatch()`
|
|
71
|
+
**Key APIs:** `createClient()`, `FluentClient`, `graphql(payload)`, `sendEvent()`, `getEvents()`, `getEventById()`, `createJob()`, `sendBatch()`
|
|
72
72
|
|
|
73
73
|
[View Module →](./modules/api-reference-01-client-api.md)
|
|
74
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentcommerce/fc-connect-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "Fluent Commerce SDK - Deno & Node.js Compatible",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"@types/ssh2-sftp-client": "^9.0.5",
|
|
110
110
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
111
111
|
"@typescript-eslint/parser": "^7.0.0",
|
|
112
|
-
"@versori/run": "^0.4.
|
|
112
|
+
"@versori/run": "^0.4.18",
|
|
113
113
|
"chalk": "^4.1.2",
|
|
114
114
|
"dotenv": "^17.2.2",
|
|
115
115
|
"eslint": "^8.57.0",
|