@adobe-commerce/aio-toolkit 1.0.16 → 1.0.17
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 +4 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.17] - 2026-02-25
|
|
9
|
+
|
|
10
|
+
### ✨ Features
|
|
11
|
+
|
|
12
|
+
- **feat(publish-event):** Add optional `eventId` parameter to `PublishEvent.execute()`
|
|
13
|
+
- Allows callers to supply custom event IDs for idempotency, correlation, or tracking
|
|
14
|
+
- Falls back to auto-generated UUID when not provided
|
|
15
|
+
- New signature: `execute(providerId, eventCode, payload, eventId?, subject?)`
|
|
16
|
+
|
|
17
|
+
### ⚠️ Breaking Changes
|
|
18
|
+
|
|
19
|
+
- **BREAKING(publish-event):** Parameter order changed for `PublishEvent.execute()`
|
|
20
|
+
- `subject` has moved from 4th to 5th position
|
|
21
|
+
- When passing subject without custom eventId, use: `execute(providerId, eventCode, payload, undefined, subject)`
|
|
22
|
+
- Previous call: `execute(providerId, eventCode, payload, subject)` → Update to: `execute(providerId, eventCode, payload, undefined, subject)`
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
8
26
|
## [1.0.16] - 2026-02-23
|
|
9
27
|
|
|
10
28
|
### ✨ Features
|
package/README.md
CHANGED
|
@@ -171,12 +171,13 @@ const result = await publishEvent.execute(
|
|
|
171
171
|
customerId: 'CUST-789',
|
|
172
172
|
amount: 199.99,
|
|
173
173
|
currency: 'USD'
|
|
174
|
-
}
|
|
174
|
+
},
|
|
175
|
+
'eventId'
|
|
175
176
|
);
|
|
176
177
|
|
|
177
178
|
console.log(`Event published: ${result.eventId}, Status: ${result.status}`);
|
|
178
179
|
|
|
179
|
-
// Publish an event with subject
|
|
180
|
+
// Publish an event with subject (eventId is optional; pass undefined to use auto-generated ID)
|
|
180
181
|
const orderResult = await publishEvent.execute(
|
|
181
182
|
'commerce-provider',
|
|
182
183
|
'com.adobe.commerce.order.shipped',
|
|
@@ -186,6 +187,7 @@ const orderResult = await publishEvent.execute(
|
|
|
186
187
|
carrier: 'UPS',
|
|
187
188
|
estimatedDelivery: '2023-12-05T18:00:00Z'
|
|
188
189
|
},
|
|
190
|
+
undefined,
|
|
189
191
|
'orders/ORD-123456'
|
|
190
192
|
);
|
|
191
193
|
|
package/dist/index.d.mts
CHANGED
|
@@ -220,7 +220,7 @@ declare class PublishEvent {
|
|
|
220
220
|
private readonly accessToken;
|
|
221
221
|
private readonly customLogger;
|
|
222
222
|
constructor(imsOrgId: string, apiKey: string, accessToken: string, logger?: any);
|
|
223
|
-
execute(providerId: string, eventCode: string, payload: any, subject?: string): Promise<PublishEventResult>;
|
|
223
|
+
execute(providerId: string, eventCode: string, payload: any, eventId?: string, subject?: string): Promise<PublishEventResult>;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
declare enum WebhookActionOperation {
|
package/dist/index.d.ts
CHANGED
|
@@ -220,7 +220,7 @@ declare class PublishEvent {
|
|
|
220
220
|
private readonly accessToken;
|
|
221
221
|
private readonly customLogger;
|
|
222
222
|
constructor(imsOrgId: string, apiKey: string, accessToken: string, logger?: any);
|
|
223
|
-
execute(providerId: string, eventCode: string, payload: any, subject?: string): Promise<PublishEventResult>;
|
|
223
|
+
execute(providerId: string, eventCode: string, payload: any, eventId?: string, subject?: string): Promise<PublishEventResult>;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
declare enum WebhookActionOperation {
|
package/dist/index.js
CHANGED
|
@@ -3034,12 +3034,13 @@ var _PublishEvent = class _PublishEvent {
|
|
|
3034
3034
|
* @param providerId - The Adobe I/O Events provider ID
|
|
3035
3035
|
* @param eventCode - The event type identifier (e.g., 'commerce.order.created')
|
|
3036
3036
|
* @param payload - The event payload data
|
|
3037
|
+
* @param eventId - Optional custom event ID; if not provided, a UUID will be generated
|
|
3037
3038
|
* @param subject - Optional subject for the event
|
|
3038
3039
|
* @returns Promise<PublishEventResult> - The publish result
|
|
3039
3040
|
*
|
|
3040
3041
|
* @throws Error when providerId or eventCode is invalid or publishing fails
|
|
3041
3042
|
*/
|
|
3042
|
-
async execute(providerId, eventCode, payload, subject) {
|
|
3043
|
+
async execute(providerId, eventCode, payload, eventId, subject) {
|
|
3043
3044
|
try {
|
|
3044
3045
|
if (!providerId?.trim()) {
|
|
3045
3046
|
throw new Error("providerId is required and cannot be empty");
|
|
@@ -3051,7 +3052,7 @@ var _PublishEvent = class _PublishEvent {
|
|
|
3051
3052
|
throw new Error("payload is required");
|
|
3052
3053
|
}
|
|
3053
3054
|
this.customLogger.info(`Publishing event to provider: ${providerId}`);
|
|
3054
|
-
|
|
3055
|
+
eventId = eventId ?? (0, import_uuid.v4)();
|
|
3055
3056
|
const cloudEvent = new import_cloudevents.CloudEvent({
|
|
3056
3057
|
id: eventId,
|
|
3057
3058
|
source: `urn:uuid:${providerId}`,
|