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