@adobe-commerce/aio-toolkit 1.0.10 → 1.0.12

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,35 +5,78 @@ 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.12] - 2026-01-06
9
+
10
+ ### ✨ Features
11
+
12
+ - **feat(openwhisk):** Add configurable blocking parameter to execute method
13
+ - Created `OpenwhiskConfig` interface with optional `blocking` parameter
14
+ - Updated `Openwhisk.execute()` to accept optional config parameter
15
+ - Default `blocking` value is `true` for backward compatibility
16
+ - Allows non-blocking action execution when `blocking: false` is specified
17
+ - Enhanced JSDoc documentation with parameter descriptions
18
+ - Exported `OpenwhiskConfig` type from framework module for TypeScript users
19
+
20
+ ### 🐛 Bug Fixes
21
+
22
+ - **fix(postinstall):** Simplified postinstall script to use Node.js built-in module resolution
23
+ - Replaced complex relative path logic with `require.resolve()` for automatic absolute path resolution
24
+ - Reduced script complexity from 20+ lines of path logic to 6 lines using Node's module resolution
25
+ - More reliable package detection that works in all Node.js environments
26
+ - Fixes issue where postinstall script couldn't find telemetry package in client projects
27
+ - Script now uses `require.resolve('@adobe/aio-lib-telemetry/package.json')` for automatic path handling
28
+ - Eliminated fragile relative path calculations (`../../../`) that depended on specific directory structures
29
+ - Works seamlessly across npm, yarn, pnpm, and different installation scenarios
30
+
31
+ ### 📝 Technical Details
32
+
33
+ - Created `src/framework/openwhisk/types.ts` with `OpenwhiskConfig` interface
34
+ - Updated `Openwhisk.execute()` method signature to support configuration options
35
+ - Simplified `scripts/postinstall.js` from 108 lines to 93 lines
36
+ - Replaced manual path construction with Node's native module resolution algorithm
37
+ - More maintainable and robust solution that leverages Node.js built-in capabilities
38
+ - Script now works correctly whether telemetry is installed as direct dependency or peer dependency
39
+ - Automatic handling of hoisted vs nested node_modules structures
40
+ - All validations passed: type-check, linting, tests (1679+), and build
41
+
42
+ ## [1.0.11] - 2026-01-04
43
+
44
+ ### 🐛 Bug Fixes
45
+
46
+ - **fix(telemetry):** Revert lazy-loading pattern from v1.0.10 that caused missing logs in New Relic
47
+ - Lazy-loaded logger proxy was causing race conditions where early logs used fallback Core.Logger
48
+ - Logs (`-started`, `-headers`, `-body`) were not being sent to OpenTelemetry/New Relic
49
+ - Only late logs (like `-completed`) appeared because telemetry logger loaded after initial execution
50
+ - Reverted to synchronous imports for `@adobe/aio-lib-telemetry` and `NewRelicTelemetry`
51
+ - Ensures telemetry logger is immediately available and properly connected to trace context
52
+
53
+ - **fix(telemetry):** Add automatic postinstall script to fix @adobe/aio-lib-telemetry exports bug
54
+ - **Problem**: `@adobe/aio-lib-telemetry@1.1.2` has incorrect exports configuration causing `ERR_PACKAGE_PATH_NOT_EXPORTED` error
55
+ - **Root Cause**: Package uses `"import"` instead of `"default"` in both import and require conditions
56
+ - **Solution**: Custom postinstall script (`scripts/postinstall.js`) automatically patches the telemetry package.json
57
+ - **Impact**: Zero configuration required by client projects - patch applies automatically during npm install
58
+ - **Compatibility**: Works with both CommonJS (require) and ESM (import) in TypeScript and JavaScript projects
59
+ - Added `@adobe/aio-lib-telemetry`, `@adobe/aio-lib-ims` to tsup external dependencies to prevent bundling
60
+ - Postinstall script runs automatically when toolkit is installed as a dependency
61
+ - Gracefully handles cases where telemetry package is not present
62
+ - No breaking changes - completely transparent to end users
63
+
64
+ ### 📝 Technical Details
65
+
66
+ - Reverted changes from release v1.0.10 (commit d8229f7)
67
+ - Restored synchronous telemetry initialization pattern from v1.0.9
68
+ - All telemetry-related imports are now synchronous to prevent race conditions
69
+ - Added `scripts/postinstall.js` to automatically fix third-party package exports bug
70
+ - Updated `tsup.config.ts` to externalize Adobe SDK packages instead of bundling
71
+ - Postinstall script detects and patches telemetry package in client project's node_modules
72
+
8
73
  ## [1.0.10] - 2026-01-01
9
74
 
10
75
  ### 🐛 Bug Fixes
11
76
 
12
- - **Telemetry** - Fixed `ERR_PACKAGE_PATH_NOT_EXPORTED` error when requiring the package
13
- - Root cause: `@adobe/aio-lib-telemetry@1.1.2` has broken CommonJS exports in its package.json
14
- - Solution: Implemented lazy-loading proxy pattern for OpenTelemetry logger
15
- - `getLogger` is now dynamically imported only when `ENABLE_TELEMETRY=true`
16
- - Maintains synchronous API with immediate logger availability
17
- - Graceful fallback to `Core.Logger` if telemetry loading fails
18
- - **Impact:** Zero breaking changes - existing client code works without modification
19
- - **Benefits:**
20
- - Full OpenTelemetry integration preserved when telemetry is enabled
21
- - Package size reduced by 92% (3.83 MB → 288 KB)
22
- - No more import errors from broken dependency exports
23
-
24
- ### 🔧 Technical Changes
25
-
26
- - **src/framework/telemetry/index.ts** - Implemented lazy-loading proxy pattern for `getLogger`
27
- - **src/framework/telemetry/types.ts** - Added local `EntrypointInstrumentationConfig` type definition
28
- - **src/commerce/adobe-auth/index.ts** - Changed to namespace import for ESM/CommonJS compatibility
29
- - **tsconfig.json** - Added `"module": "ES2020"` to support dynamic imports
30
- - **tsup.config.ts** - Configured to keep all dependencies external (not bundled)
31
-
32
- ### ✅ Quality Assurance
33
-
34
- - Added 8 comprehensive test cases for lazy-loading telemetry behavior
35
- - Maintained 100% test coverage (1902 tests passing)
36
- - All validation checks passing (linting, formatting, type safety)
77
+ - **fix(telemetry):** Resolve ERR_PACKAGE_PATH_NOT_EXPORTED error with lazy-loading pattern
78
+ - **Note:** This version introduced a regression with missing logs in New Relic
79
+ - **Recommendation:** Skip this version and use v1.0.11 instead
37
80
 
38
81
  ## [1.0.9] - 2025-12-23
39
82
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import openwhisk, { Dict, Activation } from 'openwhisk';
2
+ import { EntrypointInstrumentationConfig } from '@adobe/aio-lib-telemetry';
2
3
  import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
3
4
  import { SdkLogRecord } from '@adobe/aio-lib-telemetry/otel';
4
5
  import { Response } from 'node-fetch';
@@ -106,10 +107,14 @@ declare class GraphQlAction {
106
107
  }) => Promise<RuntimeActionResponseType>;
107
108
  }
108
109
 
110
+ interface OpenwhiskConfig {
111
+ blocking?: boolean;
112
+ }
113
+
109
114
  declare class Openwhisk {
110
115
  openwhiskClient: ReturnType<typeof openwhisk>;
111
116
  constructor(host: string, apiKey: string);
112
- execute(action: string, params: Dict): Promise<Activation<Dict>>;
117
+ execute(action: string, params: Dict, config?: OpenwhiskConfig): Promise<Activation<Dict>>;
113
118
  }
114
119
 
115
120
  declare class OpenwhiskAction {
@@ -276,7 +281,6 @@ declare class RuntimeApiGatewayService {
276
281
  delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
277
282
  }
278
283
 
279
- type EntrypointInstrumentationConfig = any;
280
284
  interface BaseTelemetryValidator {
281
285
  isConfigured(params: Record<string, unknown>): boolean;
282
286
  validateConfiguration(params: Record<string, unknown>): void;
@@ -289,7 +293,6 @@ interface BaseTelemetry {
289
293
 
290
294
  declare class Telemetry {
291
295
  static createLogger(name: string, params: Record<string, unknown>): any;
292
- private static wrapLogger;
293
296
  static formatError(error: unknown): Record<string, unknown>;
294
297
  static initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
295
298
  }
@@ -956,4 +959,4 @@ declare class AdminUiSdk {
956
959
  getRegistration(): AdminUiSdkRegistration;
957
960
  }
958
961
 
959
- export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type CreateEventResult, CreateEvents, type CreateProviderParams, type CreateProviderResult, type CreateRegistrationResult, CreateRegistrations, type EntrypointInstrumentationConfig, type ErrorResponse, EventConsumerAction, type EventData, type EventMetadata, type EventMetadataInputModel, type EventMetadataListResponse, EventMetadataManager, type ExtendedRequestError, type FileMetadata, type FileRecord, FileRepository, GenerateBasicAuthToken, type GetProviderQueryParams, type GetRegistrationQueryParams, GraphQlAction, type HALLink, type Headers, HttpMethod, HttpStatus, IOEventsApiError, type IOEventsError, ImsConnection, ImsToken, type ImsTokenResult, InfiniteLoopBreaker, type InfiniteLoopData, IoEventsGlobals, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
962
+ export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type CreateEventResult, CreateEvents, type CreateProviderParams, type CreateProviderResult, type CreateRegistrationResult, CreateRegistrations, type ErrorResponse, EventConsumerAction, type EventData, type EventMetadata, type EventMetadataInputModel, type EventMetadataListResponse, EventMetadataManager, type ExtendedRequestError, type FileMetadata, type FileRecord, FileRepository, GenerateBasicAuthToken, type GetProviderQueryParams, type GetRegistrationQueryParams, GraphQlAction, type HALLink, type Headers, HttpMethod, HttpStatus, IOEventsApiError, type IOEventsError, ImsConnection, ImsToken, type ImsTokenResult, InfiniteLoopBreaker, type InfiniteLoopData, IoEventsGlobals, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import openwhisk, { Dict, Activation } from 'openwhisk';
2
+ import { EntrypointInstrumentationConfig } from '@adobe/aio-lib-telemetry';
2
3
  import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
3
4
  import { SdkLogRecord } from '@adobe/aio-lib-telemetry/otel';
4
5
  import { Response } from 'node-fetch';
@@ -106,10 +107,14 @@ declare class GraphQlAction {
106
107
  }) => Promise<RuntimeActionResponseType>;
107
108
  }
108
109
 
110
+ interface OpenwhiskConfig {
111
+ blocking?: boolean;
112
+ }
113
+
109
114
  declare class Openwhisk {
110
115
  openwhiskClient: ReturnType<typeof openwhisk>;
111
116
  constructor(host: string, apiKey: string);
112
- execute(action: string, params: Dict): Promise<Activation<Dict>>;
117
+ execute(action: string, params: Dict, config?: OpenwhiskConfig): Promise<Activation<Dict>>;
113
118
  }
114
119
 
115
120
  declare class OpenwhiskAction {
@@ -276,7 +281,6 @@ declare class RuntimeApiGatewayService {
276
281
  delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
277
282
  }
278
283
 
279
- type EntrypointInstrumentationConfig = any;
280
284
  interface BaseTelemetryValidator {
281
285
  isConfigured(params: Record<string, unknown>): boolean;
282
286
  validateConfiguration(params: Record<string, unknown>): void;
@@ -289,7 +293,6 @@ interface BaseTelemetry {
289
293
 
290
294
  declare class Telemetry {
291
295
  static createLogger(name: string, params: Record<string, unknown>): any;
292
- private static wrapLogger;
293
296
  static formatError(error: unknown): Record<string, unknown>;
294
297
  static initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
295
298
  }
@@ -956,4 +959,4 @@ declare class AdminUiSdk {
956
959
  getRegistration(): AdminUiSdkRegistration;
957
960
  }
958
961
 
959
- export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type CreateEventResult, CreateEvents, type CreateProviderParams, type CreateProviderResult, type CreateRegistrationResult, CreateRegistrations, type EntrypointInstrumentationConfig, type ErrorResponse, EventConsumerAction, type EventData, type EventMetadata, type EventMetadataInputModel, type EventMetadataListResponse, EventMetadataManager, type ExtendedRequestError, type FileMetadata, type FileRecord, FileRepository, GenerateBasicAuthToken, type GetProviderQueryParams, type GetRegistrationQueryParams, GraphQlAction, type HALLink, type Headers, HttpMethod, HttpStatus, IOEventsApiError, type IOEventsError, ImsConnection, ImsToken, type ImsTokenResult, InfiniteLoopBreaker, type InfiniteLoopData, IoEventsGlobals, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
962
+ export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type CreateEventResult, CreateEvents, type CreateProviderParams, type CreateProviderResult, type CreateRegistrationResult, CreateRegistrations, type ErrorResponse, EventConsumerAction, type EventData, type EventMetadata, type EventMetadataInputModel, type EventMetadataListResponse, EventMetadataManager, type ExtendedRequestError, type FileMetadata, type FileRecord, FileRepository, GenerateBasicAuthToken, type GetProviderQueryParams, type GetRegistrationQueryParams, GraphQlAction, type HALLink, type Headers, HttpMethod, HttpStatus, IOEventsApiError, type IOEventsError, ImsConnection, ImsToken, type ImsTokenResult, InfiniteLoopBreaker, type InfiniteLoopData, IoEventsGlobals, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };