@adobe-commerce/aio-toolkit 1.0.15 → 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/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
- const eventId = (0, import_uuid.v4)();
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}`,