@adobe-commerce/aio-toolkit 1.0.7 → 1.0.9

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/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import openwhisk, { Dict, Activation } from 'openwhisk';
2
+ import { EntrypointInstrumentationConfig } from '@adobe/aio-lib-telemetry';
3
+ import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
4
+ import { SdkLogRecord } from '@adobe/aio-lib-telemetry/otel';
2
5
  import { Response } from 'node-fetch';
3
6
  import { Logger } from '@adobe/aio-sdk';
4
7
  import { Got, RequestError } from 'got';
@@ -39,6 +42,9 @@ interface ErrorResponse {
39
42
  type RuntimeActionResponseType = SuccessResponse | ErrorResponse;
40
43
 
41
44
  declare class RuntimeAction {
45
+ private static actionType;
46
+ static setActionType(type: string): void;
47
+ static getActionType(): string;
42
48
  static execute(name?: string, httpMethods?: HttpMethod[], requiredParams?: string[], requiredHeaders?: string[], action?: (params: {
43
49
  [key: string]: any;
44
50
  }, ctx: {
@@ -262,7 +268,7 @@ declare class RuntimeApiGatewayService {
262
268
  private readonly imsToken;
263
269
  private readonly restClient;
264
270
  private readonly customLogger;
265
- constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, namespace: string, logger?: any);
271
+ constructor(namespace: string, imsOrgId: string, imsToken: string, logger?: any);
266
272
  private buildEndpoint;
267
273
  private getAuthenticatedHeaders;
268
274
  get(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
@@ -271,6 +277,41 @@ declare class RuntimeApiGatewayService {
271
277
  delete(endpoint: string, additionalHeaders?: Record<string, string>): Promise<any>;
272
278
  }
273
279
 
280
+ interface BaseTelemetryValidator {
281
+ isConfigured(params: Record<string, unknown>): boolean;
282
+ validateConfiguration(params: Record<string, unknown>): void;
283
+ }
284
+ interface BaseTelemetry {
285
+ canInitialize(params: Record<string, unknown>): boolean;
286
+ getConfig(): EntrypointInstrumentationConfig;
287
+ initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
288
+ }
289
+
290
+ declare class Telemetry {
291
+ static createLogger(name: string, params: Record<string, unknown>): any;
292
+ static formatError(error: unknown): Record<string, unknown>;
293
+ static initialize(action: (params: Record<string, unknown>) => any): (params: Record<string, unknown>) => any;
294
+ }
295
+
296
+ declare class TelemetryInputError extends Error {
297
+ constructor(message: string);
298
+ }
299
+
300
+ declare class SuccessChecker {
301
+ execute(result: unknown): boolean;
302
+ }
303
+
304
+ declare class JsonMessageProcessor implements LogRecordProcessor {
305
+ private readonly wrappedProcessor;
306
+ constructor(wrappedProcessor: LogRecordProcessor);
307
+ private parseJavaScriptObjectNotation;
308
+ private flattenObject;
309
+ onEmit(logRecord: SdkLogRecord): void;
310
+ private mapSeverityNumberToLevel;
311
+ forceFlush(): Promise<void>;
312
+ shutdown(): Promise<void>;
313
+ }
314
+
274
315
  interface BearerTokenInfo {
275
316
  token: string | null;
276
317
  tokenLength: number;
@@ -644,14 +685,9 @@ declare class Oauth1aConnection implements Connection {
644
685
  }
645
686
 
646
687
  declare class ImsConnection implements Connection {
647
- private clientId;
648
- private clientSecret;
649
- private technicalAccountId;
650
- private technicalAccountEmail;
651
- private imsOrgId;
652
- private scopes;
653
- private customLogger;
654
- constructor(clientId: string, clientSecret: string, technicalAccountId: string, technicalAccountEmail: string, imsOrgId: string, scopes: Array<string>, logger?: any);
688
+ private readonly imsToken;
689
+ private readonly customLogger;
690
+ constructor(imsToken: string, logger?: any);
655
691
  extend(commerceGot: any): Promise<any>;
656
692
  }
657
693
 
@@ -919,4 +955,4 @@ declare class AdminUiSdk {
919
955
  getRegistration(): AdminUiSdkRegistration;
920
956
  }
921
957
 
922
- 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 };
958
+ export { 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 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 };