@adobe-commerce/aio-toolkit 1.0.6 → 1.0.8

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 CHANGED
@@ -5,6 +5,111 @@ 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.8] - 2025-11-18
9
+
10
+ ### 🔒 Security Fixes
11
+
12
+ - **OnboardCommerce & OnboardEvents** `[Security]` - Removed sensitive payload logging (#94)
13
+ - Eliminated all sensitive data exposure in debug logs across onboarding components
14
+ - Modified `OnboardCommerce.subscribeToEvents()` to log only event names instead of full payloads
15
+ - Updated `ConfigureProvider` to log only provider/merchant IDs instead of complete configuration objects
16
+ - Changed `CreateRegistrations` to log only registration names instead of input payloads
17
+ - Modified `CreateProviders` to log only provider labels instead of full input data
18
+ - Prevents exposure of API keys, access tokens, client secrets, and merchant credentials
19
+ - Reduces security risks in console output, CI/CD logs, and debug sessions
20
+ - Maintains useful debugging context while protecting sensitive information
21
+ - 100% test coverage maintained
22
+
23
+ ### 🐛 Bug Fixes
24
+
25
+ - **FileRepository** `[Fixed]` - Preserve file timestamps in save() method (#93)
26
+ - Fixed `save()` method to preserve `createdAt` timestamp when updating existing files
27
+ - Removed unnecessary `filesLib.delete()` call that was resetting file creation timestamp
28
+ - Now relies on `filesLib.write()` to overwrite content while preserving file metadata
29
+ - Applies to both merge mode (default) and overwrite mode (`overwrite=true`)
30
+ - File system's native `createdAt` timestamp is now correctly maintained across updates
31
+ - Updated tests to verify `delete` is never called in either mode
32
+ - 100% test coverage maintained
33
+
34
+ ### ✨ Enhancements
35
+
36
+ - **GitHub Issue Templates** `[Enhanced]` - Updated with comprehensive component list (#95)
37
+ - Added 32+ components organized by category across all three issue templates
38
+ - New category headers: Commerce, Integration, Framework, I/O Events, Experience, Other
39
+ - Added missing components:
40
+ - Commerce: BasicAuthConnection, Oauth1aConnection, ImsConnection, GenerateBasicAuthToken, ShippingCarrierMethod, ShippingCarrierResponse
41
+ - Integration: CreateEvents, CreateRegistrations, OnboardCommerce
42
+ - Framework: RuntimeActionResponse, WebhookAction, WebhookActionResponse, ImsToken, RuntimeApiGatewayService, Parameters/Validator
43
+ - I/O Events: EventMetadataManager, ProviderManager, RegistrationManager
44
+ - Experience: AdminUiSdk
45
+ - Improved user experience with visual category separation in dropdowns
46
+ - Better issue triaging and component-level tracking for maintainers
47
+ - All templates (bug_report.yml, feature_request.yml, question.yml) updated consistently
48
+
49
+ ### 📊 Statistics
50
+
51
+ - **Total Components**: 32+ selectable options across 5 categories
52
+ - **Test Coverage**: 100% maintained (1679 tests passing)
53
+ - **Files Changed**: 7 files across 3 PRs
54
+
55
+ ## [1.0.7] - 2025-11-12
56
+
57
+ ### 🚀 PaaS Support for Adobe Commerce Event Subscriptions
58
+
59
+ 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.
60
+
61
+ #### 🛍️ Commerce Integration Enhancements
62
+
63
+ - **OnboardCommerce** `[Enhanced]` - Added PaaS instance support
64
+ - New `isPaaS` constructor parameter (defaults to `false`)
65
+ - Automatic handling of native Adobe Commerce events (`observer.*`, `plugin.*`)
66
+ - Skip supported events validation for PaaS instances to improve performance
67
+ - Omits `parent` field for PaaS events to prevent invalid alias errors
68
+ - Ensures `rules` array exists in event payloads (required by Adobe Commerce API)
69
+ - Displays post-subscription instructions for PaaS instances with Magento CLI commands
70
+ - Full backward compatibility - existing code continues to work without changes
71
+ - Enhanced logging with `[SKIP]` and `[IMPORTANT]` prefixes for PaaS workflows
72
+ - 100% test coverage with comprehensive PaaS-specific test cases
73
+
74
+ #### 📝 Post-Subscription Instructions for PaaS
75
+
76
+ When `isPaaS` is enabled, the system automatically logs important post-subscription steps:
77
+
78
+ ```
79
+ [IMPORTANT] ⚠️ Post-Subscription Steps for PaaS:
80
+ [IMPORTANT] 1. Run: bin/magento events:generate:module to generate module after successful event subscription
81
+ [IMPORTANT] 2. Run: bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento cache:flush to install the generated module
82
+ ```
83
+
84
+ #### 🔧 Technical Improvements
85
+
86
+ - Enhanced event payload preparation logic to support native PaaS events
87
+ - Improved validation workflow with conditional supported events check
88
+ - Added rules array initialization for API compliance
89
+ - Comprehensive test coverage for all PaaS-related functionality
90
+
91
+ #### 📚 Usage Example
92
+
93
+ ```typescript
94
+ import { OnboardCommerce } from '@adobe-commerce/aio-toolkit';
95
+
96
+ // For PaaS instances
97
+ const onboardCommerce = new OnboardCommerce(
98
+ adobeCommerceClient,
99
+ merchantId,
100
+ environmentId,
101
+ logger,
102
+ true // Enable PaaS mode
103
+ );
104
+
105
+ // PaaS mode automatically:
106
+ // - Skips supported events validation
107
+ // - Handles native events (observer.*, plugin.*)
108
+ // - Displays post-subscription CLI commands
109
+ ```
110
+
111
+ ---
112
+
8
113
  ## [1.0.6] - 2025-11-11
9
114
 
10
115
  ### 🚀 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
- - Structured logging with prefixes: `[START]`, `[CREATE]`, `[SKIP]`, `[ERROR]`
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
- constructor(adobeCommerceClient: AdobeCommerceClient, merchantId: string, environmentId: string, logger?: any);
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
- constructor(adobeCommerceClient: AdobeCommerceClient, merchantId: string, environmentId: string, logger?: any);
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
@@ -553,7 +553,6 @@ var _FileRepository = class _FileRepository {
553
553
  const existingData = JSON.parse(buffer.toString());
554
554
  payload = { ...existingData, ...payload };
555
555
  }
556
- await filesLib.delete(filepath);
557
556
  } else {
558
557
  payload = {
559
558
  id: fileId,
@@ -4434,9 +4433,7 @@ var _CreateProviders = class _CreateProviders {
4434
4433
  }
4435
4434
  try {
4436
4435
  const providerInput = this.preparePayload(providerData, enhancedLabel);
4437
- this.logger.debug(
4438
- `[NEW] Creating new provider with payload: ${JSON.stringify(providerInput)}`
4439
- );
4436
+ this.logger.debug(`[NEW] Creating new provider: ${enhancedLabel}`);
4440
4437
  const createdProvider = await this.getProviderManager().create(providerInput);
4441
4438
  this.logger.debug(
4442
4439
  `[INFO] Provider created successfully! ID: ${createdProvider.id}, Instance ID: ${createdProvider.instance_id}`
@@ -4955,7 +4952,7 @@ var _CreateRegistrations = class _CreateRegistrations {
4955
4952
  registrationName,
4956
4953
  firstEvent
4957
4954
  );
4958
- this.logger.debug(`[INFO] Registration input: ${JSON.stringify(registrationInput, null, 2)}`);
4955
+ this.logger.debug(`[INFO] Creating registration: ${registrationName}`);
4959
4956
  const registrationSDK = this.getRegistrationManager();
4960
4957
  const createdRegistration = await registrationSDK.create(registrationInput);
4961
4958
  this.logger.debug("[SUCCESS] Registration created successfully!");
@@ -5518,10 +5515,7 @@ var _ConfigureProvider = class _ConfigureProvider {
5518
5515
  description: provider.description,
5519
5516
  workspace_configuration: JSON.stringify(workspaceConfig)
5520
5517
  };
5521
- this.customLogger.debug(
5522
- `[DEBUG] Creating event provider:
5523
- ${JSON.stringify(providerData, null, 2)}`
5524
- );
5518
+ this.customLogger.debug(`[DEBUG] Creating event provider: ${provider.label} (${provider.id})`);
5525
5519
  const createResult = await this.eventProviderService.create(providerData);
5526
5520
  if (!createResult.success) {
5527
5521
  const errorMsg = `Failed to create event provider: ${createResult.error}`;
@@ -5559,8 +5553,7 @@ ${JSON.stringify(providerData, null, 2)}`
5559
5553
  workspace_configuration: JSON.stringify(workspaceConfig)
5560
5554
  };
5561
5555
  this.customLogger.debug(
5562
- `[DEBUG] Updating configuration with payload:
5563
- ${JSON.stringify(updateConfigPayload, null, 2)}`
5556
+ `[DEBUG] Updating workspace configuration for merchant: ${this.merchantId}`
5564
5557
  );
5565
5558
  const updateResult = await this.eventConfigurationService.update(updateConfigPayload);
5566
5559
  if (!updateResult.success) {
@@ -5619,6 +5612,7 @@ var _OnboardCommerce = class _OnboardCommerce {
5619
5612
  * @param merchantId - Merchant ID for Adobe Commerce
5620
5613
  * @param environmentId - Environment ID for Adobe Commerce
5621
5614
  * @param logger - Optional logger instance for logging operations
5615
+ * @param isPaaS - Flag to indicate if the Commerce instance is PaaS (defaults to false)
5622
5616
  * @throws {Error} When required parameters are missing or invalid
5623
5617
  * @example
5624
5618
  * ```typescript
@@ -5631,7 +5625,7 @@ var _OnboardCommerce = class _OnboardCommerce {
5631
5625
  * );
5632
5626
  * ```
5633
5627
  */
5634
- constructor(adobeCommerceClient, merchantId, environmentId, logger = null) {
5628
+ constructor(adobeCommerceClient, merchantId, environmentId, logger = null, isPaaS = false) {
5635
5629
  if (!adobeCommerceClient) {
5636
5630
  throw new Error("Adobe Commerce client is required");
5637
5631
  }
@@ -5644,6 +5638,7 @@ var _OnboardCommerce = class _OnboardCommerce {
5644
5638
  this.adobeCommerceClient = adobeCommerceClient;
5645
5639
  this.merchantId = merchantId;
5646
5640
  this.environmentId = environmentId;
5641
+ this.isPaaS = isPaaS;
5647
5642
  this.customLogger = new custom_logger_default(logger);
5648
5643
  this.configureProvider = new configure_provider_default(
5649
5644
  adobeCommerceClient,
@@ -5700,16 +5695,22 @@ var _OnboardCommerce = class _OnboardCommerce {
5700
5695
  `[FETCH] Retrieved ${existingSubscriptions.length} existing event subscription(s)`
5701
5696
  );
5702
5697
  }
5703
- this.customLogger.debug("[FETCH] Fetching supported events list...");
5704
- const supportedEventsResult = await this.eventService.supportedList();
5705
5698
  let supportedEvents = [];
5706
- if (!supportedEventsResult.success) {
5707
- this.customLogger.error(
5708
- `[ERROR] Failed to fetch supported events: ${supportedEventsResult.error}`
5709
- );
5699
+ if (!this.isPaaS) {
5700
+ this.customLogger.debug("[FETCH] Fetching supported events list...");
5701
+ const supportedEventsResult = await this.eventService.supportedList();
5702
+ if (!supportedEventsResult.success) {
5703
+ this.customLogger.error(
5704
+ `[ERROR] Failed to fetch supported events: ${supportedEventsResult.error}`
5705
+ );
5706
+ } else {
5707
+ supportedEvents = Array.isArray(supportedEventsResult.data) ? supportedEventsResult.data : [];
5708
+ this.customLogger.debug(
5709
+ `[FETCH] Retrieved ${supportedEvents.length} supported event(s)`
5710
+ );
5711
+ }
5710
5712
  } else {
5711
- supportedEvents = Array.isArray(supportedEventsResult.data) ? supportedEventsResult.data : [];
5712
- this.customLogger.debug(`[FETCH] Retrieved ${supportedEvents.length} supported event(s)`);
5713
+ this.customLogger.debug("[SKIP] Skipping supported events validation for PaaS instance");
5713
5714
  }
5714
5715
  const { alreadySubscribed, needsSubscription, unsupported } = this.filterEventsBySubscriptionStatus(
5715
5716
  commerceEventsConfig,
@@ -5727,10 +5728,7 @@ var _OnboardCommerce = class _OnboardCommerce {
5727
5728
  for (const commerceEvent of needsSubscription) {
5728
5729
  try {
5729
5730
  const preparedEvent = this.prepareEventPayload(commerceEvent, provider.id);
5730
- this.customLogger.debug(
5731
- `[DEBUG] Subscribing to event with payload:
5732
- ${JSON.stringify(preparedEvent.event, null, 2)}`
5733
- );
5731
+ this.customLogger.debug(`[DEBUG] Subscribing to event: ${commerceEvent.event.name}`);
5734
5732
  const eventSubscribeResult = await this.eventSubscriptionService.create(
5735
5733
  preparedEvent.event
5736
5734
  );
@@ -5752,6 +5750,15 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
5752
5750
  }
5753
5751
  }
5754
5752
  this.logEventSubscriptionSummary(result, provider.label);
5753
+ if (this.isPaaS) {
5754
+ this.customLogger.info("[IMPORTANT] \u26A0\uFE0F Post-Subscription Steps for PaaS:");
5755
+ this.customLogger.info(
5756
+ "[IMPORTANT] 1. Run: bin/magento events:generate:module to generate module after successful event subscription"
5757
+ );
5758
+ this.customLogger.info(
5759
+ "[IMPORTANT] 2. Run: bin/magento setup:upgrade && bin/magento setup:di:compile && bin/magento cache:flush to install the generated module"
5760
+ );
5761
+ }
5755
5762
  }
5756
5763
  return {
5757
5764
  success: true,
@@ -5809,6 +5816,10 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
5809
5816
  /**
5810
5817
  * Prepares event payload by transforming event names and adding provider information
5811
5818
  *
5819
+ * For PaaS instances, the parent field is omitted to support native events (observer.*, plugin.*)
5820
+ * which would be rejected by Adobe Commerce as invalid aliases if parent is set to the same name.
5821
+ * For non-PaaS instances, the parent field is set to the event name as usual.
5822
+ *
5812
5823
  * @param eventSpec - Event specification object containing event details
5813
5824
  * @param providerId - Provider ID to assign to the event
5814
5825
  * @returns Modified event specification with updated event properties
@@ -5825,12 +5836,18 @@ ${JSON.stringify(preparedEvent.event, null, 2)}`
5825
5836
  throw new Error("Valid provider ID is required");
5826
5837
  }
5827
5838
  const modifiedEventSpec = JSON.parse(JSON.stringify(eventSpec));
5828
- modifiedEventSpec.event.parent = modifiedEventSpec.event.name;
5839
+ const eventName = modifiedEventSpec.event.name;
5840
+ if (!this.isPaaS) {
5841
+ modifiedEventSpec.event.parent = eventName;
5842
+ }
5829
5843
  modifiedEventSpec.event.provider_id = providerId;
5830
5844
  modifiedEventSpec.event.destination = "default";
5831
5845
  modifiedEventSpec.event.provider_id = providerId;
5832
5846
  modifiedEventSpec.event.priority = true;
5833
5847
  modifiedEventSpec.event.hipaa_audit_required = false;
5848
+ if (!modifiedEventSpec.event.rules) {
5849
+ modifiedEventSpec.event.rules = [];
5850
+ }
5834
5851
  return modifiedEventSpec;
5835
5852
  }
5836
5853
  /**