@adobe-commerce/aio-toolkit 1.0.4 → 1.0.6
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 +116 -0
- package/README.md +168 -6
- package/dist/index.d.mts +174 -71
- package/dist/index.d.ts +174 -71
- package/dist/index.js +1014 -268
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1015 -267
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,122 @@ 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.6] - 2025-11-11
|
|
9
|
+
|
|
10
|
+
### 🚀 New Integration Module & API Enhancements
|
|
11
|
+
|
|
12
|
+
This release introduces the comprehensive OnboardCommerce integration module for Adobe Commerce I/O Events configuration, a new RuntimeApiGatewayService for flexible Runtime API endpoint management, structured logging system with prefixed messages, and the OnboardIOEvents alias with OnboardEvents deprecation for improved naming clarity. All changes maintain backward compatibility while adding powerful new functionality for Adobe Commerce integrations.
|
|
13
|
+
|
|
14
|
+
#### 🛍️ Commerce Integration Components
|
|
15
|
+
|
|
16
|
+
- **OnboardCommerce** `[New]` - Complete Adobe Commerce I/O Events configuration orchestration
|
|
17
|
+
- Automated provider configuration and validation
|
|
18
|
+
- Event subscription management with conflict detection
|
|
19
|
+
- Support for multiple commerce events with custom configurations
|
|
20
|
+
- Intelligent event metadata validation against supported events
|
|
21
|
+
- Skip duplicate subscriptions automatically
|
|
22
|
+
- Structured logging with visual indicators (`[START]`, `[CREATE]`, `[SKIP]`, `[ERROR]`)
|
|
23
|
+
- Comprehensive summary reporting with provider and event statistics
|
|
24
|
+
- Full TypeScript support with detailed type definitions
|
|
25
|
+
- 100% test coverage with 1,158+ test cases
|
|
26
|
+
- Integration with existing Adobe I/O Events infrastructure
|
|
27
|
+
|
|
28
|
+
#### 🔧 Framework Components
|
|
29
|
+
|
|
30
|
+
- **RuntimeApiGatewayService** `[New]` - Flexible Adobe I/O Runtime API Gateway client
|
|
31
|
+
- Centralized service for Runtime API Gateway endpoint management
|
|
32
|
+
- Automatic IMS token generation and authentication
|
|
33
|
+
- Built-in authentication headers with organization ID
|
|
34
|
+
- Support for all HTTP methods (GET, POST, PUT, DELETE)
|
|
35
|
+
- Flexible endpoint configuration without hardcoded paths
|
|
36
|
+
- Comprehensive error handling with detailed logging
|
|
37
|
+
- Integration with ImsToken for token management
|
|
38
|
+
- CustomLogger integration for consistent logging
|
|
39
|
+
- Type-safe TypeScript interfaces
|
|
40
|
+
|
|
41
|
+
- **ImsToken** `[Enhanced]` - Context-specific token management
|
|
42
|
+
- New `tokenKey` and `tokenContext` constructor parameters
|
|
43
|
+
- Allows multiple ImsToken instances with different contexts
|
|
44
|
+
- Prevents token collision for different service integrations
|
|
45
|
+
- Enhanced caching strategy for multi-service applications
|
|
46
|
+
- Full backward compatibility maintained
|
|
47
|
+
|
|
48
|
+
#### 🔗 Integration Components
|
|
49
|
+
|
|
50
|
+
- **OnboardIOEvents** `[New]` - Renamed alias for OnboardEvents
|
|
51
|
+
- New recommended export name for improved clarity
|
|
52
|
+
- Better naming alignment with Adobe I/O Events terminology
|
|
53
|
+
- Full backward compatibility with OnboardEvents
|
|
54
|
+
- Identical functionality and API surface
|
|
55
|
+
|
|
56
|
+
- **OnboardEvents** `[Deprecated]` - Original export marked for future removal
|
|
57
|
+
- **DEPRECATED**: Use OnboardIOEvents instead
|
|
58
|
+
- JSDoc `@deprecated` tag added for IDE warnings
|
|
59
|
+
- Will be removed in a future major version
|
|
60
|
+
- Migration path documented in README
|
|
61
|
+
- No breaking changes - both exports work identically
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 📚 **Migration Guide**
|
|
66
|
+
|
|
67
|
+
#### OnboardEvents → OnboardIOEvents
|
|
68
|
+
|
|
69
|
+
Update your imports to use the new OnboardIOEvents export:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// ❌ Deprecated (will show IDE warning)
|
|
73
|
+
import { OnboardEvents } from '@adobe-commerce/aio-toolkit';
|
|
74
|
+
|
|
75
|
+
// ✅ Recommended
|
|
76
|
+
import { OnboardIOEvents } from '@adobe-commerce/aio-toolkit';
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## [1.0.5] - 2025-11-03
|
|
80
|
+
|
|
81
|
+
### 🚀 API Enhancements, Security & Developer Experience Improvements
|
|
82
|
+
|
|
83
|
+
This release focuses on improving security testing capabilities, refactoring
|
|
84
|
+
logging for consistency, enhancing repository metadata, and improving the
|
|
85
|
+
ShippingCarrier API for better developer experience and safety. All changes
|
|
86
|
+
maintain backward compatibility except for the ShippingCarrier reset() method
|
|
87
|
+
removal.
|
|
88
|
+
|
|
89
|
+
#### 🔧 Commerce Components
|
|
90
|
+
|
|
91
|
+
- **AdobeCommerceClient** `[Enhanced]` - HTTPS configuration support for
|
|
92
|
+
testing
|
|
93
|
+
- Added optional `httpsOptions` parameter to constructor
|
|
94
|
+
- Support for `rejectUnauthorized: false` for self-signed certificates
|
|
95
|
+
- Enables testing against local/staging environments with insecure SSL
|
|
96
|
+
- Options passed directly to `got` library's https configuration
|
|
97
|
+
- Fully backward compatible - parameter is optional
|
|
98
|
+
|
|
99
|
+
- **AdobeCommerceClient, BasicAuthConnection, Oauth1aConnection** `[Refactored]`
|
|
100
|
+
- Logger initialization refactored to use CustomLogger
|
|
101
|
+
- Consistent null-safe logging across all commerce client classes
|
|
102
|
+
- Removed direct dependency on Core.Logger from @adobe/aio-sdk
|
|
103
|
+
- Simplified constructor logic with centralized logging
|
|
104
|
+
- Enhanced CustomLogger with variadic argument support for logging methods
|
|
105
|
+
|
|
106
|
+
- **ShippingCarrier** `[Breaking Change]` - Removed reset() method and
|
|
107
|
+
immutable code property
|
|
108
|
+
- **BREAKING**: Removed `reset()` method - users should create new
|
|
109
|
+
ShippingCarrier instances
|
|
110
|
+
- Made `code` property immutable in `setData()` method
|
|
111
|
+
- Code is now preserved across all `setData()` calls
|
|
112
|
+
- Prevents accidental override of carrier identity
|
|
113
|
+
- Added `getAddedMethods()` public getter method
|
|
114
|
+
- Added `getRemovedMethods()` public getter method
|
|
115
|
+
- Better encapsulation with controlled access to method tracking arrays
|
|
116
|
+
|
|
117
|
+
#### 🛠️ Framework Components
|
|
118
|
+
|
|
119
|
+
- **CustomLogger** `[Enhanced]` - Variadic argument support
|
|
120
|
+
- Updated `debug()`, `info()`, and `error()` methods to accept variadic args
|
|
121
|
+
- Supports modern logging patterns like `logger.debug('User %s logged in', userId)`
|
|
122
|
+
- Full backward compatibility maintained
|
|
123
|
+
|
|
8
124
|
## [1.0.4] - 2025-10-29
|
|
9
125
|
|
|
10
126
|
### 🚀 Major Feature Release: Webhook Components & Shipping Carrier Builder
|
package/README.md
CHANGED
|
@@ -282,6 +282,53 @@ const helloWorldAction = OpenwhiskAction.execute('hello-world', async (params, c
|
|
|
282
282
|
exports.main = helloWorldAction;
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
+
#### `RuntimeApiGatewayService`
|
|
286
|
+
Flexible Adobe I/O Runtime API Gateway client with automatic IMS token management and authentication.
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
const { RuntimeApiGatewayService } = require('@adobe-commerce/aio-toolkit');
|
|
290
|
+
|
|
291
|
+
// Initialize the service
|
|
292
|
+
const apiGatewayService = new RuntimeApiGatewayService(
|
|
293
|
+
'your-client-id',
|
|
294
|
+
'your-client-secret',
|
|
295
|
+
'your-technical-account-id',
|
|
296
|
+
'your-technical-account-email@example.com',
|
|
297
|
+
'your-ims-org-id@AdobeOrg',
|
|
298
|
+
['openid', 'AdobeID', 'adobeio_api'],
|
|
299
|
+
'your-namespace-12345',
|
|
300
|
+
logger // Optional custom logger
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// GET request
|
|
304
|
+
const data = await apiGatewayService.get('v1/web/my-package/my-action');
|
|
305
|
+
console.log('Action response:', data);
|
|
306
|
+
|
|
307
|
+
// POST request with payload
|
|
308
|
+
const result = await apiGatewayService.post('v1/web/my-package/process', {
|
|
309
|
+
orderId: 'ORD-123',
|
|
310
|
+
action: 'process'
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// PUT request
|
|
314
|
+
const updateResult = await apiGatewayService.put('v1/web/my-package/update', {
|
|
315
|
+
id: '123',
|
|
316
|
+
status: 'completed'
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// DELETE request
|
|
320
|
+
const deleteResult = await apiGatewayService.delete('v1/web/my-package/remove/123');
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Key Features:**
|
|
324
|
+
- Automatic IMS token generation and caching
|
|
325
|
+
- Built-in authentication headers
|
|
326
|
+
- Support for GET, POST, PUT, DELETE methods
|
|
327
|
+
- Flexible endpoint configuration
|
|
328
|
+
- Comprehensive error handling
|
|
329
|
+
- Integration with ImsToken for token management
|
|
330
|
+
- CustomLogger integration
|
|
331
|
+
|
|
285
332
|
#### `FileRepository`
|
|
286
333
|
File-based storage with CRUD operations for Adobe I/O Runtime applications.
|
|
287
334
|
|
|
@@ -624,13 +671,18 @@ const carrier = new ShippingCarrier('fedex', (carrier) => {
|
|
|
624
671
|
const carrierData = carrier.getData();
|
|
625
672
|
console.log(carrierData);
|
|
626
673
|
|
|
674
|
+
// Access added and removed methods
|
|
675
|
+
const addedMethods = carrier.getAddedMethods(); // ['standard', 'express']
|
|
676
|
+
const removedMethods = carrier.getRemovedMethods(); // ['overnight']
|
|
677
|
+
|
|
627
678
|
// Generate webhook response operations
|
|
628
679
|
const response = new ShippingCarrierResponse(carrier);
|
|
629
680
|
const operations = response.generate();
|
|
630
681
|
return operations; // Use in webhook action
|
|
631
682
|
|
|
683
|
+
// Update carrier data (code is immutable)
|
|
632
684
|
carrier.setData({
|
|
633
|
-
code: '
|
|
685
|
+
code: 'ups', // This will be ignored - code remains 'fedex'
|
|
634
686
|
title: 'Demo Postal Service',
|
|
635
687
|
stores: ['default'],
|
|
636
688
|
countries: ['US', 'CA'],
|
|
@@ -640,8 +692,8 @@ carrier.setData({
|
|
|
640
692
|
shipping_labels_available: true
|
|
641
693
|
});
|
|
642
694
|
|
|
643
|
-
//
|
|
644
|
-
|
|
695
|
+
// Code property is immutable - create new instance if you need different code
|
|
696
|
+
const newCarrier = new ShippingCarrier('ups', (c) => {
|
|
645
697
|
c.addMethod('ground', (m) => {
|
|
646
698
|
m.setMethodTitle('UPS Ground').setPrice(12.99);
|
|
647
699
|
});
|
|
@@ -653,6 +705,8 @@ carrier.reset('ups', (c) => {
|
|
|
653
705
|
- Validation for carrier and method codes (alphanumeric and underscores only)
|
|
654
706
|
- Add and remove shipping methods dynamically
|
|
655
707
|
- Configure carrier properties (title, stores, countries, sort order, etc.)
|
|
708
|
+
- **Immutable code property** - prevents accidental carrier identity changes
|
|
709
|
+
- Public getter methods: `getAddedMethods()` and `getRemovedMethods()`
|
|
656
710
|
- Generate webhook response operations
|
|
657
711
|
- Type-safe TypeScript interfaces
|
|
658
712
|
|
|
@@ -660,6 +714,111 @@ carrier.reset('ups', (c) => {
|
|
|
660
714
|
- Carrier and method codes must contain only alphanumeric characters and underscores
|
|
661
715
|
- No spaces, hyphens, dots, or special characters allowed
|
|
662
716
|
- Empty or whitespace-only codes throw errors
|
|
717
|
+
- Code property cannot be changed after initialization
|
|
718
|
+
|
|
719
|
+
#### `OnboardCommerce`
|
|
720
|
+
Complete Adobe Commerce I/O Events configuration orchestration with automated provider setup and event subscription management.
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
const {
|
|
724
|
+
OnboardCommerce,
|
|
725
|
+
AdobeCommerceClient,
|
|
726
|
+
ImsConnection
|
|
727
|
+
} = require('@adobe-commerce/aio-toolkit');
|
|
728
|
+
const Core = require('@adobe/aio-sdk').Core;
|
|
729
|
+
|
|
730
|
+
// Initialize Adobe Commerce client
|
|
731
|
+
const connection = new ImsConnection(
|
|
732
|
+
'client-id',
|
|
733
|
+
'client-secret',
|
|
734
|
+
'technical-account-id',
|
|
735
|
+
'technical-account-email',
|
|
736
|
+
'ims-org-id',
|
|
737
|
+
['AdobeID', 'openid', 'adobeio_api'],
|
|
738
|
+
logger
|
|
739
|
+
);
|
|
740
|
+
const adobeCommerceClient = new AdobeCommerceClient(
|
|
741
|
+
'https://your-commerce-store.com',
|
|
742
|
+
connection
|
|
743
|
+
);
|
|
744
|
+
|
|
745
|
+
// Initialize logger
|
|
746
|
+
const logger = Core.Logger('onboard-client', {
|
|
747
|
+
level: 'debug'
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
// Initialize OnboardCommerce
|
|
751
|
+
const onboardCommerce = new OnboardCommerce(
|
|
752
|
+
adobeCommerceClient,
|
|
753
|
+
process.env.COMMERCE_ADOBE_IO_EVENTS_MERCHANT_ID || '',
|
|
754
|
+
process.env.COMMERCE_ADOBE_IO_EVENTS_ENVIRONMENT_ID || '',
|
|
755
|
+
logger
|
|
756
|
+
);
|
|
757
|
+
|
|
758
|
+
// Define commerce provider
|
|
759
|
+
const commerceProvider = {
|
|
760
|
+
raw: {
|
|
761
|
+
id: 'commerce-provider-id',
|
|
762
|
+
label: 'Commerce Events Provider',
|
|
763
|
+
description: 'Provider for Adobe Commerce events',
|
|
764
|
+
docsUrl: 'https://developer.adobe.com/commerce/events'
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
// Define workspace configuration
|
|
769
|
+
const workspaceConfig = {
|
|
770
|
+
project: {
|
|
771
|
+
id: process.env.ADOBE_PROJECT_ID,
|
|
772
|
+
name: 'My Commerce Project',
|
|
773
|
+
title: 'Commerce Integration'
|
|
774
|
+
},
|
|
775
|
+
workspace: {
|
|
776
|
+
id: process.env.ADOBE_WORKSPACE_ID,
|
|
777
|
+
name: 'Production'
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
// Define commerce events configuration
|
|
782
|
+
const commerceEventsConfig = [
|
|
783
|
+
{
|
|
784
|
+
event: {
|
|
785
|
+
name: 'com.adobe.commerce.observer.catalog_product_save_after',
|
|
786
|
+
label: 'Product Saved',
|
|
787
|
+
description: 'Triggered when a product is saved'
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
event: {
|
|
792
|
+
name: 'com.adobe.commerce.observer.sales_order_save_after',
|
|
793
|
+
label: 'Order Saved',
|
|
794
|
+
description: 'Triggered when an order is saved'
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
];
|
|
798
|
+
|
|
799
|
+
// Execute configuration
|
|
800
|
+
const result = await onboardCommerce.process(
|
|
801
|
+
commerceProvider.raw,
|
|
802
|
+
workspaceConfig,
|
|
803
|
+
commerceEventsConfig
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
if (result.success) {
|
|
807
|
+
console.log('✅ Commerce events configured successfully');
|
|
808
|
+
console.log(`Provider: ${result.provider?.label}`);
|
|
809
|
+
} else {
|
|
810
|
+
console.error('❌ Configuration failed:', result.error);
|
|
811
|
+
}
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
**Key Features:**
|
|
815
|
+
- Automated provider configuration with validation
|
|
816
|
+
- Event subscription management with duplicate detection
|
|
817
|
+
- Intelligent event metadata validation against supported Commerce events
|
|
818
|
+
- Structured logging with prefixes: `[START]`, `[CREATE]`, `[SKIP]`, `[ERROR]`
|
|
819
|
+
- Comprehensive summary reporting with event subscription statistics
|
|
820
|
+
- Integration with Adobe Commerce API for event discovery
|
|
821
|
+
- 100% test coverage
|
|
663
822
|
|
|
664
823
|
### 🎨 Experience Components
|
|
665
824
|
|
|
@@ -829,13 +988,16 @@ await InfiniteLoopBreaker.storeFingerPrint(
|
|
|
829
988
|
);
|
|
830
989
|
```
|
|
831
990
|
|
|
832
|
-
#### `OnboardEvents`
|
|
991
|
+
#### `OnboardIOEvents` (formerly `OnboardEvents`)
|
|
833
992
|
Complete onboarding orchestration for Adobe I/O Events (providers, metadata, and registrations).
|
|
834
993
|
|
|
994
|
+
> **Note**: `OnboardEvents` is deprecated and will be removed in v2.0.0. Please use `OnboardIOEvents` instead.
|
|
995
|
+
|
|
835
996
|
```typescript
|
|
836
|
-
const {
|
|
997
|
+
const { OnboardIOEvents } = require('@adobe-commerce/aio-toolkit');
|
|
837
998
|
|
|
838
|
-
|
|
999
|
+
// ✅ Recommended - Use OnboardIOEvents
|
|
1000
|
+
const onboardEvents = new OnboardIOEvents(
|
|
839
1001
|
'My E-commerce Store',
|
|
840
1002
|
process.env.ADOBE_CONSUMER_ID!,
|
|
841
1003
|
process.env.ADOBE_PROJECT_ID!,
|
package/dist/index.d.mts
CHANGED
|
@@ -231,6 +231,46 @@ declare class WebhookActionResponse {
|
|
|
231
231
|
static remove(path: string): WebhookActionRemoveResponse;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
interface ImsTokenResult {
|
|
235
|
+
token: string | null;
|
|
236
|
+
expire_in: number;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare class ImsToken {
|
|
240
|
+
private readonly clientId;
|
|
241
|
+
private readonly clientSecret;
|
|
242
|
+
private readonly technicalAccountId;
|
|
243
|
+
private readonly technicalAccountEmail;
|
|
244
|
+
private readonly imsOrgId;
|
|
245
|
+
private readonly scopes;
|
|
246
|
+
private readonly customLogger;
|
|
247
|
+
private state;
|
|
248
|
+
private readonly tokenContext;
|
|
249
|
+
private readonly key;
|
|
250
|
+
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any, cacheKey?: string, tokenContext?: string);
|
|
251
|
+
execute(): Promise<string | null>;
|
|
252
|
+
getImsToken(): Promise<ImsTokenResult | null>;
|
|
253
|
+
setValue(result: ImsTokenResult): Promise<boolean>;
|
|
254
|
+
getValue(): Promise<string | null>;
|
|
255
|
+
getState(): Promise<any>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
declare class RuntimeApiGatewayService {
|
|
259
|
+
private static readonly BASE_URL;
|
|
260
|
+
private readonly namespace;
|
|
261
|
+
private readonly imsOrgId;
|
|
262
|
+
private readonly imsToken;
|
|
263
|
+
private readonly restClient;
|
|
264
|
+
private readonly customLogger;
|
|
265
|
+
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, namespace: string, logger?: any);
|
|
266
|
+
private buildEndpoint;
|
|
267
|
+
private getAuthenticatedHeaders;
|
|
268
|
+
get(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
269
|
+
post(endpoint: string, payload: any, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
270
|
+
put(endpoint: string, payload: any, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
271
|
+
delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
|
|
272
|
+
}
|
|
273
|
+
|
|
234
274
|
interface BearerTokenInfo {
|
|
235
275
|
token: string | null;
|
|
236
276
|
tokenLength: number;
|
|
@@ -443,22 +483,23 @@ declare class InfiniteLoopBreaker {
|
|
|
443
483
|
private static fingerPrint;
|
|
444
484
|
}
|
|
445
485
|
|
|
446
|
-
declare class AdobeAuth {
|
|
447
|
-
static getToken(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: string[], currentContext?: string): Promise<string>;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
486
|
interface Connection {
|
|
451
487
|
extend: (client: Got) => Promise<Got>;
|
|
452
488
|
}
|
|
453
489
|
interface ExtendedRequestError extends RequestError {
|
|
454
490
|
responseBody?: any;
|
|
455
491
|
}
|
|
492
|
+
interface HttpsOptions {
|
|
493
|
+
rejectUnauthorized?: boolean;
|
|
494
|
+
[key: string]: any;
|
|
495
|
+
}
|
|
456
496
|
|
|
457
497
|
declare class AdobeCommerceClient {
|
|
458
498
|
private baseUrl;
|
|
459
499
|
private connection;
|
|
460
500
|
private logger;
|
|
461
|
-
|
|
501
|
+
private httpsOptions;
|
|
502
|
+
constructor(baseUrl: string, connection: Connection, logger?: any, httpsOptions?: HttpsOptions);
|
|
462
503
|
get(endpoint: string, headers?: Record<string, string>): Promise<any>;
|
|
463
504
|
post(endpoint: string, headers?: Record<string, string>, payload?: any): Promise<any>;
|
|
464
505
|
put(endpoint: string, headers?: Record<string, string>, payload?: any): Promise<any>;
|
|
@@ -467,6 +508,120 @@ declare class AdobeCommerceClient {
|
|
|
467
508
|
private getHttpClient;
|
|
468
509
|
}
|
|
469
510
|
|
|
511
|
+
declare const IoEventsGlobals: {
|
|
512
|
+
readonly BASE_URL: "https://api.adobe.io";
|
|
513
|
+
readonly STATUS_CODES: {
|
|
514
|
+
readonly OK: 200;
|
|
515
|
+
readonly BAD_REQUEST: 400;
|
|
516
|
+
readonly UNAUTHORIZED: 401;
|
|
517
|
+
readonly FORBIDDEN: 403;
|
|
518
|
+
readonly NOT_FOUND: 404;
|
|
519
|
+
readonly REQUEST_TIMEOUT: 408;
|
|
520
|
+
readonly TIMEOUT: 408;
|
|
521
|
+
readonly CONFLICT: 409;
|
|
522
|
+
readonly INTERNAL_SERVER_ERROR: 500;
|
|
523
|
+
};
|
|
524
|
+
readonly HEADERS: {
|
|
525
|
+
readonly CONFLICTING_ID: "x-conflicting-id";
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
interface HALLink {
|
|
529
|
+
href: string;
|
|
530
|
+
templated?: boolean;
|
|
531
|
+
type?: string;
|
|
532
|
+
title?: string;
|
|
533
|
+
}
|
|
534
|
+
interface IOEventsError {
|
|
535
|
+
error?: string;
|
|
536
|
+
message?: string;
|
|
537
|
+
error_code?: string;
|
|
538
|
+
details?: string;
|
|
539
|
+
}
|
|
540
|
+
declare class IOEventsApiError extends Error {
|
|
541
|
+
readonly statusCode: number;
|
|
542
|
+
readonly errorCode: string | undefined;
|
|
543
|
+
readonly details: string | undefined;
|
|
544
|
+
constructor(message: string, statusCode: number, errorCode?: string, details?: string);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
interface Provider {
|
|
548
|
+
id: string;
|
|
549
|
+
label: string;
|
|
550
|
+
description: string;
|
|
551
|
+
source: string;
|
|
552
|
+
docs_url?: string;
|
|
553
|
+
provider_metadata: string;
|
|
554
|
+
instance_id?: string;
|
|
555
|
+
event_delivery_format: string;
|
|
556
|
+
publisher: string;
|
|
557
|
+
_links?: {
|
|
558
|
+
'rel:eventmetadata'?: HALLink;
|
|
559
|
+
'rel:update'?: HALLink;
|
|
560
|
+
self?: HALLink;
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
interface OnboardCommerceConfig {
|
|
565
|
+
adobeCommerceClient: AdobeCommerceClient;
|
|
566
|
+
merchantId: string;
|
|
567
|
+
environmentId: string;
|
|
568
|
+
logger?: any;
|
|
569
|
+
}
|
|
570
|
+
interface CommerceEventField {
|
|
571
|
+
name: string;
|
|
572
|
+
}
|
|
573
|
+
interface CommerceEvent {
|
|
574
|
+
name: string;
|
|
575
|
+
fields: CommerceEventField[];
|
|
576
|
+
}
|
|
577
|
+
interface CommerceEventConfig {
|
|
578
|
+
event: CommerceEvent;
|
|
579
|
+
}
|
|
580
|
+
interface WorkspaceConfig {
|
|
581
|
+
project: {
|
|
582
|
+
id: string;
|
|
583
|
+
name: string;
|
|
584
|
+
title: string;
|
|
585
|
+
org: {
|
|
586
|
+
id: string;
|
|
587
|
+
name: string;
|
|
588
|
+
ims_org_id: string;
|
|
589
|
+
};
|
|
590
|
+
workspace: {
|
|
591
|
+
id: string;
|
|
592
|
+
name: string;
|
|
593
|
+
title: string;
|
|
594
|
+
action_url: string;
|
|
595
|
+
app_url: string;
|
|
596
|
+
details?: any;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
interface OnboardCommerceResult {
|
|
601
|
+
success: boolean;
|
|
602
|
+
message: string;
|
|
603
|
+
error?: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
declare class OnboardCommerce {
|
|
607
|
+
private readonly adobeCommerceClient;
|
|
608
|
+
private readonly merchantId;
|
|
609
|
+
private readonly environmentId;
|
|
610
|
+
private readonly customLogger;
|
|
611
|
+
private readonly configureProvider;
|
|
612
|
+
private readonly eventSubscriptionService;
|
|
613
|
+
private readonly eventService;
|
|
614
|
+
constructor(adobeCommerceClient: AdobeCommerceClient, merchantId: string, environmentId: string, logger?: any);
|
|
615
|
+
process(provider: Provider, workspaceConfig: WorkspaceConfig, commerceEventsConfig?: CommerceEventConfig[]): Promise<any>;
|
|
616
|
+
private filterEventsBySubscriptionStatus;
|
|
617
|
+
private prepareEventPayload;
|
|
618
|
+
private logEventSubscriptionSummary;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
declare class AdobeAuth {
|
|
622
|
+
static getToken(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: string[], currentContext?: string): Promise<string>;
|
|
623
|
+
}
|
|
624
|
+
|
|
470
625
|
declare class BasicAuthConnection implements Connection {
|
|
471
626
|
private baseUrl;
|
|
472
627
|
private username;
|
|
@@ -521,17 +676,6 @@ declare class GenerateBasicAuthToken {
|
|
|
521
676
|
getState(): Promise<any>;
|
|
522
677
|
}
|
|
523
678
|
|
|
524
|
-
interface ShippingCarrierData {
|
|
525
|
-
code: string;
|
|
526
|
-
title?: string;
|
|
527
|
-
stores?: string[];
|
|
528
|
-
countries?: string[];
|
|
529
|
-
sort_order?: number;
|
|
530
|
-
active?: boolean;
|
|
531
|
-
tracking_available?: boolean;
|
|
532
|
-
shipping_labels_available?: boolean;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
679
|
interface ShippingCarrierMethodAdditionalData {
|
|
536
680
|
key: string;
|
|
537
681
|
value: any;
|
|
@@ -545,6 +689,17 @@ interface ShippingCarrierMethodData {
|
|
|
545
689
|
additional_data: ShippingCarrierMethodAdditionalData[];
|
|
546
690
|
}
|
|
547
691
|
|
|
692
|
+
interface ShippingCarrierData {
|
|
693
|
+
code: string;
|
|
694
|
+
title?: string;
|
|
695
|
+
stores?: string[];
|
|
696
|
+
countries?: string[];
|
|
697
|
+
sort_order?: number;
|
|
698
|
+
active?: boolean;
|
|
699
|
+
tracking_available?: boolean;
|
|
700
|
+
shipping_labels_available?: boolean;
|
|
701
|
+
}
|
|
702
|
+
|
|
548
703
|
declare class ShippingCarrierMethod {
|
|
549
704
|
private methodData;
|
|
550
705
|
constructor(carrierCode: string, method: string);
|
|
@@ -572,8 +727,9 @@ declare class ShippingCarrier {
|
|
|
572
727
|
setData(carrierData: ShippingCarrierData): this;
|
|
573
728
|
addMethod(method: string, callback?: (builder: ShippingCarrierMethod) => void): this;
|
|
574
729
|
removeMethod(method: string): this;
|
|
575
|
-
reset(code: string, callback?: (builder: ShippingCarrier) => void): this;
|
|
576
730
|
getData(): ShippingCarrierData;
|
|
731
|
+
getAddedMethods(): ShippingCarrierMethodData[];
|
|
732
|
+
getRemovedMethods(): string[];
|
|
577
733
|
}
|
|
578
734
|
|
|
579
735
|
declare class ShippingCarrierResponse {
|
|
@@ -591,59 +747,6 @@ interface AdobeIMSConfig {
|
|
|
591
747
|
scopes: string[];
|
|
592
748
|
}
|
|
593
749
|
|
|
594
|
-
declare const IoEventsGlobals: {
|
|
595
|
-
readonly BASE_URL: "https://api.adobe.io";
|
|
596
|
-
readonly STATUS_CODES: {
|
|
597
|
-
readonly OK: 200;
|
|
598
|
-
readonly BAD_REQUEST: 400;
|
|
599
|
-
readonly UNAUTHORIZED: 401;
|
|
600
|
-
readonly FORBIDDEN: 403;
|
|
601
|
-
readonly NOT_FOUND: 404;
|
|
602
|
-
readonly REQUEST_TIMEOUT: 408;
|
|
603
|
-
readonly TIMEOUT: 408;
|
|
604
|
-
readonly CONFLICT: 409;
|
|
605
|
-
readonly INTERNAL_SERVER_ERROR: 500;
|
|
606
|
-
};
|
|
607
|
-
readonly HEADERS: {
|
|
608
|
-
readonly CONFLICTING_ID: "x-conflicting-id";
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
interface HALLink {
|
|
612
|
-
href: string;
|
|
613
|
-
templated?: boolean;
|
|
614
|
-
type?: string;
|
|
615
|
-
title?: string;
|
|
616
|
-
}
|
|
617
|
-
interface IOEventsError {
|
|
618
|
-
error?: string;
|
|
619
|
-
message?: string;
|
|
620
|
-
error_code?: string;
|
|
621
|
-
details?: string;
|
|
622
|
-
}
|
|
623
|
-
declare class IOEventsApiError extends Error {
|
|
624
|
-
readonly statusCode: number;
|
|
625
|
-
readonly errorCode: string | undefined;
|
|
626
|
-
readonly details: string | undefined;
|
|
627
|
-
constructor(message: string, statusCode: number, errorCode?: string, details?: string);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
interface Provider {
|
|
631
|
-
id: string;
|
|
632
|
-
label: string;
|
|
633
|
-
description: string;
|
|
634
|
-
source: string;
|
|
635
|
-
docs_url?: string;
|
|
636
|
-
provider_metadata: string;
|
|
637
|
-
instance_id?: string;
|
|
638
|
-
event_delivery_format: string;
|
|
639
|
-
publisher: string;
|
|
640
|
-
_links?: {
|
|
641
|
-
'rel:eventmetadata'?: HALLink;
|
|
642
|
-
'rel:update'?: HALLink;
|
|
643
|
-
self?: HALLink;
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
|
|
647
750
|
interface GetProviderQueryParams {
|
|
648
751
|
eventmetadata?: boolean;
|
|
649
752
|
}
|
|
@@ -815,4 +918,4 @@ declare class AdminUiSdk {
|
|
|
815
918
|
getRegistration(): AdminUiSdkRegistration;
|
|
816
919
|
}
|
|
817
920
|
|
|
818
|
-
export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, BasicAuthConnection, BearerToken, type BearerTokenInfo, 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, InfiniteLoopBreaker, type InfiniteLoopData, IoEventsGlobals, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, 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, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, type SuccessResponse, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse };
|
|
921
|
+
export { AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, 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, 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, type SuccessResponse, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
|