@adobe-commerce/aio-toolkit 1.0.6 → 1.0.7
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 +58 -0
- package/README.md +58 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,64 @@ 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.7] - 2025-11-12
|
|
9
|
+
|
|
10
|
+
### 🚀 PaaS Support for Adobe Commerce Event Subscriptions
|
|
11
|
+
|
|
12
|
+
This release adds comprehensive support for Adobe Commerce PaaS (Platform as a Service) instances with native event handling, allowing seamless integration with cloud-based Adobe Commerce deployments.
|
|
13
|
+
|
|
14
|
+
#### 🛍️ Commerce Integration Enhancements
|
|
15
|
+
|
|
16
|
+
- **OnboardCommerce** `[Enhanced]` - Added PaaS instance support
|
|
17
|
+
- New `isPaaS` constructor parameter (defaults to `false`)
|
|
18
|
+
- Automatic handling of native Adobe Commerce events (`observer.*`, `plugin.*`)
|
|
19
|
+
- Skip supported events validation for PaaS instances to improve performance
|
|
20
|
+
- Omits `parent` field for PaaS events to prevent invalid alias errors
|
|
21
|
+
- Ensures `rules` array exists in event payloads (required by Adobe Commerce API)
|
|
22
|
+
- Displays post-subscription instructions for PaaS instances with Magento CLI commands
|
|
23
|
+
- Full backward compatibility - existing code continues to work without changes
|
|
24
|
+
- Enhanced logging with `[SKIP]` and `[IMPORTANT]` prefixes for PaaS workflows
|
|
25
|
+
- 100% test coverage with comprehensive PaaS-specific test cases
|
|
26
|
+
|
|
27
|
+
#### 📝 Post-Subscription Instructions for PaaS
|
|
28
|
+
|
|
29
|
+
When `isPaaS` is enabled, the system automatically logs important post-subscription steps:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
[IMPORTANT] ⚠️ Post-Subscription Steps for PaaS:
|
|
33
|
+
[IMPORTANT] 1. Run: bin/magento events:generate:module to generate module after successful event subscription
|
|
34
|
+
[IMPORTANT] 2. Run: bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento cache:flush to install the generated module
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### 🔧 Technical Improvements
|
|
38
|
+
|
|
39
|
+
- Enhanced event payload preparation logic to support native PaaS events
|
|
40
|
+
- Improved validation workflow with conditional supported events check
|
|
41
|
+
- Added rules array initialization for API compliance
|
|
42
|
+
- Comprehensive test coverage for all PaaS-related functionality
|
|
43
|
+
|
|
44
|
+
#### 📚 Usage Example
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { OnboardCommerce } from '@adobe-commerce/aio-toolkit';
|
|
48
|
+
|
|
49
|
+
// For PaaS instances
|
|
50
|
+
const onboardCommerce = new OnboardCommerce(
|
|
51
|
+
adobeCommerceClient,
|
|
52
|
+
merchantId,
|
|
53
|
+
environmentId,
|
|
54
|
+
logger,
|
|
55
|
+
true // Enable PaaS mode
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// PaaS mode automatically:
|
|
59
|
+
// - Skips supported events validation
|
|
60
|
+
// - Handles native events (observer.*, plugin.*)
|
|
61
|
+
// - Displays post-subscription CLI commands
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
8
66
|
## [1.0.6] - 2025-11-11
|
|
9
67
|
|
|
10
68
|
### 🚀 New Integration Module & API Enhancements
|
package/README.md
CHANGED
|
@@ -752,7 +752,8 @@ const onboardCommerce = new OnboardCommerce(
|
|
|
752
752
|
adobeCommerceClient,
|
|
753
753
|
process.env.COMMERCE_ADOBE_IO_EVENTS_MERCHANT_ID || '',
|
|
754
754
|
process.env.COMMERCE_ADOBE_IO_EVENTS_ENVIRONMENT_ID || '',
|
|
755
|
-
logger
|
|
755
|
+
logger,
|
|
756
|
+
false // isPaaS: set to true for PaaS instances (defaults to false)
|
|
756
757
|
);
|
|
757
758
|
|
|
758
759
|
// Define commerce provider
|
|
@@ -815,11 +816,66 @@ if (result.success) {
|
|
|
815
816
|
- Automated provider configuration with validation
|
|
816
817
|
- Event subscription management with duplicate detection
|
|
817
818
|
- Intelligent event metadata validation against supported Commerce events
|
|
818
|
-
-
|
|
819
|
+
- **PaaS support** for Adobe Commerce Cloud instances with native event handling
|
|
820
|
+
- Structured logging with prefixes: `[START]`, `[CREATE]`, `[SKIP]`, `[ERROR]`, `[IMPORTANT]`
|
|
819
821
|
- Comprehensive summary reporting with event subscription statistics
|
|
820
822
|
- Integration with Adobe Commerce API for event discovery
|
|
823
|
+
- Automatic post-subscription CLI instructions for PaaS instances
|
|
821
824
|
- 100% test coverage
|
|
822
825
|
|
|
826
|
+
**PaaS Support:**
|
|
827
|
+
|
|
828
|
+
For Adobe Commerce PaaS (Platform as a Service) instances, enable PaaS mode to support native events:
|
|
829
|
+
|
|
830
|
+
```typescript
|
|
831
|
+
// Initialize OnboardCommerce for PaaS instances
|
|
832
|
+
const onboardCommercePaaS = new OnboardCommerce(
|
|
833
|
+
adobeCommerceClient,
|
|
834
|
+
merchantId,
|
|
835
|
+
environmentId,
|
|
836
|
+
logger,
|
|
837
|
+
true // Enable PaaS mode
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
// Define native PaaS events (observer.*, plugin.*)
|
|
841
|
+
const paasEventsConfig = [
|
|
842
|
+
{
|
|
843
|
+
event: {
|
|
844
|
+
name: 'observer.catalog_product_save_after',
|
|
845
|
+
label: 'Product Saved',
|
|
846
|
+
description: 'Native observer event'
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
event: {
|
|
851
|
+
name: 'plugin.magento.catalog.model.product.save',
|
|
852
|
+
label: 'Product Save Plugin',
|
|
853
|
+
description: 'Native plugin event'
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
];
|
|
857
|
+
|
|
858
|
+
// Process PaaS events
|
|
859
|
+
const result = await onboardCommercePaaS.process(
|
|
860
|
+
commerceProvider.raw,
|
|
861
|
+
workspaceConfig,
|
|
862
|
+
paasEventsConfig
|
|
863
|
+
);
|
|
864
|
+
|
|
865
|
+
// PaaS mode automatically:
|
|
866
|
+
// - Skips supported events validation for better performance
|
|
867
|
+
// - Handles native events without the 'parent' field
|
|
868
|
+
// - Displays post-subscription Magento CLI commands
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
After successful event subscription on PaaS, the system displays:
|
|
872
|
+
|
|
873
|
+
```
|
|
874
|
+
[IMPORTANT] ⚠️ Post-Subscription Steps for PaaS:
|
|
875
|
+
[IMPORTANT] 1. Run: bin/magento events:generate:module to generate module after successful event subscription
|
|
876
|
+
[IMPORTANT] 2. Run: bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento cache:flush to install the generated module
|
|
877
|
+
```
|
|
878
|
+
|
|
823
879
|
### 🎨 Experience Components
|
|
824
880
|
|
|
825
881
|
**Adobe Commerce Admin UI extension and user experience tools**
|
package/dist/index.d.mts
CHANGED
|
@@ -611,7 +611,8 @@ declare class OnboardCommerce {
|
|
|
611
611
|
private readonly configureProvider;
|
|
612
612
|
private readonly eventSubscriptionService;
|
|
613
613
|
private readonly eventService;
|
|
614
|
-
|
|
614
|
+
private readonly isPaaS;
|
|
615
|
+
constructor(adobeCommerceClient: AdobeCommerceClient, merchantId: string, environmentId: string, logger?: any, isPaaS?: boolean);
|
|
615
616
|
process(provider: Provider, workspaceConfig: WorkspaceConfig, commerceEventsConfig?: CommerceEventConfig[]): Promise<any>;
|
|
616
617
|
private filterEventsBySubscriptionStatus;
|
|
617
618
|
private prepareEventPayload;
|
package/dist/index.d.ts
CHANGED
|
@@ -611,7 +611,8 @@ declare class OnboardCommerce {
|
|
|
611
611
|
private readonly configureProvider;
|
|
612
612
|
private readonly eventSubscriptionService;
|
|
613
613
|
private readonly eventService;
|
|
614
|
-
|
|
614
|
+
private readonly isPaaS;
|
|
615
|
+
constructor(adobeCommerceClient: AdobeCommerceClient, merchantId: string, environmentId: string, logger?: any, isPaaS?: boolean);
|
|
615
616
|
process(provider: Provider, workspaceConfig: WorkspaceConfig, commerceEventsConfig?: CommerceEventConfig[]): Promise<any>;
|
|
616
617
|
private filterEventsBySubscriptionStatus;
|
|
617
618
|
private prepareEventPayload;
|
package/dist/index.js
CHANGED
|
@@ -5619,6 +5619,7 @@ var _OnboardCommerce = class _OnboardCommerce {
|
|
|
5619
5619
|
* @param merchantId - Merchant ID for Adobe Commerce
|
|
5620
5620
|
* @param environmentId - Environment ID for Adobe Commerce
|
|
5621
5621
|
* @param logger - Optional logger instance for logging operations
|
|
5622
|
+
* @param isPaaS - Flag to indicate if the Commerce instance is PaaS (defaults to false)
|
|
5622
5623
|
* @throws {Error} When required parameters are missing or invalid
|
|
5623
5624
|
* @example
|
|
5624
5625
|
* ```typescript
|
|
@@ -5631,7 +5632,7 @@ var _OnboardCommerce = class _OnboardCommerce {
|
|
|
5631
5632
|
* );
|
|
5632
5633
|
* ```
|
|
5633
5634
|
*/
|
|
5634
|
-
constructor(adobeCommerceClient, merchantId, environmentId, logger = null) {
|
|
5635
|
+
constructor(adobeCommerceClient, merchantId, environmentId, logger = null, isPaaS = false) {
|
|
5635
5636
|
if (!adobeCommerceClient) {
|
|
5636
5637
|
throw new Error("Adobe Commerce client is required");
|
|
5637
5638
|
}
|
|
@@ -5644,6 +5645,7 @@ var _OnboardCommerce = class _OnboardCommerce {
|
|
|
5644
5645
|
this.adobeCommerceClient = adobeCommerceClient;
|
|
5645
5646
|
this.merchantId = merchantId;
|
|
5646
5647
|
this.environmentId = environmentId;
|
|
5648
|
+
this.isPaaS = isPaaS;
|
|
5647
5649
|
this.customLogger = new custom_logger_default(logger);
|
|
5648
5650
|
this.configureProvider = new configure_provider_default(
|
|
5649
5651
|
adobeCommerceClient,
|
|
@@ -5700,16 +5702,22 @@ var _OnboardCommerce = class _OnboardCommerce {
|
|
|
5700
5702
|
`[FETCH] Retrieved ${existingSubscriptions.length} existing event subscription(s)`
|
|
5701
5703
|
);
|
|
5702
5704
|
}
|
|
5703
|
-
this.customLogger.debug("[FETCH] Fetching supported events list...");
|
|
5704
|
-
const supportedEventsResult = await this.eventService.supportedList();
|
|
5705
5705
|
let supportedEvents = [];
|
|
5706
|
-
if (!
|
|
5707
|
-
this.customLogger.
|
|
5708
|
-
|
|
5709
|
-
)
|
|
5706
|
+
if (!this.isPaaS) {
|
|
5707
|
+
this.customLogger.debug("[FETCH] Fetching supported events list...");
|
|
5708
|
+
const supportedEventsResult = await this.eventService.supportedList();
|
|
5709
|
+
if (!supportedEventsResult.success) {
|
|
5710
|
+
this.customLogger.error(
|
|
5711
|
+
`[ERROR] Failed to fetch supported events: ${supportedEventsResult.error}`
|
|
5712
|
+
);
|
|
5713
|
+
} else {
|
|
5714
|
+
supportedEvents = Array.isArray(supportedEventsResult.data) ? supportedEventsResult.data : [];
|
|
5715
|
+
this.customLogger.debug(
|
|
5716
|
+
`[FETCH] Retrieved ${supportedEvents.length} supported event(s)`
|
|
5717
|
+
);
|
|
5718
|
+
}
|
|
5710
5719
|
} else {
|
|
5711
|
-
|
|
5712
|
-
this.customLogger.debug(`[FETCH] Retrieved ${supportedEvents.length} supported event(s)`);
|
|
5720
|
+
this.customLogger.debug("[SKIP] Skipping supported events validation for PaaS instance");
|
|
5713
5721
|
}
|
|
5714
5722
|
const { alreadySubscribed, needsSubscription, unsupported } = this.filterEventsBySubscriptionStatus(
|
|
5715
5723
|
commerceEventsConfig,
|
|
@@ -5752,6 +5760,15 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
|
|
|
5752
5760
|
}
|
|
5753
5761
|
}
|
|
5754
5762
|
this.logEventSubscriptionSummary(result, provider.label);
|
|
5763
|
+
if (this.isPaaS) {
|
|
5764
|
+
this.customLogger.info("[IMPORTANT] \u26A0\uFE0F Post-Subscription Steps for PaaS:");
|
|
5765
|
+
this.customLogger.info(
|
|
5766
|
+
"[IMPORTANT] 1. Run: bin/magento events:generate:module to generate module after successful event subscription"
|
|
5767
|
+
);
|
|
5768
|
+
this.customLogger.info(
|
|
5769
|
+
"[IMPORTANT] 2. Run: bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento cache:flush to install the generated module"
|
|
5770
|
+
);
|
|
5771
|
+
}
|
|
5755
5772
|
}
|
|
5756
5773
|
return {
|
|
5757
5774
|
success: true,
|
|
@@ -5809,6 +5826,10 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
|
|
|
5809
5826
|
/**
|
|
5810
5827
|
* Prepares event payload by transforming event names and adding provider information
|
|
5811
5828
|
*
|
|
5829
|
+
* For PaaS instances, the parent field is omitted to support native events (observer.*, plugin.*)
|
|
5830
|
+
* which would be rejected by Adobe Commerce as invalid aliases if parent is set to the same name.
|
|
5831
|
+
* For non-PaaS instances, the parent field is set to the event name as usual.
|
|
5832
|
+
*
|
|
5812
5833
|
* @param eventSpec - Event specification object containing event details
|
|
5813
5834
|
* @param providerId - Provider ID to assign to the event
|
|
5814
5835
|
* @returns Modified event specification with updated event properties
|
|
@@ -5825,12 +5846,18 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
|
|
|
5825
5846
|
throw new Error("Valid provider ID is required");
|
|
5826
5847
|
}
|
|
5827
5848
|
const modifiedEventSpec = JSON.parse(JSON.stringify(eventSpec));
|
|
5828
|
-
|
|
5849
|
+
const eventName = modifiedEventSpec.event.name;
|
|
5850
|
+
if (!this.isPaaS) {
|
|
5851
|
+
modifiedEventSpec.event.parent = eventName;
|
|
5852
|
+
}
|
|
5829
5853
|
modifiedEventSpec.event.provider_id = providerId;
|
|
5830
5854
|
modifiedEventSpec.event.destination = "default";
|
|
5831
5855
|
modifiedEventSpec.event.provider_id = providerId;
|
|
5832
5856
|
modifiedEventSpec.event.priority = true;
|
|
5833
5857
|
modifiedEventSpec.event.hipaa_audit_required = false;
|
|
5858
|
+
if (!modifiedEventSpec.event.rules) {
|
|
5859
|
+
modifiedEventSpec.event.rules = [];
|
|
5860
|
+
}
|
|
5834
5861
|
return modifiedEventSpec;
|
|
5835
5862
|
}
|
|
5836
5863
|
/**
|