@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/dist/index.d.ts
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 };
|