@fluentcommerce/fc-connect-sdk 0.1.52 → 0.1.54

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +530 -506
  2. package/README.md +52 -3
  3. package/dist/cjs/auth/index.d.ts +3 -0
  4. package/dist/cjs/auth/index.js +13 -0
  5. package/dist/cjs/auth/profile-loader.d.ts +18 -0
  6. package/dist/cjs/auth/profile-loader.js +208 -0
  7. package/dist/cjs/client-factory.d.ts +4 -0
  8. package/dist/cjs/client-factory.js +10 -0
  9. package/dist/cjs/index.d.ts +3 -1
  10. package/dist/cjs/index.js +8 -2
  11. package/dist/cjs/types/index.d.ts +1 -1
  12. package/dist/esm/auth/index.d.ts +3 -0
  13. package/dist/esm/auth/index.js +2 -0
  14. package/dist/esm/auth/profile-loader.d.ts +18 -0
  15. package/dist/esm/auth/profile-loader.js +169 -0
  16. package/dist/esm/client-factory.d.ts +4 -0
  17. package/dist/esm/client-factory.js +9 -0
  18. package/dist/esm/index.d.ts +3 -1
  19. package/dist/esm/index.js +2 -1
  20. package/dist/esm/types/index.d.ts +1 -1
  21. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/tsconfig.types.tsbuildinfo +1 -1
  24. package/dist/types/auth/index.d.ts +3 -0
  25. package/dist/types/auth/profile-loader.d.ts +18 -0
  26. package/dist/types/client-factory.d.ts +4 -0
  27. package/dist/types/index.d.ts +3 -1
  28. package/dist/types/types/index.d.ts +1 -1
  29. package/docs/02-CORE-GUIDES/api-reference/cli-profile-integration.md +377 -0
  30. package/docs/02-CORE-GUIDES/api-reference/event-api-input-output-reference.md +24 -15
  31. package/docs/02-CORE-GUIDES/api-reference/modules/api-reference-01-client-api.md +38 -0
  32. package/docs/02-CORE-GUIDES/webhook-validation/modules/webhook-validation-09-rubix-event-vs-http-call.md +1 -1
  33. package/docs/03-PATTERN-GUIDES/multiple-connections/modules/multiple-connections-02-quick-start.md +1 -1
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,506 +1,530 @@
1
- # Changelog
2
-
3
- All notable changes to the Fluent Commerce Connect SDK will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- _No unreleased changes_
11
-
12
- ## [0.1.52] - 2026-02-15
13
-
14
- ### Added - Event API Log Query (REST GET Endpoints)
15
- - Added `getEvents(params)` to `FluentClient` and `FluentVersoriClient` for `GET /api/v4.1/event`
16
- - Search/query events with comprehensive filtering (entity type, status, date range, etc.)
17
- - Supports pagination with `start`/`count` parameters (max 5000 per page)
18
- - Full documentation with JSDoc examples for common use cases
19
- - Added `getEventById(eventId)` to `FluentClient` and `FluentVersoriClient` for `GET /api/v4.1/event/{eventId}`
20
- - Retrieve complete event details by unique identifier
21
- - Returns event metadata, context, attributes, and source event IDs
22
- - Useful for event tracing and debugging workflows
23
- - Added typed Event Log models: `FluentEventQueryParams`, `FluentEventLogResponse`, `FluentEventLogItem`, `FluentEventLogContext`, and `FluentEventLogAttribute`
24
- - Added typed Event constants for query safety: `FluentEventType`, `FluentEventStatus`, `FluentEventCategory`, `FluentEventRootEntityType`, and `FluentEventEntityType`
25
- - Added unit test coverage for query-string building, empty-filter handling, success parsing, and error paths
26
- - Updated API docs with `getEvents()` and `getEventById()` usage examples
27
-
28
- ### Added - Security & Compliance
29
- - **Security Audit Infrastructure** - Comprehensive security audit tools and scripts
30
- - `security-audit/security-audit.cjs` - Automated vulnerability scanning
31
- - `security-audit/safe-fix.cjs` - Safe vulnerability fixing with automatic testing
32
- - `security-audit/snyk-setup.cjs` - Snyk integration for advanced scanning
33
- - GitHub Actions workflow for automated security scans
34
- - Dependabot configuration for automated dependency updates
35
- - **Security Documentation** - Complete security and compliance guides
36
- - SOC 2 Compliance Guide
37
- - Vulnerability Checking Guide
38
- - Safe Fixing Guide
39
- - Advanced Scanning Guide (Snyk)
40
- - Security audit quick start
41
- - **Security Scripts** - NPM scripts for security management
42
- - `npm run security:check` - Comprehensive security audit
43
- - `npm run security:fix` - Safe vulnerability fixing
44
- - `npm run security:snyk` - Advanced Snyk scanning
45
- - `npm run security:full` - Full security check (npm audit + Snyk)
46
-
47
- ### Fixed - Security Vulnerabilities
48
- - **js-yaml vulnerabilities** (MODERATE) - Updated to secure versions (3.14.2, 4.1.1)
49
- - **@versori/run** - Updated from 0.4.4 to 0.4.11 (includes security fixes)
50
- - **markdownlint-cli** (HIGH) - Updated from 0.45.0 to 0.46.0 (fixes glob command injection)
51
- - **Removed unused dependency** - Removed unused `jose@5.10.0` package
52
- - **Security Status:** Reduced vulnerabilities from 12 to 3 (75% reduction)
53
- - Fixed: 2 Critical, 3 High, 4 Moderate, 1 Low
54
- - Remaining: 3 Moderate (transitive dependencies, no fix available)
55
-
56
- ## [0.1.51] - 2025-01-12
57
-
58
- ### Added
59
-
60
- **GraphQL Partial Response Support**
61
- - **New error handling mode**: Added `errorHandling: 'partial'` option for `FluentClient.graphql()` and `ExtractionOrchestrator`
62
- - Allows returning both `data` AND `errors` when GraphQL returns partial responses (GraphQL spec compliant)
63
- - Default behavior unchanged: `'throw'` mode throws `GraphQLExecutionError` on any errors (backward compatible)
64
- - Opt-in feature for scenarios where partial data is acceptable (batch operations, analytics, etc.)
65
- - **Response extensions**: Added `hasPartialData` flag to `GraphQLResponse` interface
66
- - Set to `true` when response contains both data and errors
67
- - Only present when `errorHandling: 'partial'` is used and errors occurred
68
- - **Error accumulation across pagination**: Partial mode accumulates errors from all pages
69
- - All GraphQL errors collected in `response.errors` array for paginated queries
70
- - ExtractionOrchestrator includes errors in `stats.partialErrors` field
71
- - **Null data handling**: ExtractionOrchestrator gracefully handles `data: null` with errors in partial mode
72
- - Returns empty array `[]` instead of throwing
73
- - Stops pagination when no data available (cannot determine if more pages exist)
74
- - Errors still accumulated in `stats.partialErrors`
75
- - Preserves backward compatibility: throw mode still throws original error messages
76
-
77
- **Use Cases:**
78
- - Batch mutations where some items may fail independently
79
- - Analytics/reporting where partial data is better than no data
80
- - Extraction workflows where some records may be inaccessible
81
- - Resilient data pipelines that continue despite errors
82
-
83
- **Usage Example:**
84
- ```typescript
85
- // Partial mode: get both successful and failed results
86
- const result = await client.graphql({
87
- query: batchMutation,
88
- errorHandling: 'partial' // Opt-in
89
- });
90
-
91
- if (result.hasPartialData) {
92
- // Process successful items
93
- processSuccessful(result.data);
94
-
95
- // Log or retry failed items
96
- for (const error of result.errors || []) {
97
- logger.warn('Failed item:', error.path, error.message);
98
- }
99
- }
100
-
101
- // Default mode (throw): fail fast on any error
102
- const criticalResult = await client.graphql({
103
- query: singleMutation
104
- // errorHandling: 'throw' is default
105
- });
106
- ```
107
-
108
- **Documentation:**
109
- - Complete guide: `docs/02-CORE-GUIDES/api-reference/modules/api-reference-12-partial-responses.md`
110
- - Best practices, migration guide, and edge case handling included
111
- - Integration examples with FluentClient, FluentVersoriClient, and ExtractionOrchestrator
112
-
113
- **Test Coverage:**
114
- - 9+ test scenarios in `tests/unit/fluent-client-partial-response.test.ts`
115
- - 5+ test scenarios in `tests/unit/services/extraction/extraction-orchestrator.test.ts` (including null data edge cases)
116
- - Edge cases: null data, empty errors array, error extensions, pagination, pagination stop on null data
117
-
118
- **Backward Compatibility:**
119
- - No breaking changes
120
- - Default behavior unchanged ('throw' mode)
121
- - Existing code continues to work without modifications
122
-
123
- ## [0.1.48] - 2025-11-19
124
-
125
- ### ⚠️ IMPORTANT - Share in Slack
126
-
127
- **Breaking Change in v0.1.47**: If you're using `httpStatus` from EventResponse, you must migrate to `statusCode`.
128
-
129
- ```typescript
130
- // ❌ OLD (no longer works)
131
- const status = response.httpStatus;
132
-
133
- // NEW (v0.1.47+)
134
- const status = response.statusCode;
135
- ```
136
-
137
- See v0.1.47 changelog below for full details.
138
-
139
- ### Added
140
- - **FluentVersoriClient connection validation enhancements** - Improved error handling and connection validation for Versori platform
141
- - **Event API template documentation** - 8 new templates for S3/SFTP ingestion with CSV, XML, JSON, Parquet formats
142
- - **Connection validation pattern guide** - New documentation for Versori connection validation patterns
143
- - **README error classification documentation** - Added comprehensive code examples for `classifyError` and `classifyErrors` functions
144
-
145
- ### Changed
146
- - **README updates** - Updated template count from 15+ to 23+, added Error Classification section to Core Services table
147
- - **Smart Error Handling documentation** - Added note about consistent `statusCode` field across success and error responses
148
- - **Error handling documentation improvements** - Added links to comprehensive error handling guide and quick reference
149
-
150
- ### Fixed
151
- - **FluentVersoriClient improvements** - 206 lines of enhancements for better error handling and connection management
152
-
153
- ## [0.1.47] - 2025-11-19
154
-
155
- ### Changed
156
- - **BREAKING: EventResponse interface standardized on `statusCode`**
157
- - Removed `httpStatus` field from EventResponse interface
158
- - HTTP status code is now consistently available as `statusCode` in both success and error responses
159
- - Success: `response.statusCode` (200, 201, 202)
160
- - Error: `error.statusCode` (400, 401, 404, 500, etc.)
161
- - Migration: Replace all `response.httpStatus` with `response.statusCode`
162
-
163
- ### Fixed
164
- - **Auth retry tests** - Updated expected error type from FluentAPIError to AuthenticationError after exhausting retries
165
- - **Test timeouts** - Added proper timeout for retry delay tests
166
-
167
- ## [0.1.46] - 2025-11-18
168
-
169
- ### Changed
170
- - Documentation consolidation for error handling
171
- - Removed duplicate module files in error-handling docs
172
- - Added SDK automatic retry behavior clarification
173
-
174
- ## [0.1.45] - 2025-11-17
175
-
176
- ### Added
177
- - **XML Helper Exports** (2025-11-17)
178
- - `getXmlAttribute` - Extract XML attributes from multiple parser formats (Versori $, SDK @, xml2js)
179
- - `getXmlTextContent` - Extract XML text content from multiple formats (_, #text, value)
180
- - `normalizeEmpty` - Normalize empty values (null, undefined, '', whitespace)
181
- - All three helpers now exported from `@fluentcommerce/fc-connect-sdk`
182
- - Comprehensive unit tests (19 tests) and inline JSDoc documentation
183
-
184
- ### Changed
185
- - **Resolver Helper Improvements** (2025-11-17)
186
- - SDK resolvers now use `helpers.getXmlTextContent` for XML text extraction
187
- - Replaces manual format checking (`attr._ || attr['#text'] || attr.value`)
188
- - Improves consistency across XML parser formats
189
-
190
- ### Notes
191
- - These helpers were previously internal-only and are now part of the public API
192
- - No breaking changes - existing code continues to work
193
- - Maintains backward compatibility with all existing resolver implementations
194
-
195
- ## [0.1.43] - 2025-01-14
196
-
197
- ### Added
198
-
199
- **GraphQL Error Classification Service** (2025-01-14)
200
- - **New error classification utilities**: Added `classifyError()` and `classifyErrors()` functions to classify Fluent Commerce GraphQL errors
201
- - **Retry guidance**: Automatically determines if errors are retryable based on error codes (C/S/T prefix)
202
- - **User-friendly messages**: Provides actionable error messages and recommended actions
203
- - **Error code support**: Handles Fluent Commerce error codes (C0121E, S0002E, etc.) with proper classification
204
- - **Export location**: Available via `import { classifyError, classifyErrors, type ErrorClassification } from '@fluentcommerce/fc-connect-sdk'`
205
-
206
- **Usage Example:**
207
- ```typescript
208
- import { classifyErrors } from '@fluentcommerce/fc-connect-sdk';
209
-
210
- if (response.errors) {
211
- const classification = classifyErrors(response.errors);
212
- if (classification.retryable) {
213
- // Retry with delay
214
- await delay(classification.retryDelaySeconds * 1000);
215
- } else {
216
- // Show error to user
217
- console.error(classification.userMessage);
218
- }
219
- }
220
- ```
221
-
222
- **Error Classification Features:**
223
- - Categorizes errors as CLIENT_ERROR, SERVER_ERROR, THIRD_PARTY_ERROR, or UNKNOWN
224
- - Provides retryability guidance (retryable: true/false)
225
- - Includes recommended action (FIX_AND_RETRY, RETRY_LATER, CONTACT_SUPPORT, VERIFY_PAYLOAD)
226
- - Suggests retry delay in seconds for retryable errors
227
- - Extracts error codes from multiple locations (extensions.code, message parsing)
228
-
229
- ## [0.1.41] - 2025-11-13
230
-
231
- ### Improved
232
-
233
- **GraphQLMutationMapper API Consistency** (2025-11-13)
234
- - **Auto-generates GraphQL query**: `mapWithNodes()` now includes `query` property in result (consistent with `map()` method)
235
- - **Explicit variables property**: Added `MapWithNodesResult.variables` for direct GraphQL execution
236
- - `variables` is auto-wrapped in `{ input: ... }` when using fields pattern
237
- - `data` remains unwrapped for direct field access (`result.data.orderRef`)
238
- - **Improved constructor options**: Added `MappingOptions` interface
239
- - `customResolvers` - Pass resolvers via constructor instead of every method call
240
- - `customTransforms` - Pass custom transforms via constructor
241
- - Method-level resolvers still supported (takes precedence over constructor resolvers)
242
- - **Optional resolvers parameter**: `mapWithNodes(sourceData)` - resolvers now optional
243
- - **Consistent error handling**: Returns structured error result (not throw) with `success: false`
244
-
245
- **Before (old pattern - removed):**
246
- ```typescript
247
- const mapper = new GraphQLMutationMapper(mappingConfig, client, logger);
248
- const result = await mapper.mapWithNodes(sourceData, customResolvers);
249
- const query = buildMutationQuery(mappingConfig); // Manual step
250
- await client.graphql({ query, variables: result.data });
251
- ```
252
-
253
- **After (new pattern - consistent with UniversalMapper):**
254
- ```typescript
255
- const mapper = new GraphQLMutationMapper(mappingConfig, logger, {
256
- customResolvers,
257
- fluentClient: client // Pass client via options
258
- });
259
- const result = await mapper.mapWithNodes(sourceData);
260
- await client.graphql({
261
- query: result.query, // Auto-generated
262
- variables: result.variables // Auto-wrapped if fields pattern
263
- });
264
- ```
265
-
266
- **Backward Compatibility:**
267
- - Existing code using `result.data` continues to work
268
- - Optional parameters maintain compatibility with existing code
269
-
270
- ### Fixed
271
-
272
- **GraphQLMutationMapper Bug Fixes** (2025-11-13)
273
- - **Empty `arguments: {}` detection**: Fixed `buildMutationQuery()` to treat empty `arguments: {}` as fields pattern
274
- - Previously, empty `arguments: {}` would not trigger `{ input: ... }` wrapping
275
- - Now correctly detects and wraps variables when using fields pattern
276
- - **Type safety**: Updated `MapWithNodesResult` interface with complete type definitions
277
- - **CRITICAL**: Fixed incorrect Versori credential access pattern in templates
278
- - Templates incorrectly used `connections.credentials().getAccessToken()` or `ctx.connections.credentials().getAccessToken()`
279
- - Correct pattern is `ctx.credentials().getAccessToken()`
280
- - This error caused runtime failures: `Cannot read properties of undefined (reading 'credentials')`
281
- - Fixed 7 template files across batch-api, graphql-mutations, and extraction workflows
282
- - Updated inline documentation comments to reflect correct pattern
283
- - Removed unnecessary `connections` destructuring from context objects
284
-
285
- ### Removed - OAuth2 Server Functionality
286
-
287
- **WebhookAuthService OAuth2 Server Methods Removed** (2025-11-06)
288
- - **BREAKING**: Removed OAuth2 server functionality from `WebhookAuthService`
289
- - Removed `issueToken()` method - OAuth2 token issuance no longer supported
290
- - Removed `validateToken()` method - OAuth2 token validation no longer supported
291
- - Removed `refreshToken()` method - OAuth2 token refresh no longer supported
292
- - Removed `revokeToken()` method - OAuth2 token revocation no longer supported
293
- - Removed `WebhookAuthServiceConfig` interface - constructor now only requires logger
294
- - Removed `jose` dependency - no longer needed for JWT token handling
295
- - **API Key Authentication**: `WebhookAuthService` now supports API key authentication only
296
- - `generateApiKey()` - Generate secure API keys
297
- - `generateApiKeyWithPrefix()` - Generate prefixed API keys
298
- - `hashApiKey()` - Hash API keys for secure storage
299
- - `validateApiKey()` - Validate API keys with lookup function
300
- - **Migration**: Users of OAuth2 server methods should migrate to API key authentication
301
- - **Note**: OAuth2 **client** authentication (FluentClient authenticating with Fluent Commerce) remains unchanged
302
-
303
- ## [0.1.39] - 2025-01-14
304
-
305
- ### Changed
306
- - **Production Ready Release**: Comprehensive documentation and feature completion
307
- - Fixed missing bin file (analyze-source-structure.js)
308
- - Fixed 449 documentation links (97% success rate)
309
- - Created 52 README files for improved navigation
310
- - Added 33 module files for complete feature coverage
311
- - All 7 CLI tools now functional
312
- - PDF documentation generated
313
- - Published to npm registry
314
-
315
- ### Documentation
316
- - Comprehensive documentation updates across all modules
317
- - Improved navigation with README files in all directories
318
- - Complete API reference documentation
319
- - Updated template examples and guides
320
- - CLI tool documentation
321
-
322
- ### Features (Stable)
323
- - TypeScript SDK for Fluent Commerce integration
324
- - Multi-runtime support (Node.js ≥18.0.0, Deno, Versori platform)
325
- - Complete API client with OAuth2 authentication
326
- - Data sources: S3, SFTP with connection pooling
327
- - Parsers: CSV, XML, JSON, Parquet
328
- - Mappers: UniversalMapper, GraphQLMutationMapper
329
- - Comprehensive test suite (97%+ coverage)
330
-
331
- ## [0.1.31] - 2025-01-14
332
-
333
- ### Code Changes
334
- - None
335
-
336
- ### Documentation
337
- - Fixed 32 critical documentation issues across 10 core guide sections
338
- - Corrected method names, type definitions, and configuration parameters
339
- - Updated 35+ documentation files with accurate examples
340
- - Improved overall documentation accuracy to 95%+
341
-
342
- ## Previous Releases
343
-
344
- ### Added - Security Enhancements
345
-
346
- **WebhookAuthService Security Features** (2025-01-XX)
347
- - **Token Revocation**: Added `revokeToken()` method with optional `revocationStore` configuration
348
- - Tokens can be revoked before expiry using JTI (JWT ID) blacklist
349
- - Automatic revocation check in `validateToken()` when revocation store is configured
350
- - Supports automatic cleanup via TTL (expiresAt)
351
- - **Rate Limiting**: Added sliding window rate limiting for `issueToken()` endpoint
352
- - Optional `rateLimitStore` configuration for persistent rate limiting
353
- - Configurable limits (default: 10 attempts per 60 seconds)
354
- - Per-username rate limiting to prevent brute force attacks
355
- - Fail-open behavior on rate limit errors (allows requests if check fails)
356
- - **Constant-Time Comparison**: Added `constantTimeEqualHex()` function for API key validation
357
- - Prevents timing attacks on API key validation
358
- - Automatic timing attack protection in `validateApiKey()` when `useConstantTimeComparison` is enabled
359
- - **Refresh Token Rotation**: Automatic refresh token rotation on each refresh
360
- - Old refresh tokens are automatically revoked when new tokens are issued
361
- - Requires `revocationStore` to be configured for rotation
362
- - **Token Type Consistency**: Added `type: 'access'` field to access tokens
363
- - Access tokens now include `type: 'access'` claim
364
- - Refresh tokens include `type: 'refresh'` claim
365
- - Improves token type validation and security
366
-
367
- ### Changed - Security Enhancements
368
-
369
- **WebhookAuthService API Changes** (2025-01-XX)
370
- - `validateApiKey()` now accepts optional `options` parameter:
371
- - `useConstantTimeComparison?: boolean` - Enable timing attack protection (default: true)
372
- - `compareHashed?: boolean` - If true, keyLookup expects hashed key
373
- - `WebhookAuthServiceConfig` now supports optional security features:
374
- - `revocationStore?: { get, set }` - Optional token revocation store
375
- - `rateLimitStore?: { get, set }` - Optional rate limiting store
376
- - `rateLimitConfig?: { maxAttempts, windowSeconds }` - Rate limiting configuration
377
-
378
- ### Testing
379
-
380
- **Security Test Coverage** (2025-01-XX)
381
- - Added comprehensive security test suite (500+ lines)
382
- - Token revocation tests (3 tests)
383
- - Rate limiting tests (4 tests)
384
- - Malformed token handling tests (5 tests)
385
- - Expired token handling tests (2 tests)
386
- - Token type validation tests (2 tests)
387
- - API key security tests (2 tests)
388
- - Refresh token rotation tests (2 tests)
389
- - Total test coverage: 20+ new security-specific tests
390
-
391
- ### Documentation
392
-
393
- **Security Documentation** (2025-01-XX)
394
- - Added `docs/04-REFERENCE/platforms/versori/webhook-auth-security-considerations.md` - Security best practices guide
395
- - Updated `README.md` with security features
396
- - Updated service documentation with security configuration examples
397
-
398
- ## [0.1.28] - 2025-10-30
399
-
400
- ### Documentation
401
-
402
- **README Critical Fixes** (2025-10-30)
403
- - Fixed missing FluentBatchManager (FBM) in Mermaid architecture diagram
404
- - Added FBM node to Service Layer subgraph (line 63)
405
- - Added FBM styling to match other services (line 138)
406
- - Restored 9 connections referencing FBM
407
- - **Impact:** Architecture diagram now renders correctly with all services visible
408
- - Fixed 2 broken links to mapper comparison guide
409
- - Updated paths from `docs/00-START-HERE/MAPPER-COMPARISON-GUIDE.md` to correct location
410
- - Correct path: `docs/02-CORE-GUIDES/mapping/mapper-comparison-guide.md`
411
- - **Impact:** Users can now access critical mapper selection guide
412
- - Fixed SDK philosophy filename case sensitivity issue
413
- - Changed from `SDK-PHILOSOPHY.md` (uppercase) to `sdk-philosophy.md` (lowercase)
414
- - **Impact:** Link now works on case-sensitive filesystems (Linux, macOS)
415
- - Verified all 24 documentation paths in README
416
- - All links validated and working
417
- - Cross-platform compatibility ensured
418
-
419
- **Previous README Improvements** (2025-10-30)
420
- - Added Table of Contents for improved navigation
421
- - Restructured to show Architecture/Services upfront before Quickstart
422
- - Fixed 2 hallucinated service names throughout README:
423
- - `BatchAPIClient` → `FluentBatchManager` (correct SDK service name)
424
- - `IngestionOrchestrator` → `IngestionService` (correct SDK service name)
425
- - Clarified logging approach: Function-based utilities (`createConsoleLogger`, `toStructuredLogger`) for standalone environments
426
- - Fixed 6 broken documentation links to match new 5-folder structure
427
- - Added complete S3 CSV Batch API workflow example with real SDK methods
428
- - Added complete SFTP XML Batch API workflow example with real SDK methods
429
- - Added Universal Mapping section with XML/JSON transformation examples
430
- - Fixed architecture diagram with correct service names and relationships
431
- - Added "Learn More" sections linking to relevant documentation guides
432
- - Updated code examples to match actual SDK APIs (all examples now verified)
433
- - Improved "When to Use This SDK" decision table
434
- - Enhanced authentication section with OAuth2 token refresh details
435
- - Added Common Pitfalls section with quick fixes
436
-
437
- **Impact:** All README code examples now verified against SDK source. Documentation is now fully synchronized with actual SDK implementation. All critical documentation links fixed and verified.
438
-
439
- ## [0.1.27] - 2025-10-30
440
-
441
- ### Initial Release
442
-
443
- A TypeScript SDK for Fluent Commerce API integration with support for Node.js, Deno, and Versori platform.
444
-
445
- ### Features
446
-
447
- **Authentication & Security**
448
- - OAuth2 authentication with automatic token refresh
449
- - Refresh token support (`grant_type=refresh_token` when available)
450
- - Automatic 401 retry with exponential backoff (up to 3 attempts)
451
- - Thread-safe token refresh (prevents duplicate refresh requests)
452
- - Handles clock skew, server-side revocation, and multi-process conflicts
453
- - 60-second expiry buffer prevents mid-flight token expiry
454
- - Webhook signature validation with RSA cryptography
455
-
456
- **Data Ingestion**
457
- - Batch API with Batch Pre-Processing (BPP) for change detection
458
- - Event API for real-time updates
459
- - GraphQL mutations with automatic mapping
460
- - Support for CSV, XML, JSON, and Parquet formats
461
- - Universal field mapping with built-in resolvers
462
-
463
- **Data Extraction**
464
- - GraphQL queries with automatic cursor-based pagination
465
- - ExtractionOrchestrator for high-level extraction workflows
466
- - Path-based extraction for specific data nodes
467
- - Support for reverse pagination (most recent first)
468
-
469
- **Data Sources**
470
- - S3DataSource with streaming and retry logic
471
- - SftpDataSource with connection pooling and retry logic
472
- - Automatic archiving and error handling
473
-
474
- **Parsers**
475
- - CSVParserService with validation
476
- - XMLParserService with path resolution
477
- - JSONParserService with streaming
478
- - ParquetParserService for columnar data
479
-
480
- **Service Layer**
481
- - BatchAPIClient for batch operations
482
- - UniversalMapper for field transformations
483
- - StateService for distributed state management
484
- - JobTracker for job lifecycle tracking
485
- - PartialBatchRecovery for handling partial failures
486
- - PreflightValidator for pre-execution validation
487
-
488
- **Cross-Runtime Support**
489
- - Node.js ≥18.0.0
490
- - Deno runtime
491
- - Versori platform with native integration
492
- - Triple module system (CommonJS, ESM, TypeScript definitions)
493
-
494
- **Documentation**
495
- - 15+ production-ready templates (Versori + standalone)
496
- - Progressive learning guides (ingestion, extraction, mapping)
497
- - Reusable patterns (error handling, orchestrators)
498
- - Complete API reference
499
- - Architecture documentation
500
-
501
- ### Notes
502
-
503
- - **Zero Breaking Changes**: Maintains API stability
504
- - **Optional Features**: Refresh tokens depend on Fluent account configuration
505
- - **Versori Integration**: VersoriConnectionAdapter has native refresh token support
506
- - **Platform Detection**: Automatic environment detection (Node.js, Deno, Versori)
1
+ # Changelog
2
+
3
+ All notable changes to the Fluent Commerce Connect SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.54] - 2026-02-20
9
+
10
+ ### Added - Fluent CLI Profile Integration
11
+ - Added `createClientFromProfile(profileName, options?)` factory function to create a `FluentClient` directly from Fluent CLI profiles stored at `~/.fluentcommerce/`
12
+ - Added `loadFluentProfile(profileName, options?)` to read CLI profile files and return a `FluentClientConfig`
13
+ - Added `listFluentProfiles(options?)` to discover available CLI profiles
14
+ - Added `getFluentProfileInfo(profileName, options?)` to inspect profile metadata without loading credentials
15
+ - Supports full retailer loading chain: `profile.json` -> `retailer.<REF>.json` -> `user.<name>.json`
16
+ - When `options.retailer` is specified, reads the retailer file to get `retailerId` and the retailer-specific user override
17
+ - Ensures correct credentials are loaded for multi-retailer accounts (e.g., different users per retailer)
18
+ - Profile directory resolution: `options.profileDir` > `FLUENT_PROFILE_DIR` env var > `~/.fluentcommerce/`
19
+ - New types exported: `FluentProfileOptions`, `FluentProfileInfo`
20
+ - Skips hidden/internal directories (e.g., `.sessions`) when listing profiles
21
+
22
+ ### Fixed - Fluent CLI Profile Integration Test Stability
23
+ - Unit tests use real temporary filesystem fixtures instead of platform-sensitive path mocks for cross-platform reliability.
24
+
25
+ ### Added - Fluent CLI Profile Integration Documentation
26
+ - README section with usage examples for `createClientFromProfile()` and `listFluentProfiles()`, including multi-retailer behavior.
27
+
28
+ ## [0.1.53] - 2026-02-15
29
+
30
+ ### Fixed - Event API GET Documentation and Typing Alignment
31
+ - Corrected README `getEvents()` documentation for `retailerId` behavior to clarify there is no automatic fallback to client config for query filters.
32
+ - Added explicit README guidance showing quoted dot-notation keys (for example, `'context.rootEntityType'`) when passing Event API GET context filters in JavaScript/TypeScript.
33
+ - Updated `FluentEventLogAttribute.value` type from `string` to `unknown` to match real Event API responses that can include non-string values (for example, numeric timers and nested objects).
34
+ - No runtime behavior changes to existing API methods; this patch aligns published docs/types with current SDK behavior.
35
+
36
+ ## [0.1.52] - 2026-02-15
37
+
38
+ ### Added - Event API Log Query (REST GET Endpoints)
39
+ - Added `getEvents(params)` to `FluentClient` and `FluentVersoriClient` for `GET /api/v4.1/event`
40
+ - Search/query events with comprehensive filtering (entity type, status, date range, etc.)
41
+ - Supports pagination with `start`/`count` parameters (max 5000 per page)
42
+ - Full documentation with JSDoc examples for common use cases
43
+ - Added `getEventById(eventId)` to `FluentClient` and `FluentVersoriClient` for `GET /api/v4.1/event/{eventId}`
44
+ - Retrieve complete event details by unique identifier
45
+ - Returns event metadata, context, attributes, and source event IDs
46
+ - Useful for event tracing and debugging workflows
47
+ - Added typed Event Log models: `FluentEventQueryParams`, `FluentEventLogResponse`, `FluentEventLogItem`, `FluentEventLogContext`, and `FluentEventLogAttribute`
48
+ - Added typed Event constants for query safety: `FluentEventType`, `FluentEventStatus`, `FluentEventCategory`, `FluentEventRootEntityType`, and `FluentEventEntityType`
49
+ - Added unit test coverage for query-string building, empty-filter handling, success parsing, and error paths
50
+ - Updated API docs with `getEvents()` and `getEventById()` usage examples
51
+
52
+ ### Added - Security & Compliance
53
+ - **Security Audit Infrastructure** - Comprehensive security audit tools and scripts
54
+ - `security-audit/security-audit.cjs` - Automated vulnerability scanning
55
+ - `security-audit/safe-fix.cjs` - Safe vulnerability fixing with automatic testing
56
+ - `security-audit/snyk-setup.cjs` - Snyk integration for advanced scanning
57
+ - GitHub Actions workflow for automated security scans
58
+ - Dependabot configuration for automated dependency updates
59
+ - **Security Documentation** - Complete security and compliance guides
60
+ - SOC 2 Compliance Guide
61
+ - Vulnerability Checking Guide
62
+ - Safe Fixing Guide
63
+ - Advanced Scanning Guide (Snyk)
64
+ - Security audit quick start
65
+ - **Security Scripts** - NPM scripts for security management
66
+ - `npm run security:check` - Comprehensive security audit
67
+ - `npm run security:fix` - Safe vulnerability fixing
68
+ - `npm run security:snyk` - Advanced Snyk scanning
69
+ - `npm run security:full` - Full security check (npm audit + Snyk)
70
+
71
+ ### Fixed - Security Vulnerabilities
72
+ - **js-yaml vulnerabilities** (MODERATE) - Updated to secure versions (3.14.2, 4.1.1)
73
+ - **@versori/run** - Updated from 0.4.4 to 0.4.11 (includes security fixes)
74
+ - **markdownlint-cli** (HIGH) - Updated from 0.45.0 to 0.46.0 (fixes glob command injection)
75
+ - **Removed unused dependency** - Removed unused `jose@5.10.0` package
76
+ - **Security Status:** Reduced vulnerabilities from 12 to 3 (75% reduction)
77
+ - Fixed: 2 Critical, 3 High, 4 Moderate, 1 Low
78
+ - Remaining: 3 Moderate (transitive dependencies, no fix available)
79
+
80
+ ## [0.1.51] - 2025-01-12
81
+
82
+ ### Added
83
+
84
+ **GraphQL Partial Response Support**
85
+ - **New error handling mode**: Added `errorHandling: 'partial'` option for `FluentClient.graphql()` and `ExtractionOrchestrator`
86
+ - Allows returning both `data` AND `errors` when GraphQL returns partial responses (GraphQL spec compliant)
87
+ - Default behavior unchanged: `'throw'` mode throws `GraphQLExecutionError` on any errors (backward compatible)
88
+ - Opt-in feature for scenarios where partial data is acceptable (batch operations, analytics, etc.)
89
+ - **Response extensions**: Added `hasPartialData` flag to `GraphQLResponse` interface
90
+ - Set to `true` when response contains both data and errors
91
+ - Only present when `errorHandling: 'partial'` is used and errors occurred
92
+ - **Error accumulation across pagination**: Partial mode accumulates errors from all pages
93
+ - All GraphQL errors collected in `response.errors` array for paginated queries
94
+ - ExtractionOrchestrator includes errors in `stats.partialErrors` field
95
+ - **Null data handling**: ExtractionOrchestrator gracefully handles `data: null` with errors in partial mode
96
+ - Returns empty array `[]` instead of throwing
97
+ - Stops pagination when no data available (cannot determine if more pages exist)
98
+ - Errors still accumulated in `stats.partialErrors`
99
+ - Preserves backward compatibility: throw mode still throws original error messages
100
+
101
+ **Use Cases:**
102
+ - Batch mutations where some items may fail independently
103
+ - Analytics/reporting where partial data is better than no data
104
+ - Extraction workflows where some records may be inaccessible
105
+ - Resilient data pipelines that continue despite errors
106
+
107
+ **Usage Example:**
108
+ ```typescript
109
+ // Partial mode: get both successful and failed results
110
+ const result = await client.graphql({
111
+ query: batchMutation,
112
+ errorHandling: 'partial' // Opt-in
113
+ });
114
+
115
+ if (result.hasPartialData) {
116
+ // Process successful items
117
+ processSuccessful(result.data);
118
+
119
+ // Log or retry failed items
120
+ for (const error of result.errors || []) {
121
+ logger.warn('Failed item:', error.path, error.message);
122
+ }
123
+ }
124
+
125
+ // Default mode (throw): fail fast on any error
126
+ const criticalResult = await client.graphql({
127
+ query: singleMutation
128
+ // errorHandling: 'throw' is default
129
+ });
130
+ ```
131
+
132
+ **Documentation:**
133
+ - Complete guide: `docs/02-CORE-GUIDES/api-reference/modules/api-reference-12-partial-responses.md`
134
+ - Best practices, migration guide, and edge case handling included
135
+ - Integration examples with FluentClient, FluentVersoriClient, and ExtractionOrchestrator
136
+
137
+ **Test Coverage:**
138
+ - 9+ test scenarios in `tests/unit/fluent-client-partial-response.test.ts`
139
+ - 5+ test scenarios in `tests/unit/services/extraction/extraction-orchestrator.test.ts` (including null data edge cases)
140
+ - Edge cases: null data, empty errors array, error extensions, pagination, pagination stop on null data
141
+
142
+ **Backward Compatibility:**
143
+ - No breaking changes
144
+ - Default behavior unchanged ('throw' mode)
145
+ - Existing code continues to work without modifications
146
+
147
+ ## [0.1.48] - 2025-11-19
148
+
149
+ ### ⚠️ IMPORTANT - Share in Slack
150
+
151
+ **Breaking Change in v0.1.47**: If you're using `httpStatus` from EventResponse, you must migrate to `statusCode`.
152
+
153
+ ```typescript
154
+ // ❌ OLD (no longer works)
155
+ const status = response.httpStatus;
156
+
157
+ // NEW (v0.1.47+)
158
+ const status = response.statusCode;
159
+ ```
160
+
161
+ See v0.1.47 changelog below for full details.
162
+
163
+ ### Added
164
+ - **FluentVersoriClient connection validation enhancements** - Improved error handling and connection validation for Versori platform
165
+ - **Event API template documentation** - 8 new templates for S3/SFTP ingestion with CSV, XML, JSON, Parquet formats
166
+ - **Connection validation pattern guide** - New documentation for Versori connection validation patterns
167
+ - **README error classification documentation** - Added comprehensive code examples for `classifyError` and `classifyErrors` functions
168
+
169
+ ### Changed
170
+ - **README updates** - Updated template count from 15+ to 23+, added Error Classification section to Core Services table
171
+ - **Smart Error Handling documentation** - Added note about consistent `statusCode` field across success and error responses
172
+ - **Error handling documentation improvements** - Added links to comprehensive error handling guide and quick reference
173
+
174
+ ### Fixed
175
+ - **FluentVersoriClient improvements** - 206 lines of enhancements for better error handling and connection management
176
+
177
+ ## [0.1.47] - 2025-11-19
178
+
179
+ ### Changed
180
+ - **BREAKING: EventResponse interface standardized on `statusCode`**
181
+ - Removed `httpStatus` field from EventResponse interface
182
+ - HTTP status code is now consistently available as `statusCode` in both success and error responses
183
+ - Success: `response.statusCode` (200, 201, 202)
184
+ - Error: `error.statusCode` (400, 401, 404, 500, etc.)
185
+ - Migration: Replace all `response.httpStatus` with `response.statusCode`
186
+
187
+ ### Fixed
188
+ - **Auth retry tests** - Updated expected error type from FluentAPIError to AuthenticationError after exhausting retries
189
+ - **Test timeouts** - Added proper timeout for retry delay tests
190
+
191
+ ## [0.1.46] - 2025-11-18
192
+
193
+ ### Changed
194
+ - Documentation consolidation for error handling
195
+ - Removed duplicate module files in error-handling docs
196
+ - Added SDK automatic retry behavior clarification
197
+
198
+ ## [0.1.45] - 2025-11-17
199
+
200
+ ### Added
201
+ - **XML Helper Exports** (2025-11-17)
202
+ - `getXmlAttribute` - Extract XML attributes from multiple parser formats (Versori $, SDK @, xml2js)
203
+ - `getXmlTextContent` - Extract XML text content from multiple formats (_, #text, value)
204
+ - `normalizeEmpty` - Normalize empty values (null, undefined, '', whitespace)
205
+ - All three helpers now exported from `@fluentcommerce/fc-connect-sdk`
206
+ - Comprehensive unit tests (19 tests) and inline JSDoc documentation
207
+
208
+ ### Changed
209
+ - **Resolver Helper Improvements** (2025-11-17)
210
+ - SDK resolvers now use `helpers.getXmlTextContent` for XML text extraction
211
+ - Replaces manual format checking (`attr._ || attr['#text'] || attr.value`)
212
+ - Improves consistency across XML parser formats
213
+
214
+ ### Notes
215
+ - These helpers were previously internal-only and are now part of the public API
216
+ - No breaking changes - existing code continues to work
217
+ - Maintains backward compatibility with all existing resolver implementations
218
+
219
+ ## [0.1.43] - 2025-01-14
220
+
221
+ ### Added
222
+
223
+ **GraphQL Error Classification Service** (2025-01-14)
224
+ - **New error classification utilities**: Added `classifyError()` and `classifyErrors()` functions to classify Fluent Commerce GraphQL errors
225
+ - **Retry guidance**: Automatically determines if errors are retryable based on error codes (C/S/T prefix)
226
+ - **User-friendly messages**: Provides actionable error messages and recommended actions
227
+ - **Error code support**: Handles Fluent Commerce error codes (C0121E, S0002E, etc.) with proper classification
228
+ - **Export location**: Available via `import { classifyError, classifyErrors, type ErrorClassification } from '@fluentcommerce/fc-connect-sdk'`
229
+
230
+ **Usage Example:**
231
+ ```typescript
232
+ import { classifyErrors } from '@fluentcommerce/fc-connect-sdk';
233
+
234
+ if (response.errors) {
235
+ const classification = classifyErrors(response.errors);
236
+ if (classification.retryable) {
237
+ // Retry with delay
238
+ await delay(classification.retryDelaySeconds * 1000);
239
+ } else {
240
+ // Show error to user
241
+ console.error(classification.userMessage);
242
+ }
243
+ }
244
+ ```
245
+
246
+ **Error Classification Features:**
247
+ - Categorizes errors as CLIENT_ERROR, SERVER_ERROR, THIRD_PARTY_ERROR, or UNKNOWN
248
+ - Provides retryability guidance (retryable: true/false)
249
+ - Includes recommended action (FIX_AND_RETRY, RETRY_LATER, CONTACT_SUPPORT, VERIFY_PAYLOAD)
250
+ - Suggests retry delay in seconds for retryable errors
251
+ - Extracts error codes from multiple locations (extensions.code, message parsing)
252
+
253
+ ## [0.1.41] - 2025-11-13
254
+
255
+ ### Improved
256
+
257
+ **GraphQLMutationMapper API Consistency** (2025-11-13)
258
+ - **Auto-generates GraphQL query**: `mapWithNodes()` now includes `query` property in result (consistent with `map()` method)
259
+ - **Explicit variables property**: Added `MapWithNodesResult.variables` for direct GraphQL execution
260
+ - `variables` is auto-wrapped in `{ input: ... }` when using fields pattern
261
+ - `data` remains unwrapped for direct field access (`result.data.orderRef`)
262
+ - **Improved constructor options**: Added `MappingOptions` interface
263
+ - `customResolvers` - Pass resolvers via constructor instead of every method call
264
+ - `customTransforms` - Pass custom transforms via constructor
265
+ - Method-level resolvers still supported (takes precedence over constructor resolvers)
266
+ - **Optional resolvers parameter**: `mapWithNodes(sourceData)` - resolvers now optional
267
+ - **Consistent error handling**: Returns structured error result (not throw) with `success: false`
268
+
269
+ **Before (old pattern - removed):**
270
+ ```typescript
271
+ const mapper = new GraphQLMutationMapper(mappingConfig, client, logger);
272
+ const result = await mapper.mapWithNodes(sourceData, customResolvers);
273
+ const query = buildMutationQuery(mappingConfig); // Manual step
274
+ await client.graphql({ query, variables: result.data });
275
+ ```
276
+
277
+ **After (new pattern - consistent with UniversalMapper):**
278
+ ```typescript
279
+ const mapper = new GraphQLMutationMapper(mappingConfig, logger, {
280
+ customResolvers,
281
+ fluentClient: client // Pass client via options
282
+ });
283
+ const result = await mapper.mapWithNodes(sourceData);
284
+ await client.graphql({
285
+ query: result.query, // Auto-generated
286
+ variables: result.variables // Auto-wrapped if fields pattern
287
+ });
288
+ ```
289
+
290
+ **Backward Compatibility:**
291
+ - Existing code using `result.data` continues to work
292
+ - Optional parameters maintain compatibility with existing code
293
+
294
+ ### Fixed
295
+
296
+ **GraphQLMutationMapper Bug Fixes** (2025-11-13)
297
+ - **Empty `arguments: {}` detection**: Fixed `buildMutationQuery()` to treat empty `arguments: {}` as fields pattern
298
+ - Previously, empty `arguments: {}` would not trigger `{ input: ... }` wrapping
299
+ - Now correctly detects and wraps variables when using fields pattern
300
+ - **Type safety**: Updated `MapWithNodesResult` interface with complete type definitions
301
+ - **CRITICAL**: Fixed incorrect Versori credential access pattern in templates
302
+ - Templates incorrectly used `connections.credentials().getAccessToken()` or `ctx.connections.credentials().getAccessToken()`
303
+ - Correct pattern is `ctx.credentials().getAccessToken()`
304
+ - This error caused runtime failures: `Cannot read properties of undefined (reading 'credentials')`
305
+ - Fixed 7 template files across batch-api, graphql-mutations, and extraction workflows
306
+ - Updated inline documentation comments to reflect correct pattern
307
+ - Removed unnecessary `connections` destructuring from context objects
308
+
309
+ ### Removed - OAuth2 Server Functionality
310
+
311
+ **WebhookAuthService OAuth2 Server Methods Removed** (2025-11-06)
312
+ - **BREAKING**: Removed OAuth2 server functionality from `WebhookAuthService`
313
+ - Removed `issueToken()` method - OAuth2 token issuance no longer supported
314
+ - Removed `validateToken()` method - OAuth2 token validation no longer supported
315
+ - Removed `refreshToken()` method - OAuth2 token refresh no longer supported
316
+ - Removed `revokeToken()` method - OAuth2 token revocation no longer supported
317
+ - Removed `WebhookAuthServiceConfig` interface - constructor now only requires logger
318
+ - Removed `jose` dependency - no longer needed for JWT token handling
319
+ - **API Key Authentication**: `WebhookAuthService` now supports API key authentication only
320
+ - `generateApiKey()` - Generate secure API keys
321
+ - `generateApiKeyWithPrefix()` - Generate prefixed API keys
322
+ - `hashApiKey()` - Hash API keys for secure storage
323
+ - `validateApiKey()` - Validate API keys with lookup function
324
+ - **Migration**: Users of OAuth2 server methods should migrate to API key authentication
325
+ - **Note**: OAuth2 **client** authentication (FluentClient authenticating with Fluent Commerce) remains unchanged
326
+
327
+ ## [0.1.39] - 2025-01-14
328
+
329
+ ### Changed
330
+ - **Production Ready Release**: Comprehensive documentation and feature completion
331
+ - Fixed missing bin file (analyze-source-structure.js)
332
+ - Fixed 449 documentation links (97% success rate)
333
+ - Created 52 README files for improved navigation
334
+ - Added 33 module files for complete feature coverage
335
+ - All 7 CLI tools now functional
336
+ - PDF documentation generated
337
+ - Published to npm registry
338
+
339
+ ### Documentation
340
+ - Comprehensive documentation updates across all modules
341
+ - Improved navigation with README files in all directories
342
+ - Complete API reference documentation
343
+ - Updated template examples and guides
344
+ - CLI tool documentation
345
+
346
+ ### Features (Stable)
347
+ - TypeScript SDK for Fluent Commerce integration
348
+ - Multi-runtime support (Node.js ≥18.0.0, Deno, Versori platform)
349
+ - Complete API client with OAuth2 authentication
350
+ - Data sources: S3, SFTP with connection pooling
351
+ - Parsers: CSV, XML, JSON, Parquet
352
+ - Mappers: UniversalMapper, GraphQLMutationMapper
353
+ - Comprehensive test suite (97%+ coverage)
354
+
355
+ ## [0.1.31] - 2025-01-14
356
+
357
+ ### Code Changes
358
+ - None
359
+
360
+ ### Documentation
361
+ - Fixed 32 critical documentation issues across 10 core guide sections
362
+ - Corrected method names, type definitions, and configuration parameters
363
+ - Updated 35+ documentation files with accurate examples
364
+ - Improved overall documentation accuracy to 95%+
365
+
366
+ ## Previous Releases
367
+
368
+ ### Added - Security Enhancements
369
+
370
+ **WebhookAuthService Security Features** (2025-01-XX)
371
+ - **Token Revocation**: Added `revokeToken()` method with optional `revocationStore` configuration
372
+ - Tokens can be revoked before expiry using JTI (JWT ID) blacklist
373
+ - Automatic revocation check in `validateToken()` when revocation store is configured
374
+ - Supports automatic cleanup via TTL (expiresAt)
375
+ - **Rate Limiting**: Added sliding window rate limiting for `issueToken()` endpoint
376
+ - Optional `rateLimitStore` configuration for persistent rate limiting
377
+ - Configurable limits (default: 10 attempts per 60 seconds)
378
+ - Per-username rate limiting to prevent brute force attacks
379
+ - Fail-open behavior on rate limit errors (allows requests if check fails)
380
+ - **Constant-Time Comparison**: Added `constantTimeEqualHex()` function for API key validation
381
+ - Prevents timing attacks on API key validation
382
+ - Automatic timing attack protection in `validateApiKey()` when `useConstantTimeComparison` is enabled
383
+ - **Refresh Token Rotation**: Automatic refresh token rotation on each refresh
384
+ - Old refresh tokens are automatically revoked when new tokens are issued
385
+ - Requires `revocationStore` to be configured for rotation
386
+ - **Token Type Consistency**: Added `type: 'access'` field to access tokens
387
+ - Access tokens now include `type: 'access'` claim
388
+ - Refresh tokens include `type: 'refresh'` claim
389
+ - Improves token type validation and security
390
+
391
+ ### Changed - Security Enhancements
392
+
393
+ **WebhookAuthService API Changes** (2025-01-XX)
394
+ - `validateApiKey()` now accepts optional `options` parameter:
395
+ - `useConstantTimeComparison?: boolean` - Enable timing attack protection (default: true)
396
+ - `compareHashed?: boolean` - If true, keyLookup expects hashed key
397
+ - `WebhookAuthServiceConfig` now supports optional security features:
398
+ - `revocationStore?: { get, set }` - Optional token revocation store
399
+ - `rateLimitStore?: { get, set }` - Optional rate limiting store
400
+ - `rateLimitConfig?: { maxAttempts, windowSeconds }` - Rate limiting configuration
401
+
402
+ ### Testing
403
+
404
+ **Security Test Coverage** (2025-01-XX)
405
+ - Added comprehensive security test suite (500+ lines)
406
+ - Token revocation tests (3 tests)
407
+ - Rate limiting tests (4 tests)
408
+ - Malformed token handling tests (5 tests)
409
+ - Expired token handling tests (2 tests)
410
+ - Token type validation tests (2 tests)
411
+ - API key security tests (2 tests)
412
+ - Refresh token rotation tests (2 tests)
413
+ - Total test coverage: 20+ new security-specific tests
414
+
415
+ ### Documentation
416
+
417
+ **Security Documentation** (2025-01-XX)
418
+ - Added `docs/04-REFERENCE/platforms/versori/webhook-auth-security-considerations.md` - Security best practices guide
419
+ - Updated `README.md` with security features
420
+ - Updated service documentation with security configuration examples
421
+
422
+ ## [0.1.28] - 2025-10-30
423
+
424
+ ### Documentation
425
+
426
+ **README Critical Fixes** (2025-10-30)
427
+ - Fixed missing FluentBatchManager (FBM) in Mermaid architecture diagram
428
+ - Added FBM node to Service Layer subgraph (line 63)
429
+ - Added FBM styling to match other services (line 138)
430
+ - Restored 9 connections referencing FBM
431
+ - **Impact:** Architecture diagram now renders correctly with all services visible
432
+ - Fixed 2 broken links to mapper comparison guide
433
+ - Updated paths from `docs/00-START-HERE/MAPPER-COMPARISON-GUIDE.md` to correct location
434
+ - Correct path: `docs/02-CORE-GUIDES/mapping/mapper-comparison-guide.md`
435
+ - **Impact:** Users can now access critical mapper selection guide
436
+ - Fixed SDK philosophy filename case sensitivity issue
437
+ - Changed from `SDK-PHILOSOPHY.md` (uppercase) to `sdk-philosophy.md` (lowercase)
438
+ - **Impact:** Link now works on case-sensitive filesystems (Linux, macOS)
439
+ - Verified all 24 documentation paths in README
440
+ - All links validated and working
441
+ - Cross-platform compatibility ensured
442
+
443
+ **Previous README Improvements** (2025-10-30)
444
+ - Added Table of Contents for improved navigation
445
+ - Restructured to show Architecture/Services upfront before Quickstart
446
+ - Fixed 2 hallucinated service names throughout README:
447
+ - `BatchAPIClient` → `FluentBatchManager` (correct SDK service name)
448
+ - `IngestionOrchestrator` `IngestionService` (correct SDK service name)
449
+ - Clarified logging approach: Function-based utilities (`createConsoleLogger`, `toStructuredLogger`) for standalone environments
450
+ - Fixed 6 broken documentation links to match new 5-folder structure
451
+ - Added complete S3 CSV Batch API workflow example with real SDK methods
452
+ - Added complete SFTP XML Batch API workflow example with real SDK methods
453
+ - Added Universal Mapping section with XML/JSON transformation examples
454
+ - Fixed architecture diagram with correct service names and relationships
455
+ - Added "Learn More" sections linking to relevant documentation guides
456
+ - Updated code examples to match actual SDK APIs (all examples now verified)
457
+ - Improved "When to Use This SDK" decision table
458
+ - Enhanced authentication section with OAuth2 token refresh details
459
+ - Added Common Pitfalls section with quick fixes
460
+
461
+ **Impact:** All README code examples now verified against SDK source. Documentation is now fully synchronized with actual SDK implementation. All critical documentation links fixed and verified.
462
+
463
+ ## [0.1.27] - 2025-10-30
464
+
465
+ ### Initial Release
466
+
467
+ A TypeScript SDK for Fluent Commerce API integration with support for Node.js, Deno, and Versori platform.
468
+
469
+ ### Features
470
+
471
+ **Authentication & Security**
472
+ - OAuth2 authentication with automatic token refresh
473
+ - Refresh token support (`grant_type=refresh_token` when available)
474
+ - Automatic 401 retry with exponential backoff (up to 3 attempts)
475
+ - Thread-safe token refresh (prevents duplicate refresh requests)
476
+ - Handles clock skew, server-side revocation, and multi-process conflicts
477
+ - 60-second expiry buffer prevents mid-flight token expiry
478
+ - Webhook signature validation with RSA cryptography
479
+
480
+ **Data Ingestion**
481
+ - Batch API with Batch Pre-Processing (BPP) for change detection
482
+ - Event API for real-time updates
483
+ - GraphQL mutations with automatic mapping
484
+ - Support for CSV, XML, JSON, and Parquet formats
485
+ - Universal field mapping with built-in resolvers
486
+
487
+ **Data Extraction**
488
+ - GraphQL queries with automatic cursor-based pagination
489
+ - ExtractionOrchestrator for high-level extraction workflows
490
+ - Path-based extraction for specific data nodes
491
+ - Support for reverse pagination (most recent first)
492
+
493
+ **Data Sources**
494
+ - S3DataSource with streaming and retry logic
495
+ - SftpDataSource with connection pooling and retry logic
496
+ - Automatic archiving and error handling
497
+
498
+ **Parsers**
499
+ - CSVParserService with validation
500
+ - XMLParserService with path resolution
501
+ - JSONParserService with streaming
502
+ - ParquetParserService for columnar data
503
+
504
+ **Service Layer**
505
+ - BatchAPIClient for batch operations
506
+ - UniversalMapper for field transformations
507
+ - StateService for distributed state management
508
+ - JobTracker for job lifecycle tracking
509
+ - PartialBatchRecovery for handling partial failures
510
+ - PreflightValidator for pre-execution validation
511
+
512
+ **Cross-Runtime Support**
513
+ - Node.js ≥18.0.0
514
+ - Deno runtime
515
+ - Versori platform with native integration
516
+ - Triple module system (CommonJS, ESM, TypeScript definitions)
517
+
518
+ **Documentation**
519
+ - 15+ production-ready templates (Versori + standalone)
520
+ - Progressive learning guides (ingestion, extraction, mapping)
521
+ - Reusable patterns (error handling, orchestrators)
522
+ - Complete API reference
523
+ - Architecture documentation
524
+
525
+ ### Notes
526
+
527
+ - **Zero Breaking Changes**: Maintains API stability
528
+ - **Optional Features**: Refresh tokens depend on Fluent account configuration
529
+ - **Versori Integration**: VersoriConnectionAdapter has native refresh token support
530
+ - **Platform Detection**: Automatic environment detection (Node.js, Deno, Versori)