@adobe-commerce/aio-toolkit 1.0.1 → 1.0.3
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 +90 -0
- package/README.md +208 -17
- package/dist/index.d.mts +61 -9
- package/dist/index.d.ts +61 -9
- package/dist/index.js +550 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +533 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,96 @@ 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.3] - 2025-10-23
|
|
9
|
+
|
|
10
|
+
### 🎨 New Experience Module & Enhanced Framework Components
|
|
11
|
+
|
|
12
|
+
This patch release introduces a comprehensive new Experience module with AdminUiSdk for Adobe Commerce Admin UI extensions, enhanced IMS token caching with State library integration, Adobe I/O event publishing capabilities with CloudEvents compliance, and critical bug fixes for authentication endpoints. All changes maintain backward compatibility while adding powerful new functionality.
|
|
13
|
+
|
|
14
|
+
#### 🎨 Experience Components
|
|
15
|
+
|
|
16
|
+
- **AdminUiSdk** `[New]` - Adobe Commerce Admin UI extension management
|
|
17
|
+
- Create and manage menu items, sections, and page configurations programmatically
|
|
18
|
+
- Full namespaced ID support (e.g., `dataMappingTool::appBuilderApplication`)
|
|
19
|
+
- Parent-child menu relationships with external references (`Magento_Backend::system`)
|
|
20
|
+
- Comprehensive validation and error handling with detailed error messages
|
|
21
|
+
- Type-safe TypeScript interfaces for MenuItem, Page, and AdminUiSdkRegistration
|
|
22
|
+
- **BREAKING CHANGE**: Accepts full IDs without automatic prefixing for real-world usage patterns
|
|
23
|
+
|
|
24
|
+
#### 🔧 Framework Components
|
|
25
|
+
|
|
26
|
+
- **CustomLogger** `[New]` - Centralized null-safe logging utility
|
|
27
|
+
- Consistent logging interface with debug, info, and error methods across all components
|
|
28
|
+
- Graceful handling of missing or null logger instances without throwing errors
|
|
29
|
+
- Seamless integration with Adobe I/O Runtime logger
|
|
30
|
+
|
|
31
|
+
- **PublishEvent** `[New]` - Adobe I/O Event Publishing with CloudEvents compliance
|
|
32
|
+
- CloudEvents specification compliance with proper event structure
|
|
33
|
+
- UUID generation for unique event tracking and correlation
|
|
34
|
+
- Comprehensive validation for IMS organization ID, API keys, and access tokens
|
|
35
|
+
- Integration with CustomLogger for consistent error handling and debugging
|
|
36
|
+
- Support for custom event subjects and structured payload data
|
|
37
|
+
|
|
38
|
+
#### 🛠️ Commerce Components
|
|
39
|
+
|
|
40
|
+
- **GenerateImsToken** `[Enhanced]` - IMS token caching using Adobe I/O State library
|
|
41
|
+
- Automatic token caching and refresh using Adobe I/O State library for performance optimization
|
|
42
|
+
- Token validation and automatic renewal before expiration
|
|
43
|
+
- Enhanced error handling and logging for token operations
|
|
44
|
+
- **BREAKING CHANGE**: ImsConnection constructor simplified - no longer requires currentContext parameter
|
|
45
|
+
|
|
46
|
+
#### 🐛 Critical Bug Fixes
|
|
47
|
+
|
|
48
|
+
- **BasicAuthConnection Token Endpoint Construction** `[Resolved]`
|
|
49
|
+
- **Problem**: Duplicate `/rest/rest/` segments in token endpoints for base URLs ending with '/rest'
|
|
50
|
+
- **Root Cause**: Improper URL concatenation when base URL already contained REST endpoint path
|
|
51
|
+
- **Solution**: Enhanced createTokenEndpoint() method with intelligent URL parsing and construction
|
|
52
|
+
- **Impact**: Correct token endpoint generation for all base URL formats, maintaining backward compatibility
|
|
53
|
+
|
|
54
|
+
## [1.0.2] - 2025-09-30
|
|
55
|
+
|
|
56
|
+
### 🛠️ Framework Component Enhancements & Critical Bug Fixes
|
|
57
|
+
|
|
58
|
+
This minor release introduces significant enhancements to core framework components, resolving critical issues and adding comprehensive new functionality. Both changes maintain full backward compatibility while substantially improving developer experience and API integration capabilities.
|
|
59
|
+
|
|
60
|
+
#### 🔧 Framework Components
|
|
61
|
+
|
|
62
|
+
- **FileRepository** `[Enhanced]` - Optional ID parameter support and standardized file management
|
|
63
|
+
- Optional ID parameter in save method: `save(payload, id?)` signature
|
|
64
|
+
- ID parameter takes precedence over payload.id property
|
|
65
|
+
- Automatic ID sanitization (alphanumeric + underscore characters only)
|
|
66
|
+
- Fallback to timestamp-based ID generation for invalid inputs
|
|
67
|
+
- Enhanced return value: method now returns sanitized filename string instead of boolean
|
|
68
|
+
- Standardized date formatting with ISO 8601 format for all timestamps
|
|
69
|
+
- Property naming consistency: `created_at` → `createdAt`, `updated_at` → `updatedAt`
|
|
70
|
+
- String-only ID handling across all methods with comprehensive error handling
|
|
71
|
+
- Enhanced type safety with null return values on failures
|
|
72
|
+
|
|
73
|
+
#### 🔗 Integration Components
|
|
74
|
+
|
|
75
|
+
- **RestClient** `[Enhanced]` - Comprehensive payload type support resolving critical compatibility issues
|
|
76
|
+
- URLSearchParams support for form-encoded requests (resolves Issue #40)
|
|
77
|
+
- FormData support for file uploads and multipart request handling
|
|
78
|
+
- String payload support for text and XML request transmission
|
|
79
|
+
- Binary data support for Buffer, ArrayBuffer, and Uint8Array objects
|
|
80
|
+
- Smart Content-Type management with user header preservation
|
|
81
|
+
- Intelligent Content-Type defaults per payload type when not specified
|
|
82
|
+
- Full backward compatibility maintained for existing JSON usage
|
|
83
|
+
- Enhanced OAuth2 authentication flow support and form-based API integrations
|
|
84
|
+
|
|
85
|
+
#### 🐛 Critical Bug Fixes
|
|
86
|
+
|
|
87
|
+
- **Issue #41 - FileRepository Save Method Enhancement** `[Resolved]`
|
|
88
|
+
- **Problem**: Missing ID parameter support, incorrect return type, inconsistent date formatting
|
|
89
|
+
- **Solution**: Complete method signature overhaul with flexible ID handling and proper return types
|
|
90
|
+
- **Impact**: Enables advanced file management workflows with explicit ID control
|
|
91
|
+
|
|
92
|
+
- **Issue #40 - RestClient URLSearchParams Failure** `[Resolved]`
|
|
93
|
+
- **Problem**: `makeRequest()` failed with 405 Method Not Allowed for form-encoded POST requests
|
|
94
|
+
- **Root Cause**: Always JSON.stringify() payloads and forced 'application/json' Content-Type
|
|
95
|
+
- **Solution**: Intelligent payload type detection with appropriate serialization and headers
|
|
96
|
+
- **Impact**: Enables OAuth2 authentication flows and form-based API integrations
|
|
97
|
+
|
|
8
98
|
## [1.0.1] - 2025-09-22
|
|
9
99
|
|
|
10
100
|
### 🚀 Enhanced Developer Experience & API Improvements
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
A comprehensive TypeScript toolkit for Adobe App Builder applications providing standardized Adobe Commerce integrations, I/O Events orchestration, file storage utilities, authentication helpers, and robust backend development tools with 100% test coverage.
|
|
5
|
+
A comprehensive TypeScript toolkit for Adobe App Builder applications providing standardized Adobe Commerce integrations, I/O Events orchestration, file storage utilities, authentication helpers, and robust backend development tools with 100% test coverage and enterprise-grade reliability.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ npm install @adobe-commerce/aio-toolkit
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
The toolkit is organized into
|
|
15
|
+
The toolkit is organized into five main modules:
|
|
16
16
|
|
|
17
17
|
### 🛠️ Framework Components
|
|
18
18
|
|
|
@@ -91,6 +91,55 @@ const myEventConsumer = EventConsumerAction.execute(
|
|
|
91
91
|
exports.main = myEventConsumer;
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
#### `PublishEvent`
|
|
95
|
+
Event publishing component for Adobe I/O Events with CloudEvents support.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const { PublishEvent } = require('@adobe-commerce/aio-toolkit');
|
|
99
|
+
|
|
100
|
+
// Initialize the publisher
|
|
101
|
+
const publishEvent = new PublishEvent(
|
|
102
|
+
'your-ims-org-id@AdobeOrg',
|
|
103
|
+
'your-api-key',
|
|
104
|
+
'your-access-token',
|
|
105
|
+
logger // Optional custom logger
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Publish a simple event
|
|
109
|
+
const result = await publishEvent.execute(
|
|
110
|
+
'your-provider-id',
|
|
111
|
+
'commerce.order.created',
|
|
112
|
+
{
|
|
113
|
+
orderId: 'ORD-123456',
|
|
114
|
+
customerId: 'CUST-789',
|
|
115
|
+
amount: 199.99,
|
|
116
|
+
currency: 'USD'
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
console.log(`Event published: ${result.eventId}, Status: ${result.status}`);
|
|
121
|
+
|
|
122
|
+
// Publish an event with subject
|
|
123
|
+
const orderResult = await publishEvent.execute(
|
|
124
|
+
'commerce-provider',
|
|
125
|
+
'com.adobe.commerce.order.shipped',
|
|
126
|
+
{
|
|
127
|
+
orderId: 'ORD-123456',
|
|
128
|
+
trackingNumber: 'TRK-789',
|
|
129
|
+
carrier: 'UPS',
|
|
130
|
+
estimatedDelivery: '2023-12-05T18:00:00Z'
|
|
131
|
+
},
|
|
132
|
+
'orders/ORD-123456'
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
// Handle publishing results
|
|
136
|
+
if (orderResult.status === 'published') {
|
|
137
|
+
console.log(`Order shipped event published successfully: ${orderResult.eventId}`);
|
|
138
|
+
} else {
|
|
139
|
+
console.error(`Failed to publish event: ${orderResult.error}`);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
94
143
|
#### `GraphQlAction`
|
|
95
144
|
GraphQL server implementation with schema validation and introspection control.
|
|
96
145
|
|
|
@@ -180,7 +229,7 @@ exports.main = helloWorldAction;
|
|
|
180
229
|
File-based storage with CRUD operations for Adobe I/O Runtime applications.
|
|
181
230
|
|
|
182
231
|
**Key Methods:**
|
|
183
|
-
- `save(payload)`: Saves data
|
|
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.
|
|
184
233
|
- `load(id)`: Loads data by ID
|
|
185
234
|
- `list()`: Lists all stored records
|
|
186
235
|
- `delete(ids)`: Deletes records by ID array
|
|
@@ -244,7 +293,7 @@ exports.main = RuntimeAction.execute(
|
|
|
244
293
|
```
|
|
245
294
|
|
|
246
295
|
##### **4. Save Action**
|
|
247
|
-
Save entity data with
|
|
296
|
+
Save entity data with flexible ID handling using the new optional ID parameter:
|
|
248
297
|
|
|
249
298
|
```javascript
|
|
250
299
|
const { HttpMethod, RuntimeAction, RuntimeActionResponse } = require("@adobe-commerce/aio-toolkit");
|
|
@@ -263,15 +312,22 @@ exports.main = RuntimeAction.execute(
|
|
|
263
312
|
async (params) => {
|
|
264
313
|
const entityRepository = new EntityRepository();
|
|
265
314
|
|
|
315
|
+
// Build payload with required fields
|
|
266
316
|
let payload = {};
|
|
267
317
|
for (const fieldName in requiredParams) {
|
|
268
318
|
payload[requiredParams[fieldName]] = params[requiredParams[fieldName]];
|
|
269
319
|
}
|
|
270
|
-
if (Object.prototype.hasOwnProperty.call(params, 'id')) {
|
|
271
|
-
payload['id'] = params['id'];
|
|
272
|
-
}
|
|
273
320
|
|
|
274
|
-
|
|
321
|
+
// Extract ID parameter for prioritized handling
|
|
322
|
+
const explicitId = params.id || params.customId || null;
|
|
323
|
+
|
|
324
|
+
// Save with optional ID parameter - it takes precedence over payload.id
|
|
325
|
+
const savedId = await entityRepository.save(payload, explicitId);
|
|
326
|
+
|
|
327
|
+
return RuntimeActionResponse.success({
|
|
328
|
+
id: savedId,
|
|
329
|
+
message: 'Entity saved successfully'
|
|
330
|
+
});
|
|
275
331
|
}
|
|
276
332
|
);
|
|
277
333
|
```
|
|
@@ -297,9 +353,11 @@ exports.main = RuntimeAction.execute(
|
|
|
297
353
|
|
|
298
354
|
This approach provides:
|
|
299
355
|
- **Separation of concerns**: Each CRUD operation has its own action file
|
|
300
|
-
- **Reusable repository**: Custom repository can be shared across actions
|
|
356
|
+
- **Reusable repository**: Custom repository can be shared across actions
|
|
301
357
|
- **Proper validation**: Required parameters and headers are enforced
|
|
302
358
|
- **Consistent responses**: All actions use RuntimeActionResponse for standardized output
|
|
359
|
+
- **Flexible ID management**: Support for explicit IDs, payload IDs, and auto-generation
|
|
360
|
+
- **Automatic sanitization**: IDs are cleaned to ensure file system compatibility
|
|
303
361
|
|
|
304
362
|
### 🏪 Commerce Components
|
|
305
363
|
|
|
@@ -327,24 +385,110 @@ console.log('Authentication token:', token);
|
|
|
327
385
|
#### `AdobeCommerceClient`
|
|
328
386
|
HTTP client for Adobe Commerce API integration with multiple authentication methods.
|
|
329
387
|
|
|
388
|
+
**OAuth 1.0a Authentication**
|
|
330
389
|
```typescript
|
|
331
|
-
const { AdobeCommerceClient } = require('@adobe-commerce/aio-toolkit');
|
|
332
|
-
const { Oauth1aConnection } = require('@adobe-commerce/aio-toolkit');
|
|
390
|
+
const { AdobeCommerceClient, Oauth1aConnection } = require('@adobe-commerce/aio-toolkit');
|
|
333
391
|
|
|
334
392
|
const connection = new Oauth1aConnection(
|
|
335
393
|
'consumer-key',
|
|
336
394
|
'consumer-secret',
|
|
337
395
|
'access-token',
|
|
338
396
|
'access-token-secret',
|
|
339
|
-
logger
|
|
397
|
+
logger // Optional custom logger
|
|
340
398
|
);
|
|
341
399
|
|
|
342
400
|
// Create client
|
|
401
|
+
const client = new AdobeCommerceClient('https://your-commerce-store.com/rest', connection);
|
|
402
|
+
|
|
403
|
+
// Make API calls
|
|
404
|
+
const products = await client.get('V1/products');
|
|
405
|
+
const newProduct = await client.post('V1/products', {}, productData);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**IMS (Identity Management System) Authentication**
|
|
409
|
+
```typescript
|
|
410
|
+
const { AdobeCommerceClient, ImsConnection } = require('@adobe-commerce/aio-toolkit');
|
|
411
|
+
|
|
412
|
+
const connection = new ImsConnection(
|
|
413
|
+
'client-id',
|
|
414
|
+
'client-secret',
|
|
415
|
+
'technical-account-id',
|
|
416
|
+
'technical-account-email',
|
|
417
|
+
'ims-org-id',
|
|
418
|
+
['AdobeID', 'openid', 'adobeio_api'], // Scopes array
|
|
419
|
+
logger // Optional custom logger
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
// Create client with IMS authentication
|
|
343
423
|
const client = new AdobeCommerceClient('https://your-commerce-store.com', connection);
|
|
344
424
|
|
|
425
|
+
// Make API calls - tokens are automatically cached and refreshed
|
|
426
|
+
const products = await client.get('V1/products');
|
|
427
|
+
const newProduct = await client.post('V1/products', {}, productData);
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Enhanced IMS Token Caching**
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
const { GenerateImsToken } = require('@adobe-commerce/aio-toolkit');
|
|
434
|
+
|
|
435
|
+
const tokenGenerator = new GenerateImsToken(
|
|
436
|
+
'client-id', 'client-secret', 'technical-account-id',
|
|
437
|
+
'technical-account-email', 'ims-org-id',
|
|
438
|
+
['AdobeID', 'openid', 'adobeio_api'], logger
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
const token = await tokenGenerator.execute();
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**Basic Authentication**
|
|
445
|
+
```typescript
|
|
446
|
+
const { AdobeCommerceClient, BasicAuthConnection } = require('@adobe-commerce/aio-toolkit');
|
|
447
|
+
|
|
448
|
+
const connection = new BasicAuthConnection(
|
|
449
|
+
'username',
|
|
450
|
+
'password',
|
|
451
|
+
logger // Optional custom logger
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
// Create client
|
|
455
|
+
const client = new AdobeCommerceClient('https://your-commerce-store.com/rest', connection);
|
|
456
|
+
|
|
345
457
|
// Make API calls
|
|
346
|
-
const products = await client.get('
|
|
347
|
-
|
|
458
|
+
const products = await client.get('V1/products');
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### 🎨 Experience Components
|
|
462
|
+
|
|
463
|
+
**Adobe Commerce Admin UI extension and user experience tools**
|
|
464
|
+
|
|
465
|
+
#### `AdminUiSdk`
|
|
466
|
+
Create and manage Adobe Commerce Admin UI extensions with menu items, sections, and page configurations.
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
const { AdminUiSdk } = require('@adobe-commerce/aio-toolkit');
|
|
470
|
+
|
|
471
|
+
const sdk = new AdminUiSdk('dataMappingTool');
|
|
472
|
+
|
|
473
|
+
// Add menu section with external parent
|
|
474
|
+
sdk.addMenuSection(
|
|
475
|
+
'dataMappingTool::checkout_integration',
|
|
476
|
+
'Checkout Integration',
|
|
477
|
+
100,
|
|
478
|
+
'Magento_Backend::system'
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
// Add menu item
|
|
482
|
+
sdk.addMenuItem(
|
|
483
|
+
'dataMappingTool::application',
|
|
484
|
+
'Application',
|
|
485
|
+
1,
|
|
486
|
+
'dataMappingTool::checkout_integration'
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
// Set page title and get registration
|
|
490
|
+
sdk.addPage('Data Mapping Tool Dashboard');
|
|
491
|
+
const registration = sdk.getRegistration();
|
|
348
492
|
```
|
|
349
493
|
|
|
350
494
|
### 🔗 Integration Components
|
|
@@ -352,16 +496,63 @@ const newProduct = await client.post('rest/V1/products', {}, productData);
|
|
|
352
496
|
**External API integration and utility functions**
|
|
353
497
|
|
|
354
498
|
#### `RestClient`
|
|
355
|
-
HTTP client for external API integration.
|
|
499
|
+
HTTP client for external API integration with support for various payload types.
|
|
356
500
|
|
|
501
|
+
**Basic Usage**
|
|
357
502
|
```typescript
|
|
358
503
|
const { RestClient } = require('@adobe-commerce/aio-toolkit');
|
|
359
504
|
|
|
360
505
|
const client = new RestClient();
|
|
506
|
+
|
|
507
|
+
// GET request
|
|
361
508
|
const response = await client.get('https://api.example.com/data', {
|
|
362
|
-
'Authorization': 'Bearer token'
|
|
363
|
-
|
|
509
|
+
'Authorization': 'Bearer token'
|
|
510
|
+
});
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
**JSON Payloads (default)**
|
|
514
|
+
```typescript
|
|
515
|
+
// POST with JSON (automatic Content-Type: application/json)
|
|
516
|
+
const jsonData = { name: 'Product', price: 99.99 };
|
|
517
|
+
const response = await client.post('https://api.example.com/products', {
|
|
518
|
+
'Authorization': 'Bearer token'
|
|
519
|
+
}, jsonData);
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
**Form-Encoded Requests**
|
|
523
|
+
```typescript
|
|
524
|
+
// URLSearchParams for form-encoded data (automatic Content-Type: application/x-www-form-urlencoded)
|
|
525
|
+
const formData = new URLSearchParams({
|
|
526
|
+
grant_type: 'client_credentials',
|
|
527
|
+
client_id: 'your-client-id',
|
|
528
|
+
client_secret: 'your-client-secret'
|
|
364
529
|
});
|
|
530
|
+
|
|
531
|
+
const tokenResponse = await client.post('https://auth.example.com/token', {
|
|
532
|
+
Accept: 'application/json'
|
|
533
|
+
}, formData);
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**File Upload**
|
|
537
|
+
```typescript
|
|
538
|
+
// FormData for file uploads (Content-Type boundary handled automatically)
|
|
539
|
+
const uploadData = new FormData();
|
|
540
|
+
uploadData.append('file', fileBuffer, 'document.pdf');
|
|
541
|
+
uploadData.append('description', 'Important document');
|
|
542
|
+
|
|
543
|
+
const uploadResponse = await client.post('https://api.example.com/upload', {
|
|
544
|
+
'Authorization': 'Bearer token'
|
|
545
|
+
}, uploadData);
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
**Text/XML Payloads**
|
|
549
|
+
```typescript
|
|
550
|
+
// String payloads with custom content type
|
|
551
|
+
const xmlData = '<?xml version="1.0"?><order><id>123</id></order>';
|
|
552
|
+
const xmlResponse = await client.post('https://api.example.com/orders', {
|
|
553
|
+
'Authorization': 'Bearer token',
|
|
554
|
+
'Content-Type': 'application/xml'
|
|
555
|
+
}, xmlData);
|
|
365
556
|
```
|
|
366
557
|
|
|
367
558
|
#### `BearerToken`
|
package/dist/index.d.mts
CHANGED
|
@@ -121,9 +121,9 @@ declare class OpenwhiskAction {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
interface FileRecord {
|
|
124
|
-
id: string
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
id: string;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
updatedAt: string;
|
|
127
127
|
[key: string]: any;
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -133,11 +133,33 @@ declare class FileRepository {
|
|
|
133
133
|
constructor(filepath: string);
|
|
134
134
|
list(): Promise<FileRecord[]>;
|
|
135
135
|
load(id?: string): Promise<FileRecord>;
|
|
136
|
-
save(payload?: Partial<FileRecord
|
|
137
|
-
delete(ids?:
|
|
136
|
+
save(payload?: Partial<FileRecord>, id?: string | null): Promise<string | null>;
|
|
137
|
+
delete(ids?: string[]): Promise<FileRecord[]>;
|
|
138
|
+
private sanitizeFileId;
|
|
138
139
|
private getFiles;
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
interface EventData {
|
|
143
|
+
type: string;
|
|
144
|
+
data: any;
|
|
145
|
+
subject?: string;
|
|
146
|
+
}
|
|
147
|
+
interface PublishEventResult {
|
|
148
|
+
eventId: string;
|
|
149
|
+
status: 'published' | 'failed';
|
|
150
|
+
publishedAt: string;
|
|
151
|
+
error?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class PublishEvent {
|
|
155
|
+
private readonly imsOrgId;
|
|
156
|
+
private readonly apiKey;
|
|
157
|
+
private readonly accessToken;
|
|
158
|
+
private readonly customLogger;
|
|
159
|
+
constructor(imsOrgId: string, apiKey: string, accessToken: string, logger?: any);
|
|
160
|
+
execute(providerId: string, eventCode: string, payload: any, subject?: string): Promise<PublishEventResult>;
|
|
161
|
+
}
|
|
162
|
+
|
|
141
163
|
interface BearerTokenInfo {
|
|
142
164
|
token: string | null;
|
|
143
165
|
tokenLength: number;
|
|
@@ -401,9 +423,8 @@ declare class ImsConnection implements Connection {
|
|
|
401
423
|
private technicalAccountEmail;
|
|
402
424
|
private imsOrgId;
|
|
403
425
|
private scopes;
|
|
404
|
-
private
|
|
405
|
-
|
|
406
|
-
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any, currentContext?: string);
|
|
426
|
+
private customLogger;
|
|
427
|
+
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any);
|
|
407
428
|
extend(commerceGot: any): Promise<any>;
|
|
408
429
|
}
|
|
409
430
|
|
|
@@ -422,6 +443,7 @@ declare class GenerateBasicAuthToken {
|
|
|
422
443
|
constructor(baseUrl: string, username: string, password: string, logger?: any);
|
|
423
444
|
execute(): Promise<string | null>;
|
|
424
445
|
getCommerceToken(): Promise<TokenResult | null>;
|
|
446
|
+
createTokenEndpoint(): string;
|
|
425
447
|
createEndpoint(endpoint: string): string;
|
|
426
448
|
setValue(result: TokenResult): Promise<boolean>;
|
|
427
449
|
getValue(): Promise<string | null>;
|
|
@@ -631,4 +653,34 @@ interface GetRegistrationQueryParams {
|
|
|
631
653
|
registrationId: string;
|
|
632
654
|
}
|
|
633
655
|
|
|
634
|
-
|
|
656
|
+
interface MenuItem {
|
|
657
|
+
id: string;
|
|
658
|
+
title: string;
|
|
659
|
+
sortOrder: number;
|
|
660
|
+
parent?: string;
|
|
661
|
+
isSection?: boolean;
|
|
662
|
+
}
|
|
663
|
+
interface Page {
|
|
664
|
+
title: string;
|
|
665
|
+
}
|
|
666
|
+
interface AdminUiSdkRegistration {
|
|
667
|
+
registration: {
|
|
668
|
+
menuItems?: MenuItem[];
|
|
669
|
+
page?: Page;
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
declare class AdminUiSdk {
|
|
674
|
+
private extensionId;
|
|
675
|
+
private menuItems;
|
|
676
|
+
private pageTitle?;
|
|
677
|
+
constructor(extensionId: string);
|
|
678
|
+
private isValidExtensionId;
|
|
679
|
+
private isValidMenuId;
|
|
680
|
+
addMenuItem(id: string, title: string, sortOrder: number, parent?: string): void;
|
|
681
|
+
addMenuSection(id: string, title: string, sortOrder: number, parent?: string): void;
|
|
682
|
+
addPage(title: string): void;
|
|
683
|
+
getRegistration(): AdminUiSdkRegistration;
|
|
684
|
+
}
|
|
685
|
+
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -121,9 +121,9 @@ declare class OpenwhiskAction {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
interface FileRecord {
|
|
124
|
-
id: string
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
id: string;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
updatedAt: string;
|
|
127
127
|
[key: string]: any;
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -133,11 +133,33 @@ declare class FileRepository {
|
|
|
133
133
|
constructor(filepath: string);
|
|
134
134
|
list(): Promise<FileRecord[]>;
|
|
135
135
|
load(id?: string): Promise<FileRecord>;
|
|
136
|
-
save(payload?: Partial<FileRecord
|
|
137
|
-
delete(ids?:
|
|
136
|
+
save(payload?: Partial<FileRecord>, id?: string | null): Promise<string | null>;
|
|
137
|
+
delete(ids?: string[]): Promise<FileRecord[]>;
|
|
138
|
+
private sanitizeFileId;
|
|
138
139
|
private getFiles;
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
interface EventData {
|
|
143
|
+
type: string;
|
|
144
|
+
data: any;
|
|
145
|
+
subject?: string;
|
|
146
|
+
}
|
|
147
|
+
interface PublishEventResult {
|
|
148
|
+
eventId: string;
|
|
149
|
+
status: 'published' | 'failed';
|
|
150
|
+
publishedAt: string;
|
|
151
|
+
error?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class PublishEvent {
|
|
155
|
+
private readonly imsOrgId;
|
|
156
|
+
private readonly apiKey;
|
|
157
|
+
private readonly accessToken;
|
|
158
|
+
private readonly customLogger;
|
|
159
|
+
constructor(imsOrgId: string, apiKey: string, accessToken: string, logger?: any);
|
|
160
|
+
execute(providerId: string, eventCode: string, payload: any, subject?: string): Promise<PublishEventResult>;
|
|
161
|
+
}
|
|
162
|
+
|
|
141
163
|
interface BearerTokenInfo {
|
|
142
164
|
token: string | null;
|
|
143
165
|
tokenLength: number;
|
|
@@ -401,9 +423,8 @@ declare class ImsConnection implements Connection {
|
|
|
401
423
|
private technicalAccountEmail;
|
|
402
424
|
private imsOrgId;
|
|
403
425
|
private scopes;
|
|
404
|
-
private
|
|
405
|
-
|
|
406
|
-
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any, currentContext?: string);
|
|
426
|
+
private customLogger;
|
|
427
|
+
constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any);
|
|
407
428
|
extend(commerceGot: any): Promise<any>;
|
|
408
429
|
}
|
|
409
430
|
|
|
@@ -422,6 +443,7 @@ declare class GenerateBasicAuthToken {
|
|
|
422
443
|
constructor(baseUrl: string, username: string, password: string, logger?: any);
|
|
423
444
|
execute(): Promise<string | null>;
|
|
424
445
|
getCommerceToken(): Promise<TokenResult | null>;
|
|
446
|
+
createTokenEndpoint(): string;
|
|
425
447
|
createEndpoint(endpoint: string): string;
|
|
426
448
|
setValue(result: TokenResult): Promise<boolean>;
|
|
427
449
|
getValue(): Promise<string | null>;
|
|
@@ -631,4 +653,34 @@ interface GetRegistrationQueryParams {
|
|
|
631
653
|
registrationId: string;
|
|
632
654
|
}
|
|
633
655
|
|
|
634
|
-
|
|
656
|
+
interface MenuItem {
|
|
657
|
+
id: string;
|
|
658
|
+
title: string;
|
|
659
|
+
sortOrder: number;
|
|
660
|
+
parent?: string;
|
|
661
|
+
isSection?: boolean;
|
|
662
|
+
}
|
|
663
|
+
interface Page {
|
|
664
|
+
title: string;
|
|
665
|
+
}
|
|
666
|
+
interface AdminUiSdkRegistration {
|
|
667
|
+
registration: {
|
|
668
|
+
menuItems?: MenuItem[];
|
|
669
|
+
page?: Page;
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
declare class AdminUiSdk {
|
|
674
|
+
private extensionId;
|
|
675
|
+
private menuItems;
|
|
676
|
+
private pageTitle?;
|
|
677
|
+
constructor(extensionId: string);
|
|
678
|
+
private isValidExtensionId;
|
|
679
|
+
private isValidMenuId;
|
|
680
|
+
addMenuItem(id: string, title: string, sortOrder: number, parent?: string): void;
|
|
681
|
+
addMenuSection(id: string, title: string, sortOrder: number, parent?: string): void;
|
|
682
|
+
addPage(title: string): void;
|
|
683
|
+
getRegistration(): AdminUiSdkRegistration;
|
|
684
|
+
}
|
|
685
|
+
|
|
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 };
|