@adobe-commerce/aio-toolkit 1.2.2 → 1.2.4
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 +136 -0
- package/README.md +145 -3
- package/dist/aio-toolkit-onboard-events/bin/cli.js.map +1 -1
- package/dist/index.d.mts +58 -4
- package/dist/index.d.ts +58 -4
- package/dist/index.js +193 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.d.mts
CHANGED
|
@@ -271,6 +271,16 @@ interface AbdbRecord {
|
|
|
271
271
|
[key: string]: unknown;
|
|
272
272
|
}
|
|
273
273
|
type AbdbRepositoryFilter = Record<string, unknown>;
|
|
274
|
+
type AbdbFindSortDirection = 'asc' | 'desc';
|
|
275
|
+
type AbdbFindSort = {
|
|
276
|
+
column: string;
|
|
277
|
+
direction?: AbdbFindSortDirection;
|
|
278
|
+
};
|
|
279
|
+
type AbdbFindOptions = {
|
|
280
|
+
current_page?: number;
|
|
281
|
+
page_size?: number;
|
|
282
|
+
sort?: AbdbFindSort;
|
|
283
|
+
};
|
|
274
284
|
|
|
275
285
|
declare class AbdbRepository<T extends AbdbRecord = AbdbRecord> {
|
|
276
286
|
private readonly _collection;
|
|
@@ -279,7 +289,7 @@ declare class AbdbRepository<T extends AbdbRecord = AbdbRecord> {
|
|
|
279
289
|
constructor(collection: AbdbCollection, token: string, region?: string);
|
|
280
290
|
getName(): string;
|
|
281
291
|
getCollection(): AbdbCollection;
|
|
282
|
-
find(filter?: AbdbRepositoryFilter): Promise<T[]>;
|
|
292
|
+
find(filter?: AbdbRepositoryFilter, options?: AbdbFindOptions): Promise<T[]>;
|
|
283
293
|
findOne(filter: AbdbRepositoryFilter): Promise<T | null>;
|
|
284
294
|
findById(id: string): Promise<T | null>;
|
|
285
295
|
delete(filter?: AbdbRepositoryFilter): Promise<Record<string, any>>;
|
|
@@ -329,7 +339,7 @@ interface WebhookActionSuccessResponse {
|
|
|
329
339
|
}
|
|
330
340
|
interface WebhookActionExceptionResponse {
|
|
331
341
|
op: typeof WebhookActionOperation.EXCEPTION;
|
|
332
|
-
|
|
342
|
+
type?: string;
|
|
333
343
|
message?: string;
|
|
334
344
|
}
|
|
335
345
|
interface WebhookActionAddResponse {
|
|
@@ -375,7 +385,7 @@ declare class WebhookAction {
|
|
|
375
385
|
|
|
376
386
|
declare class WebhookActionResponse {
|
|
377
387
|
static success(): WebhookActionSuccessResponse;
|
|
378
|
-
static exception(message?: string,
|
|
388
|
+
static exception(message?: string, exceptionType?: string): WebhookActionExceptionResponse;
|
|
379
389
|
static add(path: string, value: any, instance?: string): WebhookActionAddResponse;
|
|
380
390
|
static replace(path: string, value: any, instance?: string): WebhookActionReplaceResponse;
|
|
381
391
|
static remove(path: string): WebhookActionRemoveResponse;
|
|
@@ -788,6 +798,50 @@ declare class OnboardCommerce {
|
|
|
788
798
|
private logEventSubscriptionSummary;
|
|
789
799
|
}
|
|
790
800
|
|
|
801
|
+
type RabbitMQCredentials = {
|
|
802
|
+
host: string;
|
|
803
|
+
port: string;
|
|
804
|
+
username: string;
|
|
805
|
+
password: string;
|
|
806
|
+
vhost: string;
|
|
807
|
+
secure?: boolean;
|
|
808
|
+
};
|
|
809
|
+
type RabbitMQConsumeOptions = {
|
|
810
|
+
batchSize: number;
|
|
811
|
+
maxParallel: number;
|
|
812
|
+
nackRequeue?: boolean;
|
|
813
|
+
exchange?: string;
|
|
814
|
+
};
|
|
815
|
+
type MessageHandler = (queueName: string, content: string) => Promise<void> | void;
|
|
816
|
+
type ConsumeStats = {
|
|
817
|
+
consumed: number;
|
|
818
|
+
acked: number;
|
|
819
|
+
nacked: number;
|
|
820
|
+
errors: Array<{
|
|
821
|
+
content: string;
|
|
822
|
+
error: unknown;
|
|
823
|
+
}>;
|
|
824
|
+
};
|
|
825
|
+
type PublishStats = {
|
|
826
|
+
published: number;
|
|
827
|
+
failed: number;
|
|
828
|
+
errors: Array<{
|
|
829
|
+
payload: string;
|
|
830
|
+
error: unknown;
|
|
831
|
+
}>;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
declare class RabbitMQClient {
|
|
835
|
+
private readonly credentials;
|
|
836
|
+
constructor(credentials: RabbitMQCredentials);
|
|
837
|
+
consume(queueName: string, options: RabbitMQConsumeOptions, handler: MessageHandler): Promise<ConsumeStats>;
|
|
838
|
+
publish(queueName: string, payloads: string[]): Promise<PublishStats>;
|
|
839
|
+
private publishBatch;
|
|
840
|
+
private buildConnectionUrl;
|
|
841
|
+
private processBatch;
|
|
842
|
+
private processMessage;
|
|
843
|
+
}
|
|
844
|
+
|
|
791
845
|
declare class AdobeAuth {
|
|
792
846
|
static getToken(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: string[], currentContext?: string): Promise<string>;
|
|
793
847
|
}
|
|
@@ -1083,4 +1137,4 @@ declare class AdminUiSdk {
|
|
|
1083
1137
|
getRegistration(): AdminUiSdkRegistration;
|
|
1084
1138
|
}
|
|
1085
1139
|
|
|
1086
|
-
export { AbdbCollection, type AbdbCollectionCallback, AbdbColumn, type AbdbColumnJson, type AbdbColumnOptions, AbdbColumnType, type AbdbRecord, AbdbRepository, type AbdbRepositoryFilter, type AbdbRunCallback, type AddColumnOptions, AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, 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, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, 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, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
|
|
1140
|
+
export { AbdbCollection, type AbdbCollectionCallback, AbdbColumn, type AbdbColumnJson, type AbdbColumnOptions, AbdbColumnType, type AbdbFindOptions, type AbdbFindSort, type AbdbFindSortDirection, type AbdbRecord, AbdbRepository, type AbdbRepositoryFilter, type AbdbRunCallback, type AddColumnOptions, AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type ConsumeStats, 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, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, type MessageHandler, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type PublishStats, RabbitMQClient, type RabbitMQConsumeOptions, type RabbitMQCredentials, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -271,6 +271,16 @@ interface AbdbRecord {
|
|
|
271
271
|
[key: string]: unknown;
|
|
272
272
|
}
|
|
273
273
|
type AbdbRepositoryFilter = Record<string, unknown>;
|
|
274
|
+
type AbdbFindSortDirection = 'asc' | 'desc';
|
|
275
|
+
type AbdbFindSort = {
|
|
276
|
+
column: string;
|
|
277
|
+
direction?: AbdbFindSortDirection;
|
|
278
|
+
};
|
|
279
|
+
type AbdbFindOptions = {
|
|
280
|
+
current_page?: number;
|
|
281
|
+
page_size?: number;
|
|
282
|
+
sort?: AbdbFindSort;
|
|
283
|
+
};
|
|
274
284
|
|
|
275
285
|
declare class AbdbRepository<T extends AbdbRecord = AbdbRecord> {
|
|
276
286
|
private readonly _collection;
|
|
@@ -279,7 +289,7 @@ declare class AbdbRepository<T extends AbdbRecord = AbdbRecord> {
|
|
|
279
289
|
constructor(collection: AbdbCollection, token: string, region?: string);
|
|
280
290
|
getName(): string;
|
|
281
291
|
getCollection(): AbdbCollection;
|
|
282
|
-
find(filter?: AbdbRepositoryFilter): Promise<T[]>;
|
|
292
|
+
find(filter?: AbdbRepositoryFilter, options?: AbdbFindOptions): Promise<T[]>;
|
|
283
293
|
findOne(filter: AbdbRepositoryFilter): Promise<T | null>;
|
|
284
294
|
findById(id: string): Promise<T | null>;
|
|
285
295
|
delete(filter?: AbdbRepositoryFilter): Promise<Record<string, any>>;
|
|
@@ -329,7 +339,7 @@ interface WebhookActionSuccessResponse {
|
|
|
329
339
|
}
|
|
330
340
|
interface WebhookActionExceptionResponse {
|
|
331
341
|
op: typeof WebhookActionOperation.EXCEPTION;
|
|
332
|
-
|
|
342
|
+
type?: string;
|
|
333
343
|
message?: string;
|
|
334
344
|
}
|
|
335
345
|
interface WebhookActionAddResponse {
|
|
@@ -375,7 +385,7 @@ declare class WebhookAction {
|
|
|
375
385
|
|
|
376
386
|
declare class WebhookActionResponse {
|
|
377
387
|
static success(): WebhookActionSuccessResponse;
|
|
378
|
-
static exception(message?: string,
|
|
388
|
+
static exception(message?: string, exceptionType?: string): WebhookActionExceptionResponse;
|
|
379
389
|
static add(path: string, value: any, instance?: string): WebhookActionAddResponse;
|
|
380
390
|
static replace(path: string, value: any, instance?: string): WebhookActionReplaceResponse;
|
|
381
391
|
static remove(path: string): WebhookActionRemoveResponse;
|
|
@@ -788,6 +798,50 @@ declare class OnboardCommerce {
|
|
|
788
798
|
private logEventSubscriptionSummary;
|
|
789
799
|
}
|
|
790
800
|
|
|
801
|
+
type RabbitMQCredentials = {
|
|
802
|
+
host: string;
|
|
803
|
+
port: string;
|
|
804
|
+
username: string;
|
|
805
|
+
password: string;
|
|
806
|
+
vhost: string;
|
|
807
|
+
secure?: boolean;
|
|
808
|
+
};
|
|
809
|
+
type RabbitMQConsumeOptions = {
|
|
810
|
+
batchSize: number;
|
|
811
|
+
maxParallel: number;
|
|
812
|
+
nackRequeue?: boolean;
|
|
813
|
+
exchange?: string;
|
|
814
|
+
};
|
|
815
|
+
type MessageHandler = (queueName: string, content: string) => Promise<void> | void;
|
|
816
|
+
type ConsumeStats = {
|
|
817
|
+
consumed: number;
|
|
818
|
+
acked: number;
|
|
819
|
+
nacked: number;
|
|
820
|
+
errors: Array<{
|
|
821
|
+
content: string;
|
|
822
|
+
error: unknown;
|
|
823
|
+
}>;
|
|
824
|
+
};
|
|
825
|
+
type PublishStats = {
|
|
826
|
+
published: number;
|
|
827
|
+
failed: number;
|
|
828
|
+
errors: Array<{
|
|
829
|
+
payload: string;
|
|
830
|
+
error: unknown;
|
|
831
|
+
}>;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
declare class RabbitMQClient {
|
|
835
|
+
private readonly credentials;
|
|
836
|
+
constructor(credentials: RabbitMQCredentials);
|
|
837
|
+
consume(queueName: string, options: RabbitMQConsumeOptions, handler: MessageHandler): Promise<ConsumeStats>;
|
|
838
|
+
publish(queueName: string, payloads: string[]): Promise<PublishStats>;
|
|
839
|
+
private publishBatch;
|
|
840
|
+
private buildConnectionUrl;
|
|
841
|
+
private processBatch;
|
|
842
|
+
private processMessage;
|
|
843
|
+
}
|
|
844
|
+
|
|
791
845
|
declare class AdobeAuth {
|
|
792
846
|
static getToken(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: string[], currentContext?: string): Promise<string>;
|
|
793
847
|
}
|
|
@@ -1083,4 +1137,4 @@ declare class AdminUiSdk {
|
|
|
1083
1137
|
getRegistration(): AdminUiSdkRegistration;
|
|
1084
1138
|
}
|
|
1085
1139
|
|
|
1086
|
-
export { AbdbCollection, type AbdbCollectionCallback, AbdbColumn, type AbdbColumnJson, type AbdbColumnOptions, AbdbColumnType, type AbdbRecord, AbdbRepository, type AbdbRepositoryFilter, type AbdbRunCallback, type AddColumnOptions, AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, 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, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, 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, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
|
|
1140
|
+
export { AbdbCollection, type AbdbCollectionCallback, AbdbColumn, type AbdbColumnJson, type AbdbColumnOptions, AbdbColumnType, type AbdbFindOptions, type AbdbFindSort, type AbdbFindSortDirection, type AbdbRecord, AbdbRepository, type AbdbRepositoryFilter, type AbdbRunCallback, type AddColumnOptions, AdminUiSdk, type AdminUiSdkRegistration, AdobeAuth, AdobeCommerceClient, type AdobeIMSConfig, type BaseTelemetry, type BaseTelemetryValidator, BasicAuthConnection, BearerToken, type BearerTokenInfo, type CommerceEvent, type CommerceEventConfig, type CommerceEventField, type Connection, type ConsumeStats, 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, JsonMessageProcessor, type ListProvidersQueryParams, type ListRegistrationQueryParams, type MenuItem, type MessageHandler, Oauth1aConnection, OnboardCommerce, type OnboardCommerceConfig, type OnboardCommerceResult, OnboardEvents, type OnboardEventsInput, type OnboardEventsResponse, OnboardEvents as OnboardIOEvents, Openwhisk, OpenwhiskAction, type OpenwhiskConfig, type Page, Parameters, type Provider, type ProviderInputModel, ProviderManager, PublishEvent, type PublishEventResult, type PublishStats, RabbitMQClient, type RabbitMQConsumeOptions, type RabbitMQCredentials, type Registration, type RegistrationCreateModel, type RegistrationListResponse, RegistrationManager, RestClient, RuntimeAction, RuntimeActionResponse, type RuntimeActionResponseType, RuntimeApiGatewayService, ShippingCarrier, type ShippingCarrierData, ShippingCarrierMethod, type ShippingCarrierMethodAdditionalData, type ShippingCarrierMethodData, ShippingCarrierResponse, SignatureVerification, SuccessChecker, type SuccessResponse, Telemetry, TelemetryInputError, type TokenResult, Validator, WebhookAction, type WebhookActionAddResponse, type WebhookActionExceptionResponse, WebhookActionOperation, type WebhookActionRemoveResponse, type WebhookActionReplaceResponse, WebhookActionResponse, type WebhookActionResponseType, type WebhookActionSuccessResponse, type WorkspaceConfig };
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ __export(index_exports, {
|
|
|
64
64
|
Parameters: () => parameters_default,
|
|
65
65
|
ProviderManager: () => provider_default,
|
|
66
66
|
PublishEvent: () => publish_event_default,
|
|
67
|
+
RabbitMQClient: () => rabbit_mq_client_default,
|
|
67
68
|
RegistrationManager: () => registration_default,
|
|
68
69
|
RestClient: () => rest_client_default,
|
|
69
70
|
RuntimeAction: () => runtime_action_default,
|
|
@@ -5946,11 +5947,15 @@ var _AbdbCollection = class _AbdbCollection {
|
|
|
5946
5947
|
const collection = await client.collection(this._name);
|
|
5947
5948
|
return await callback(collection, client);
|
|
5948
5949
|
} catch (error) {
|
|
5949
|
-
if (error instanceof import_aio_lib_db.DbError) {
|
|
5950
|
-
|
|
5950
|
+
if (import_aio_lib_db.DbError && error instanceof import_aio_lib_db.DbError) {
|
|
5951
|
+
const dbErr = new Error(`AbdbCollection: database error: ${error.message}`);
|
|
5952
|
+
dbErr.cause = error;
|
|
5953
|
+
throw dbErr;
|
|
5951
5954
|
}
|
|
5952
5955
|
const detail = error instanceof Error ? error.message : String(error);
|
|
5953
|
-
|
|
5956
|
+
const unexpectedErr = new Error(`AbdbCollection: unexpected error: ${detail}`);
|
|
5957
|
+
unexpectedErr.cause = error;
|
|
5958
|
+
throw unexpectedErr;
|
|
5954
5959
|
} finally {
|
|
5955
5960
|
await client?.close();
|
|
5956
5961
|
}
|
|
@@ -6043,13 +6048,31 @@ var _AbdbRepository = class _AbdbRepository {
|
|
|
6043
6048
|
* Returns all documents matching `filter` as an array.
|
|
6044
6049
|
* Passing no filter (or an empty object) returns every document in the collection.
|
|
6045
6050
|
*
|
|
6051
|
+
* Pagination and sorting are applied in the following MongoDB cursor order:
|
|
6052
|
+
* `.find(filter)` → `.sort(...)` → `.skip(...)` → `.limit(...)` → `.toArray()`
|
|
6053
|
+
*
|
|
6046
6054
|
* @param filter - Optional query filter (default: `{}`)
|
|
6055
|
+
* @param options - Optional pagination and sort configuration
|
|
6056
|
+
* @param options.sort - Column and direction to sort by (`'asc'` maps to `1`, `'desc'` to `-1`)
|
|
6057
|
+
* @param options.page_size - Maximum number of documents to return
|
|
6058
|
+
* @param options.current_page - 1-based page index; combined with `page_size` to compute `.skip()`
|
|
6047
6059
|
* @returns Array of matched documents (may be empty)
|
|
6048
6060
|
*/
|
|
6049
|
-
async find(filter = {}) {
|
|
6061
|
+
async find(filter = {}, options = {}) {
|
|
6050
6062
|
return this._collection.run(
|
|
6051
6063
|
async (collection) => {
|
|
6052
|
-
|
|
6064
|
+
const { current_page, page_size, sort } = options;
|
|
6065
|
+
let cursor = collection.find(filter);
|
|
6066
|
+
if (sort?.column) {
|
|
6067
|
+
cursor = cursor.sort({ [sort.column]: sort.direction === "desc" ? -1 : 1 });
|
|
6068
|
+
}
|
|
6069
|
+
if (page_size !== void 0 && page_size > 0) {
|
|
6070
|
+
if (current_page !== void 0 && current_page > 1) {
|
|
6071
|
+
cursor = cursor.skip((current_page - 1) * page_size);
|
|
6072
|
+
}
|
|
6073
|
+
cursor = cursor.limit(page_size);
|
|
6074
|
+
}
|
|
6075
|
+
return cursor.toArray();
|
|
6053
6076
|
},
|
|
6054
6077
|
this._token,
|
|
6055
6078
|
this._region
|
|
@@ -6470,7 +6493,7 @@ var _WebhookActionResponse = class _WebhookActionResponse {
|
|
|
6470
6493
|
* processing the webhook. This helps with debugging and error tracking.
|
|
6471
6494
|
*
|
|
6472
6495
|
* @param message - Optional error message describing what went wrong
|
|
6473
|
-
* @param
|
|
6496
|
+
* @param exceptionType - Optional exception type name for categorization (e.g., 'Magento\\Framework\\Exception\\LocalizedException')
|
|
6474
6497
|
* @returns An exception response object
|
|
6475
6498
|
*
|
|
6476
6499
|
* @example
|
|
@@ -6492,15 +6515,15 @@ var _WebhookActionResponse = class _WebhookActionResponse {
|
|
|
6492
6515
|
* });
|
|
6493
6516
|
* ```
|
|
6494
6517
|
*/
|
|
6495
|
-
static exception(message,
|
|
6518
|
+
static exception(message, exceptionType) {
|
|
6496
6519
|
const response = {
|
|
6497
6520
|
op: "exception" /* EXCEPTION */
|
|
6498
6521
|
};
|
|
6499
6522
|
if (message !== void 0) {
|
|
6500
6523
|
response.message = message;
|
|
6501
6524
|
}
|
|
6502
|
-
if (
|
|
6503
|
-
response.
|
|
6525
|
+
if (exceptionType !== void 0) {
|
|
6526
|
+
response.type = exceptionType;
|
|
6504
6527
|
}
|
|
6505
6528
|
return response;
|
|
6506
6529
|
}
|
|
@@ -11757,6 +11780,166 @@ __name(_OnboardCommerce, "OnboardCommerce");
|
|
|
11757
11780
|
var OnboardCommerce = _OnboardCommerce;
|
|
11758
11781
|
var onboard_commerce_default = OnboardCommerce;
|
|
11759
11782
|
|
|
11783
|
+
// src/integration/rabbit-mq-client/index.ts
|
|
11784
|
+
var import_amqplib = __toESM(require("amqplib"));
|
|
11785
|
+
var _RabbitMQClient = class _RabbitMQClient {
|
|
11786
|
+
/**
|
|
11787
|
+
* @param credentials - AMQP connection credentials (host, port, username, password, vhost).
|
|
11788
|
+
*/
|
|
11789
|
+
constructor(credentials) {
|
|
11790
|
+
this.credentials = credentials;
|
|
11791
|
+
}
|
|
11792
|
+
/**
|
|
11793
|
+
* Opens an AMQP connection, checks queue depth, and pulls up to
|
|
11794
|
+
* `effectiveBatch = min(batchSize, messageCount)` messages via channel.get.
|
|
11795
|
+
* Messages are processed in parallel windows of `maxParallel`. channel.get returns
|
|
11796
|
+
* false when the queue is empty, so the method exits deterministically without any
|
|
11797
|
+
* cancellation logic. The connection is always closed in a `finally` block.
|
|
11798
|
+
*
|
|
11799
|
+
* @param queueName - Name of the queue to consume from.
|
|
11800
|
+
* @param options - Consume configuration (batchSize, maxParallel, nackRequeue, exchange).
|
|
11801
|
+
* @param handler - Callback invoked with the queue name and decoded string content of each message.
|
|
11802
|
+
* @returns Counts of consumed, acked, and nacked messages; plus per-failure details in `errors`.
|
|
11803
|
+
* @throws Propagates connection, exchange-assertion, or queue-assertion errors to the caller.
|
|
11804
|
+
*/
|
|
11805
|
+
async consume(queueName, options, handler) {
|
|
11806
|
+
const connection = await import_amqplib.default.connect(this.buildConnectionUrl());
|
|
11807
|
+
let channel;
|
|
11808
|
+
try {
|
|
11809
|
+
channel = await connection.createChannel();
|
|
11810
|
+
if (options.exchange) {
|
|
11811
|
+
await channel.assertExchange(options.exchange, "direct", { durable: true });
|
|
11812
|
+
await channel.assertQueue(queueName, { durable: true });
|
|
11813
|
+
await channel.bindQueue(queueName, options.exchange, queueName);
|
|
11814
|
+
} else {
|
|
11815
|
+
await channel.assertQueue(queueName, { durable: true });
|
|
11816
|
+
}
|
|
11817
|
+
return await this.processBatch(channel, queueName, options, handler);
|
|
11818
|
+
} finally {
|
|
11819
|
+
try {
|
|
11820
|
+
await channel?.close();
|
|
11821
|
+
} catch {
|
|
11822
|
+
}
|
|
11823
|
+
await connection.close();
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
/**
|
|
11827
|
+
* Opens an AMQP connection, asserts the queue, and enqueues each payload in `payloads`.
|
|
11828
|
+
* Each payload is sent as a persistent message via `sendToQueue`. If the write buffer is
|
|
11829
|
+
* full (`sendToQueue` returns `false`), the message is still counted as published and the
|
|
11830
|
+
* method waits for the channel's `drain` event before continuing, to respect backpressure
|
|
11831
|
+
* without losing messages. Only genuine send errors (thrown exceptions) are counted as
|
|
11832
|
+
* failures. The connection is always closed in a `finally` block regardless of outcome.
|
|
11833
|
+
*
|
|
11834
|
+
* @param queueName - Name of the queue to publish to.
|
|
11835
|
+
* @param payloads - Array of string payloads to enqueue.
|
|
11836
|
+
* @returns Counts of published and failed messages; plus per-failure details in `errors`.
|
|
11837
|
+
* @throws Propagates connection or queue-assertion errors to the caller.
|
|
11838
|
+
*/
|
|
11839
|
+
async publish(queueName, payloads) {
|
|
11840
|
+
const connection = await import_amqplib.default.connect(this.buildConnectionUrl());
|
|
11841
|
+
let channel;
|
|
11842
|
+
try {
|
|
11843
|
+
channel = await connection.createChannel();
|
|
11844
|
+
await channel.assertQueue(queueName, { durable: true });
|
|
11845
|
+
return await this.publishBatch(channel, queueName, payloads);
|
|
11846
|
+
} finally {
|
|
11847
|
+
try {
|
|
11848
|
+
await channel?.close();
|
|
11849
|
+
} catch {
|
|
11850
|
+
}
|
|
11851
|
+
await connection.close();
|
|
11852
|
+
}
|
|
11853
|
+
}
|
|
11854
|
+
/**
|
|
11855
|
+
* Sends each payload to the queue via `sendToQueue`. Tracks published and failed counts.
|
|
11856
|
+
* When `sendToQueue` returns `false` (write buffer full / backpressure), the message is
|
|
11857
|
+
* still counted as published — it is already accepted by the channel — and the loop
|
|
11858
|
+
* pauses until the channel emits `drain` before continuing, preventing unbounded memory
|
|
11859
|
+
* pressure. A payload is only counted as failed when `sendToQueue` throws an error.
|
|
11860
|
+
*/
|
|
11861
|
+
async publishBatch(channel, queueName, payloads) {
|
|
11862
|
+
const stats = { published: 0, failed: 0, errors: [] };
|
|
11863
|
+
for (const payload of payloads) {
|
|
11864
|
+
try {
|
|
11865
|
+
const sent = channel.sendToQueue(queueName, Buffer.from(payload), { persistent: true });
|
|
11866
|
+
stats.published++;
|
|
11867
|
+
if (!sent) {
|
|
11868
|
+
await new Promise((resolve) => channel.once("drain", resolve));
|
|
11869
|
+
}
|
|
11870
|
+
} catch (error) {
|
|
11871
|
+
stats.failed++;
|
|
11872
|
+
stats.errors.push({ payload, error });
|
|
11873
|
+
}
|
|
11874
|
+
}
|
|
11875
|
+
return stats;
|
|
11876
|
+
}
|
|
11877
|
+
/**
|
|
11878
|
+
* Builds the AMQP connection URL from the stored credentials.
|
|
11879
|
+
* Uses `amqps://` when `secure` is true, `amqp://` otherwise.
|
|
11880
|
+
* Username, password, and vhost are percent-encoded to handle special characters.
|
|
11881
|
+
*/
|
|
11882
|
+
buildConnectionUrl() {
|
|
11883
|
+
const { host, port, username, password, vhost, secure = false } = this.credentials;
|
|
11884
|
+
const protocol = secure ? "amqps" : "amqp";
|
|
11885
|
+
return `${protocol}://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${port}/${encodeURIComponent(vhost)}`;
|
|
11886
|
+
}
|
|
11887
|
+
/**
|
|
11888
|
+
* Checks queue depth via channel.checkQueue, then pulls up to
|
|
11889
|
+
* `effectiveBatch = min(batchSize, messageCount)` messages using channel.get
|
|
11890
|
+
* (AMQP basic.get). Messages are processed in parallel windows of `maxParallel`:
|
|
11891
|
+
* each window pulls up to `maxParallel` messages sequentially, then processes them
|
|
11892
|
+
* concurrently via Promise.all before moving to the next window.
|
|
11893
|
+
*
|
|
11894
|
+
* channel.get returns false when the queue is empty, so the loop exits immediately
|
|
11895
|
+
* if siblings have drained the queue — no consumer registration, no cancel, no hang.
|
|
11896
|
+
*/
|
|
11897
|
+
async processBatch(channel, queueName, options, handler) {
|
|
11898
|
+
const stats = { consumed: 0, acked: 0, nacked: 0, errors: [] };
|
|
11899
|
+
const { batchSize, maxParallel } = options;
|
|
11900
|
+
const { messageCount } = await channel.checkQueue(queueName);
|
|
11901
|
+
if (messageCount === 0) return stats;
|
|
11902
|
+
const effectiveBatch = Math.min(batchSize, messageCount);
|
|
11903
|
+
while (stats.consumed < effectiveBatch) {
|
|
11904
|
+
const windowSize = Math.min(maxParallel, effectiveBatch - stats.consumed);
|
|
11905
|
+
const window = [];
|
|
11906
|
+
for (let i = 0; i < windowSize; i++) {
|
|
11907
|
+
const msg = await channel.get(queueName, { noAck: false });
|
|
11908
|
+
if (!msg) break;
|
|
11909
|
+
window.push(msg);
|
|
11910
|
+
stats.consumed++;
|
|
11911
|
+
}
|
|
11912
|
+
if (window.length === 0) break;
|
|
11913
|
+
await Promise.all(
|
|
11914
|
+
window.map((msg) => this.processMessage(channel, queueName, msg, stats, options, handler))
|
|
11915
|
+
);
|
|
11916
|
+
if (window.length < windowSize) break;
|
|
11917
|
+
}
|
|
11918
|
+
return stats;
|
|
11919
|
+
}
|
|
11920
|
+
/**
|
|
11921
|
+
* Invokes `handler` with the queue name and decoded message content. Acks on success.
|
|
11922
|
+
* On failure, nacks the message and records the content and error in `stats.errors`.
|
|
11923
|
+
* Whether to requeue on nack is controlled by `options.nackRequeue` (default: true).
|
|
11924
|
+
*/
|
|
11925
|
+
async processMessage(channel, queueName, msg, stats, options, handler) {
|
|
11926
|
+
const { nackRequeue = true } = options;
|
|
11927
|
+
const content = msg.content.toString();
|
|
11928
|
+
try {
|
|
11929
|
+
await handler(queueName, content);
|
|
11930
|
+
channel.ack(msg);
|
|
11931
|
+
stats.acked++;
|
|
11932
|
+
} catch (error) {
|
|
11933
|
+
channel.nack(msg, false, nackRequeue);
|
|
11934
|
+
stats.errors.push({ content, error });
|
|
11935
|
+
stats.nacked++;
|
|
11936
|
+
}
|
|
11937
|
+
}
|
|
11938
|
+
};
|
|
11939
|
+
__name(_RabbitMQClient, "RabbitMQClient");
|
|
11940
|
+
var RabbitMQClient = _RabbitMQClient;
|
|
11941
|
+
var rabbit_mq_client_default = RabbitMQClient;
|
|
11942
|
+
|
|
11760
11943
|
// src/commerce/adobe-commerce-client/index.ts
|
|
11761
11944
|
var import_got = __toESM(require("got"));
|
|
11762
11945
|
var _AdobeCommerceClient = class _AdobeCommerceClient {
|
|
@@ -12777,6 +12960,7 @@ var AdminUiSdk = _AdminUiSdk;
|
|
|
12777
12960
|
Parameters,
|
|
12778
12961
|
ProviderManager,
|
|
12779
12962
|
PublishEvent,
|
|
12963
|
+
RabbitMQClient,
|
|
12780
12964
|
RegistrationManager,
|
|
12781
12965
|
RestClient,
|
|
12782
12966
|
RuntimeAction,
|