@adobe-commerce/aio-toolkit 1.0.3 → 1.0.5
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 +110 -0
- package/README.md +215 -4
- package/dist/index.d.mts +141 -3
- package/dist/index.d.ts +141 -3
- package/dist/index.js +751 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +738 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,116 @@ 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.5] - 2025-11-03
|
|
9
|
+
|
|
10
|
+
### 🚀 API Enhancements, Security & Developer Experience Improvements
|
|
11
|
+
|
|
12
|
+
This release focuses on improving security testing capabilities, refactoring
|
|
13
|
+
logging for consistency, enhancing repository metadata, and improving the
|
|
14
|
+
ShippingCarrier API for better developer experience and safety. All changes
|
|
15
|
+
maintain backward compatibility except for the ShippingCarrier reset() method
|
|
16
|
+
removal.
|
|
17
|
+
|
|
18
|
+
#### 🔧 Commerce Components
|
|
19
|
+
|
|
20
|
+
- **AdobeCommerceClient** `[Enhanced]` - HTTPS configuration support for
|
|
21
|
+
testing
|
|
22
|
+
- Added optional `httpsOptions` parameter to constructor
|
|
23
|
+
- Support for `rejectUnauthorized: false` for self-signed certificates
|
|
24
|
+
- Enables testing against local/staging environments with insecure SSL
|
|
25
|
+
- Options passed directly to `got` library's https configuration
|
|
26
|
+
- Fully backward compatible - parameter is optional
|
|
27
|
+
|
|
28
|
+
- **AdobeCommerceClient, BasicAuthConnection, Oauth1aConnection** `[Refactored]`
|
|
29
|
+
- Logger initialization refactored to use CustomLogger
|
|
30
|
+
- Consistent null-safe logging across all commerce client classes
|
|
31
|
+
- Removed direct dependency on Core.Logger from @adobe/aio-sdk
|
|
32
|
+
- Simplified constructor logic with centralized logging
|
|
33
|
+
- Enhanced CustomLogger with variadic argument support for logging methods
|
|
34
|
+
|
|
35
|
+
- **ShippingCarrier** `[Breaking Change]` - Removed reset() method and
|
|
36
|
+
immutable code property
|
|
37
|
+
- **BREAKING**: Removed `reset()` method - users should create new
|
|
38
|
+
ShippingCarrier instances
|
|
39
|
+
- Made `code` property immutable in `setData()` method
|
|
40
|
+
- Code is now preserved across all `setData()` calls
|
|
41
|
+
- Prevents accidental override of carrier identity
|
|
42
|
+
- Added `getAddedMethods()` public getter method
|
|
43
|
+
- Added `getRemovedMethods()` public getter method
|
|
44
|
+
- Better encapsulation with controlled access to method tracking arrays
|
|
45
|
+
|
|
46
|
+
#### 🛠️ Framework Components
|
|
47
|
+
|
|
48
|
+
- **CustomLogger** `[Enhanced]` - Variadic argument support
|
|
49
|
+
- Updated `debug()`, `info()`, and `error()` methods to accept variadic args
|
|
50
|
+
- Supports modern logging patterns like `logger.debug('User %s logged in', userId)`
|
|
51
|
+
- Full backward compatibility maintained
|
|
52
|
+
|
|
53
|
+
## [1.0.4] - 2025-10-29
|
|
54
|
+
|
|
55
|
+
### 🚀 Major Feature Release: Webhook Components & Shipping Carrier Builder
|
|
56
|
+
|
|
57
|
+
This minor release introduces powerful new components for Adobe Commerce webhook extensibility, including a comprehensive ShippingCarrier builder and WebhookAction component with signature verification. These additions enable developers to easily create custom shipping carriers and handle webhook requests securely.
|
|
58
|
+
|
|
59
|
+
#### 🎯 Commerce Components
|
|
60
|
+
|
|
61
|
+
- **ShippingCarrier** `[New]` - Fluent builder for custom shipping carrier creation
|
|
62
|
+
- Builder pattern implementation with method chaining support
|
|
63
|
+
- Comprehensive carrier configuration (title, stores, countries, sort order, active status)
|
|
64
|
+
- Shipping method management with add/remove capabilities
|
|
65
|
+
- Validation for carrier and method codes (alphanumeric and underscores only)
|
|
66
|
+
- Integration with WebhookActionResponse for seamless webhook responses
|
|
67
|
+
- Type-safe TypeScript interfaces for all data structures
|
|
68
|
+
- 100% test coverage with 67 comprehensive tests
|
|
69
|
+
|
|
70
|
+
- **ShippingCarrierMethod** `[New]` - Builder for individual shipping methods
|
|
71
|
+
- Configure method title, price, cost, and additional data
|
|
72
|
+
- Flexible additional data structure for custom metadata
|
|
73
|
+
- Returns structured method data via `getData()`
|
|
74
|
+
- Full TypeScript support with `ShippingCarrierMethodData` interface
|
|
75
|
+
|
|
76
|
+
- **ShippingCarrierResponse** `[New]` - Webhook response generator
|
|
77
|
+
- Generates WebhookActionResponse operations from ShippingCarrier instances
|
|
78
|
+
- Handles both added and removed shipping methods
|
|
79
|
+
- Creates proper operation structures for Adobe Commerce webhook extensibility
|
|
80
|
+
|
|
81
|
+
#### 🔧 Framework Components
|
|
82
|
+
|
|
83
|
+
- **WebhookAction** `[New]` - Secure webhook request handler with signature verification
|
|
84
|
+
- Built-in Adobe Commerce webhook signature verification
|
|
85
|
+
- Configurable signature verification (enabled/disabled)
|
|
86
|
+
- Wrapper around RuntimeAction for consistent request handling
|
|
87
|
+
- Support for required parameters and headers validation
|
|
88
|
+
- Integration with WebhookActionResponse for structured responses
|
|
89
|
+
- Comprehensive error handling and logging
|
|
90
|
+
|
|
91
|
+
- **WebhookActionResponse** `[New]` - Structured webhook response builder
|
|
92
|
+
- Success, exception, add, replace, and remove operations
|
|
93
|
+
- Type-safe response structures with TypeScript interfaces
|
|
94
|
+
- Compatible with Adobe Commerce webhook extensibility model
|
|
95
|
+
- Clean API for building complex webhook responses
|
|
96
|
+
|
|
97
|
+
#### 🛠️ Repository Components
|
|
98
|
+
|
|
99
|
+
- **FileRepository** `[Enhanced]` - File system timestamp integration
|
|
100
|
+
- Use file system properties for `createdAt` and `updatedAt` timestamps
|
|
101
|
+
- Retrieve timestamps using `files.getProperties()` method
|
|
102
|
+
- Timestamps reflect actual file system state
|
|
103
|
+
- Removed timestamps from file content for cleaner data storage
|
|
104
|
+
- Enhanced `metadata()` method for lightweight file listing without content
|
|
105
|
+
|
|
106
|
+
- **FileRepository** `[Enhanced]` - Metadata method for efficient file listing
|
|
107
|
+
- New `metadata()` method for retrieving file properties without reading content
|
|
108
|
+
- Significantly faster than `list()` for large file sets
|
|
109
|
+
- Returns file size, creation time, and modification time
|
|
110
|
+
- Supports both single file and batch metadata retrieval
|
|
111
|
+
|
|
112
|
+
- **FileRepository** `[Enhanced]` - Overwrite flag for controlled file writes
|
|
113
|
+
- New `overwrite` parameter in `save()` method
|
|
114
|
+
- Default behavior: merge with existing file (overwrite: false)
|
|
115
|
+
- Explicit overwrite: replace entire file (overwrite: true)
|
|
116
|
+
- Enhanced control over file update strategies
|
|
117
|
+
|
|
8
118
|
## [1.0.3] - 2025-10-23
|
|
9
119
|
|
|
10
120
|
### 🎨 New Experience Module & Enhanced Framework Components
|
package/README.md
CHANGED
|
@@ -91,6 +91,63 @@ const myEventConsumer = EventConsumerAction.execute(
|
|
|
91
91
|
exports.main = myEventConsumer;
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
#### `WebhookAction`
|
|
95
|
+
Secure webhook request handler with built-in Adobe Commerce signature verification.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const {
|
|
99
|
+
WebhookAction,
|
|
100
|
+
WebhookActionResponse,
|
|
101
|
+
SignatureVerification
|
|
102
|
+
} = require('@adobe-commerce/aio-toolkit');
|
|
103
|
+
|
|
104
|
+
// Create a webhook action with signature verification enabled
|
|
105
|
+
const myWebhook = WebhookAction.execute(
|
|
106
|
+
'order-webhook',
|
|
107
|
+
['orderId'], // Required parameters
|
|
108
|
+
['x-adobe-commerce-webhook-id'], // Required headers
|
|
109
|
+
SignatureVerification.ENABLED, // Enable signature verification
|
|
110
|
+
async (params, ctx) => {
|
|
111
|
+
const { orderId } = params;
|
|
112
|
+
const { logger } = ctx;
|
|
113
|
+
|
|
114
|
+
logger.info(`Processing order webhook: ${orderId}`);
|
|
115
|
+
|
|
116
|
+
// Your webhook logic here
|
|
117
|
+
// Return structured webhook response
|
|
118
|
+
return [
|
|
119
|
+
WebhookActionResponse.add('result', {
|
|
120
|
+
orderId: orderId,
|
|
121
|
+
status: 'processed',
|
|
122
|
+
timestamp: new Date().toISOString()
|
|
123
|
+
}),
|
|
124
|
+
WebhookActionResponse.success()
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// Export for Adobe I/O Runtime
|
|
130
|
+
exports.main = myWebhook;
|
|
131
|
+
|
|
132
|
+
// Disable signature verification for testing
|
|
133
|
+
const testWebhook = WebhookAction.execute(
|
|
134
|
+
'test-webhook',
|
|
135
|
+
['data'],
|
|
136
|
+
[],
|
|
137
|
+
SignatureVerification.DISABLED,
|
|
138
|
+
async (params, ctx) => {
|
|
139
|
+
return WebhookActionResponse.success();
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**WebhookActionResponse Operations:**
|
|
145
|
+
- `success()`: Indicates successful webhook processing
|
|
146
|
+
- `exception(message?, exceptionClass?)`: Returns error response
|
|
147
|
+
- `add(path, value, instance?)`: Adds data to response
|
|
148
|
+
- `replace(path, value, instance?)`: Replaces data in response
|
|
149
|
+
- `remove(path)`: Removes data from response
|
|
150
|
+
|
|
94
151
|
#### `PublishEvent`
|
|
95
152
|
Event publishing component for Adobe I/O Events with CloudEvents support.
|
|
96
153
|
|
|
@@ -229,11 +286,17 @@ exports.main = helloWorldAction;
|
|
|
229
286
|
File-based storage with CRUD operations for Adobe I/O Runtime applications.
|
|
230
287
|
|
|
231
288
|
**Key Methods:**
|
|
232
|
-
- `save(payload, id?)`: Saves data with optional ID parameter. The `id` parameter takes precedence over `payload.id`. IDs are automatically sanitized to alphanumeric + underscore characters.
|
|
233
|
-
- `load(id)`: Loads data by ID
|
|
234
|
-
- `list()`: Lists all stored records
|
|
289
|
+
- `save(payload, id?, overwrite?)`: Saves data with optional ID parameter and overwrite flag. The `id` parameter takes precedence over `payload.id`. IDs are automatically sanitized to alphanumeric + underscore characters. Set `overwrite: true` to replace entire file, or `false` (default) to merge with existing data.
|
|
290
|
+
- `load(id)`: Loads data by ID with file system timestamps (`createdAt`, `updatedAt`)
|
|
291
|
+
- `list()`: Lists all stored records with file system timestamps
|
|
292
|
+
- `metadata(id?)`: Retrieves file metadata (size, timestamps) without reading content - faster than `list()` for large datasets
|
|
235
293
|
- `delete(ids)`: Deletes records by ID array
|
|
236
294
|
|
|
295
|
+
**New in v1.0.4:**
|
|
296
|
+
- **File System Timestamps**: `createdAt` and `updatedAt` are now retrieved from actual file system properties instead of being stored in file content
|
|
297
|
+
- **Metadata Method**: New `metadata()` method for efficient file property retrieval without reading file content
|
|
298
|
+
- **Overwrite Flag**: Control file update strategy with `save(payload, id, overwrite)` - merge (default) or replace entire file
|
|
299
|
+
|
|
237
300
|
**Best Practice:** Create custom repository classes that extend FileRepository for specific entities.
|
|
238
301
|
|
|
239
302
|
##### **1. Define Entity Repository**
|
|
@@ -332,7 +395,69 @@ exports.main = RuntimeAction.execute(
|
|
|
332
395
|
);
|
|
333
396
|
```
|
|
334
397
|
|
|
335
|
-
##### **5.
|
|
398
|
+
##### **5. Save with Overwrite Flag**
|
|
399
|
+
Control file update strategy with the overwrite parameter:
|
|
400
|
+
|
|
401
|
+
```javascript
|
|
402
|
+
const { HttpMethod, RuntimeAction, RuntimeActionResponse } = require("@adobe-commerce/aio-toolkit");
|
|
403
|
+
const EntityRepository = require("@lib/EntityRepository");
|
|
404
|
+
|
|
405
|
+
exports.main = RuntimeAction.execute(
|
|
406
|
+
"entity-save-overwrite",
|
|
407
|
+
[HttpMethod.POST],
|
|
408
|
+
['name', 'status'],
|
|
409
|
+
['Authorization'],
|
|
410
|
+
async (params) => {
|
|
411
|
+
const entityRepository = new EntityRepository();
|
|
412
|
+
|
|
413
|
+
const payload = {
|
|
414
|
+
name: params.name,
|
|
415
|
+
status: params.status
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// Replace entire file instead of merging
|
|
419
|
+
const savedId = await entityRepository.save(payload, params.id, true);
|
|
420
|
+
|
|
421
|
+
return RuntimeActionResponse.success({
|
|
422
|
+
id: savedId,
|
|
423
|
+
message: 'Entity replaced successfully'
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
##### **6. Metadata Action**
|
|
430
|
+
Retrieve file metadata without reading content (faster for large datasets):
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
const { HttpMethod, RuntimeAction, RuntimeActionResponse } = require("@adobe-commerce/aio-toolkit");
|
|
434
|
+
const EntityRepository = require("@lib/EntityRepository");
|
|
435
|
+
|
|
436
|
+
exports.main = RuntimeAction.execute(
|
|
437
|
+
"entity-metadata",
|
|
438
|
+
[HttpMethod.POST],
|
|
439
|
+
[],
|
|
440
|
+
['Authorization'],
|
|
441
|
+
async (params) => {
|
|
442
|
+
const entityRepository = new EntityRepository();
|
|
443
|
+
|
|
444
|
+
// Get metadata for all files
|
|
445
|
+
const allMetadata = await entityRepository.metadata();
|
|
446
|
+
|
|
447
|
+
// Or get metadata for specific file
|
|
448
|
+
const singleMetadata = params.id
|
|
449
|
+
? await entityRepository.metadata(params.id)
|
|
450
|
+
: null;
|
|
451
|
+
|
|
452
|
+
return RuntimeActionResponse.success({
|
|
453
|
+
all: allMetadata,
|
|
454
|
+
single: singleMetadata
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
##### **7. Delete Action**
|
|
336
461
|
Delete entities by providing an array of IDs:
|
|
337
462
|
|
|
338
463
|
```javascript
|
|
@@ -458,6 +583,92 @@ const client = new AdobeCommerceClient('https://your-commerce-store.com/rest', c
|
|
|
458
583
|
const products = await client.get('V1/products');
|
|
459
584
|
```
|
|
460
585
|
|
|
586
|
+
#### `ShippingCarrier`
|
|
587
|
+
Fluent builder for creating custom shipping carriers for Adobe Commerce webhook extensibility.
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
const {
|
|
591
|
+
ShippingCarrier,
|
|
592
|
+
ShippingCarrierResponse
|
|
593
|
+
} = require('@adobe-commerce/aio-toolkit');
|
|
594
|
+
|
|
595
|
+
// Create a custom shipping carrier with methods
|
|
596
|
+
const carrier = new ShippingCarrier('fedex', (carrier) => {
|
|
597
|
+
carrier
|
|
598
|
+
.setTitle('FedEx Express')
|
|
599
|
+
.setStores(['default', 'store1'])
|
|
600
|
+
.setCountries(['US', 'CA', 'MX'])
|
|
601
|
+
.setSortOrder(10)
|
|
602
|
+
.setActive(true)
|
|
603
|
+
.setTrackingAvailable(true)
|
|
604
|
+
.setShippingLabelsAvailable(true)
|
|
605
|
+
.addMethod('standard', (method) => {
|
|
606
|
+
method
|
|
607
|
+
.setMethodTitle('Standard Shipping')
|
|
608
|
+
.setPrice(9.99)
|
|
609
|
+
.setCost(5.00)
|
|
610
|
+
.addAdditionalData('delivery_time', '3-5 business days')
|
|
611
|
+
.addAdditionalData('tracking_available', true);
|
|
612
|
+
})
|
|
613
|
+
.addMethod('express', (method) => {
|
|
614
|
+
method
|
|
615
|
+
.setMethodTitle('Express Shipping')
|
|
616
|
+
.setPrice(19.99)
|
|
617
|
+
.setCost(12.00)
|
|
618
|
+
.addAdditionalData('delivery_time', '1-2 business days');
|
|
619
|
+
})
|
|
620
|
+
.removeMethod('overnight'); // Remove a method
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// Get carrier configuration
|
|
624
|
+
const carrierData = carrier.getData();
|
|
625
|
+
console.log(carrierData);
|
|
626
|
+
|
|
627
|
+
// Access added and removed methods
|
|
628
|
+
const addedMethods = carrier.getAddedMethods(); // ['standard', 'express']
|
|
629
|
+
const removedMethods = carrier.getRemovedMethods(); // ['overnight']
|
|
630
|
+
|
|
631
|
+
// Generate webhook response operations
|
|
632
|
+
const response = new ShippingCarrierResponse(carrier);
|
|
633
|
+
const operations = response.generate();
|
|
634
|
+
return operations; // Use in webhook action
|
|
635
|
+
|
|
636
|
+
// Update carrier data (code is immutable)
|
|
637
|
+
carrier.setData({
|
|
638
|
+
code: 'ups', // This will be ignored - code remains 'fedex'
|
|
639
|
+
title: 'Demo Postal Service',
|
|
640
|
+
stores: ['default'],
|
|
641
|
+
countries: ['US', 'CA'],
|
|
642
|
+
sort_order: 10,
|
|
643
|
+
active: true,
|
|
644
|
+
tracking_available: true,
|
|
645
|
+
shipping_labels_available: true
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// Code property is immutable - create new instance if you need different code
|
|
649
|
+
const newCarrier = new ShippingCarrier('ups', (c) => {
|
|
650
|
+
c.addMethod('ground', (m) => {
|
|
651
|
+
m.setMethodTitle('UPS Ground').setPrice(12.99);
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**Key Features:**
|
|
657
|
+
- Builder pattern with method chaining
|
|
658
|
+
- Validation for carrier and method codes (alphanumeric and underscores only)
|
|
659
|
+
- Add and remove shipping methods dynamically
|
|
660
|
+
- Configure carrier properties (title, stores, countries, sort order, etc.)
|
|
661
|
+
- **Immutable code property** - prevents accidental carrier identity changes
|
|
662
|
+
- Public getter methods: `getAddedMethods()` and `getRemovedMethods()`
|
|
663
|
+
- Generate webhook response operations
|
|
664
|
+
- Type-safe TypeScript interfaces
|
|
665
|
+
|
|
666
|
+
**Validation Rules:**
|
|
667
|
+
- Carrier and method codes must contain only alphanumeric characters and underscores
|
|
668
|
+
- No spaces, hyphens, dots, or special characters allowed
|
|
669
|
+
- Empty or whitespace-only codes throw errors
|
|
670
|
+
- Code property cannot be changed after initialization
|
|
671
|
+
|
|
461
672
|
### 🎨 Experience Components
|
|
462
673
|
|
|
463
674
|
**Adobe Commerce Admin UI extension and user experience tools**
|
package/dist/index.d.mts
CHANGED
|
@@ -126,14 +126,26 @@ interface FileRecord {
|
|
|
126
126
|
updatedAt: string;
|
|
127
127
|
[key: string]: any;
|
|
128
128
|
}
|
|
129
|
+
interface FileMetadata {
|
|
130
|
+
name: string;
|
|
131
|
+
creationTime: Date;
|
|
132
|
+
lastModified: Date;
|
|
133
|
+
etag: string;
|
|
134
|
+
contentLength: number;
|
|
135
|
+
contentType: string;
|
|
136
|
+
isDirectory: boolean;
|
|
137
|
+
isPublic: boolean;
|
|
138
|
+
url: string;
|
|
139
|
+
}
|
|
129
140
|
|
|
130
141
|
declare class FileRepository {
|
|
131
142
|
private readonly filepath;
|
|
132
143
|
private files;
|
|
133
144
|
constructor(filepath: string);
|
|
134
145
|
list(): Promise<FileRecord[]>;
|
|
146
|
+
metadata(id?: string): Promise<FileMetadata | FileMetadata[]>;
|
|
135
147
|
load(id?: string): Promise<FileRecord>;
|
|
136
|
-
save(payload?: Partial<FileRecord>, id?: string | null): Promise<string | null>;
|
|
148
|
+
save(payload?: Partial<FileRecord>, id?: string | null, overwrite?: boolean): Promise<string | null>;
|
|
137
149
|
delete(ids?: string[]): Promise<FileRecord[]>;
|
|
138
150
|
private sanitizeFileId;
|
|
139
151
|
private getFiles;
|
|
@@ -160,6 +172,65 @@ declare class PublishEvent {
|
|
|
160
172
|
execute(providerId: string, eventCode: string, payload: any, subject?: string): Promise<PublishEventResult>;
|
|
161
173
|
}
|
|
162
174
|
|
|
175
|
+
declare enum WebhookActionOperation {
|
|
176
|
+
SUCCESS = "success",
|
|
177
|
+
EXCEPTION = "exception",
|
|
178
|
+
ADD = "add",
|
|
179
|
+
REPLACE = "replace",
|
|
180
|
+
REMOVE = "remove"
|
|
181
|
+
}
|
|
182
|
+
interface WebhookActionSuccessResponse {
|
|
183
|
+
op: typeof WebhookActionOperation.SUCCESS;
|
|
184
|
+
}
|
|
185
|
+
interface WebhookActionExceptionResponse {
|
|
186
|
+
op: typeof WebhookActionOperation.EXCEPTION;
|
|
187
|
+
class?: string;
|
|
188
|
+
message?: string;
|
|
189
|
+
}
|
|
190
|
+
interface WebhookActionAddResponse {
|
|
191
|
+
op: typeof WebhookActionOperation.ADD;
|
|
192
|
+
path: string;
|
|
193
|
+
value: any;
|
|
194
|
+
instance?: string;
|
|
195
|
+
}
|
|
196
|
+
interface WebhookActionReplaceResponse {
|
|
197
|
+
op: typeof WebhookActionOperation.REPLACE;
|
|
198
|
+
path: string;
|
|
199
|
+
value: any;
|
|
200
|
+
instance?: string;
|
|
201
|
+
}
|
|
202
|
+
interface WebhookActionRemoveResponse {
|
|
203
|
+
op: typeof WebhookActionOperation.REMOVE;
|
|
204
|
+
path: string;
|
|
205
|
+
}
|
|
206
|
+
type WebhookActionResponseType = WebhookActionSuccessResponse | WebhookActionExceptionResponse | WebhookActionAddResponse | WebhookActionReplaceResponse | WebhookActionRemoveResponse;
|
|
207
|
+
|
|
208
|
+
declare enum SignatureVerification {
|
|
209
|
+
ENABLED = "enabled",
|
|
210
|
+
DISABLED = "disabled"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class WebhookAction {
|
|
214
|
+
static execute(name?: string, requiredParams?: string[], requiredHeaders?: string[], signatureVerification?: SignatureVerification, action?: (params: {
|
|
215
|
+
[key: string]: any;
|
|
216
|
+
}, ctx: {
|
|
217
|
+
logger: any;
|
|
218
|
+
headers: {
|
|
219
|
+
[key: string]: any;
|
|
220
|
+
};
|
|
221
|
+
}) => Promise<WebhookActionResponseType | WebhookActionResponseType[]>): (params: {
|
|
222
|
+
[key: string]: any;
|
|
223
|
+
}) => Promise<RuntimeActionResponseType>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
declare class WebhookActionResponse {
|
|
227
|
+
static success(): WebhookActionSuccessResponse;
|
|
228
|
+
static exception(message?: string, exceptionClass?: string): WebhookActionExceptionResponse;
|
|
229
|
+
static add(path: string, value: any, instance?: string): WebhookActionAddResponse;
|
|
230
|
+
static replace(path: string, value: any, instance?: string): WebhookActionReplaceResponse;
|
|
231
|
+
static remove(path: string): WebhookActionRemoveResponse;
|
|
232
|
+
}
|
|
233
|
+
|
|
163
234
|
interface BearerTokenInfo {
|
|
164
235
|
token: string | null;
|
|
165
236
|
tokenLength: number;
|
|
@@ -382,12 +453,17 @@ interface Connection {
|
|
|
382
453
|
interface ExtendedRequestError extends RequestError {
|
|
383
454
|
responseBody?: any;
|
|
384
455
|
}
|
|
456
|
+
interface HttpsOptions {
|
|
457
|
+
rejectUnauthorized?: boolean;
|
|
458
|
+
[key: string]: any;
|
|
459
|
+
}
|
|
385
460
|
|
|
386
461
|
declare class AdobeCommerceClient {
|
|
387
462
|
private baseUrl;
|
|
388
463
|
private connection;
|
|
389
464
|
private logger;
|
|
390
|
-
|
|
465
|
+
private httpsOptions;
|
|
466
|
+
constructor(baseUrl: string, connection: Connection, logger?: any, httpsOptions?: HttpsOptions);
|
|
391
467
|
get(endpoint: string, headers?: Record<string, string>): Promise<any>;
|
|
392
468
|
post(endpoint: string, headers?: Record<string, string>, payload?: any): Promise<any>;
|
|
393
469
|
put(endpoint: string, headers?: Record<string, string>, payload?: any): Promise<any>;
|
|
@@ -450,6 +526,68 @@ declare class GenerateBasicAuthToken {
|
|
|
450
526
|
getState(): Promise<any>;
|
|
451
527
|
}
|
|
452
528
|
|
|
529
|
+
interface ShippingCarrierMethodAdditionalData {
|
|
530
|
+
key: string;
|
|
531
|
+
value: any;
|
|
532
|
+
}
|
|
533
|
+
interface ShippingCarrierMethodData {
|
|
534
|
+
carrier_code: string;
|
|
535
|
+
method: string;
|
|
536
|
+
method_title: string;
|
|
537
|
+
price: number;
|
|
538
|
+
cost: number;
|
|
539
|
+
additional_data: ShippingCarrierMethodAdditionalData[];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
interface ShippingCarrierData {
|
|
543
|
+
code: string;
|
|
544
|
+
title?: string;
|
|
545
|
+
stores?: string[];
|
|
546
|
+
countries?: string[];
|
|
547
|
+
sort_order?: number;
|
|
548
|
+
active?: boolean;
|
|
549
|
+
tracking_available?: boolean;
|
|
550
|
+
shipping_labels_available?: boolean;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
declare class ShippingCarrierMethod {
|
|
554
|
+
private methodData;
|
|
555
|
+
constructor(carrierCode: string, method: string);
|
|
556
|
+
setMethodTitle(methodTitle: string): this;
|
|
557
|
+
setPrice(price: number): this;
|
|
558
|
+
setCost(cost: number): this;
|
|
559
|
+
addAdditionalData(key: string, value: any): this;
|
|
560
|
+
getData(): ShippingCarrierMethodData;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
declare class ShippingCarrier {
|
|
564
|
+
private carrierData;
|
|
565
|
+
private addedMethods;
|
|
566
|
+
private removedMethods;
|
|
567
|
+
constructor(code: string, callback?: (builder: ShippingCarrier) => void);
|
|
568
|
+
private validateCarrierCode;
|
|
569
|
+
private validateMethodCode;
|
|
570
|
+
setTitle(title: string): this;
|
|
571
|
+
setStores(stores: string[]): this;
|
|
572
|
+
setCountries(countries: string[]): this;
|
|
573
|
+
setSortOrder(sortOrder: number): this;
|
|
574
|
+
setActive(active: boolean): this;
|
|
575
|
+
setTrackingAvailable(trackingAvailable: boolean): this;
|
|
576
|
+
setShippingLabelsAvailable(shippingLabelsAvailable: boolean): this;
|
|
577
|
+
setData(carrierData: ShippingCarrierData): this;
|
|
578
|
+
addMethod(method: string, callback?: (builder: ShippingCarrierMethod) => void): this;
|
|
579
|
+
removeMethod(method: string): this;
|
|
580
|
+
getData(): ShippingCarrierData;
|
|
581
|
+
getAddedMethods(): ShippingCarrierMethodData[];
|
|
582
|
+
getRemovedMethods(): string[];
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
declare class ShippingCarrierResponse {
|
|
586
|
+
private carrier;
|
|
587
|
+
constructor(carrier: ShippingCarrier);
|
|
588
|
+
generate(): WebhookActionResponseType[];
|
|
589
|
+
}
|
|
590
|
+
|
|
453
591
|
interface AdobeIMSConfig {
|
|
454
592
|
client_id: string;
|
|
455
593
|
client_secrets: string[];
|
|
@@ -683,4 +821,4 @@ declare class AdminUiSdk {
|
|
|
683
821
|
getRegistration(): AdminUiSdkRegistration;
|
|
684
822
|
}
|
|
685
823
|
|
|
686
|
-
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 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, type SuccessResponse, type TokenResult, Validator };
|
|
824
|
+
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 };
|