@marcohefti/request-network-api-client 0.5.1 → 0.5.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.
@@ -3627,11 +3627,35 @@ interface RequestClient {
3627
3627
  /** Legacy pay endpoints */
3628
3628
  pay: PayApi;
3629
3629
  }
3630
+ /**
3631
+ * Creates a Request Network API client with typed domain facades.
3632
+ *
3633
+ * @param options - Client configuration options
3634
+ * @param options.baseUrl - API base URL (defaults to production if not provided)
3635
+ * @param options.apiKey - API key for server-side authentication
3636
+ * @param options.clientId - Client ID for browser/frontend authentication
3637
+ * @param options.runtimeValidation - Enable/disable runtime validation (default: true)
3638
+ * @param options.logLevel - Logging level: 'silent' | 'error' | 'info' | 'debug' (default: 'error')
3639
+ * @param options.logger - Custom logger function
3640
+ * @param options.userAgent - Custom user agent string
3641
+ * @param options.retry - Retry configuration
3642
+ *
3643
+ * @returns RequestClient instance with domain APIs
3644
+ *
3645
+ * @example
3646
+ * ```ts
3647
+ * import { createRequestClient, RequestEnvironment } from '@marcohefti/request-network-api-client';
3648
+ *
3649
+ * const client = createRequestClient({
3650
+ * baseUrl: RequestEnvironment.production,
3651
+ * apiKey: process.env.REQUEST_API_KEY,
3652
+ * logLevel: 'info',
3653
+ * });
3654
+ *
3655
+ * const tokens = await client.currencies.list({ network: 'sepolia' });
3656
+ * ```
3657
+ */
3630
3658
  declare function createRequestClient(options?: CreateClientOptions): RequestClient;
3631
- interface EnvOptions {
3632
- env?: NodeJS.ProcessEnv;
3633
- }
3634
- declare function createRequestClientFromEnv(options?: EnvOptions): RequestClient;
3635
3659
 
3636
3660
  declare const RequestEnvironment: {
3637
3661
  readonly production: "https://api.request.network";
@@ -5475,4 +5499,4 @@ declare namespace index {
5475
5499
  export { type index_CreateWebhookMiddlewareOptions as CreateWebhookMiddlewareOptions, index_DEFAULT_SIGNATURE_ALGORITHM as DEFAULT_SIGNATURE_ALGORITHM, index_DEFAULT_SIGNATURE_HEADER as DEFAULT_SIGNATURE_HEADER, type index_GetRawBody as GetRawBody, type index_InferDispatcherPayload as InferDispatcherPayload, type NormalisedHeaders as NormalizedWebhookHeaders, type index_ParseWebhookEventOptions as ParseWebhookEventOptions, type index_ParsedWebhookEvent as ParsedWebhookEvent, index_RequestWebhookSignatureError as RequestWebhookSignatureError, type index_ShouldSkipVerification as ShouldSkipVerification, type index_VerifyWebhookSignatureOptions as VerifyWebhookSignatureOptions, type index_VerifyWebhookSignatureResult as VerifyWebhookSignatureResult, index_WEBHOOK_EVENT_NAMES as WEBHOOK_EVENT_NAMES, type index_WebhookDispatchContext as WebhookDispatchContext, index_WebhookDispatcher as WebhookDispatcher, type index_WebhookEventName as WebhookEventName, type index_WebhookHandler as WebhookHandler, type index_WebhookHeaders as WebhookHeaders, type index_WebhookLogger as WebhookLogger, type index_WebhookPayload as WebhookPayload, type index_WebhookPayloadMap as WebhookPayloadMap, type index_WebhookRequest as WebhookRequest, type index_WebhookSignatureErrorReason as WebhookSignatureErrorReason, index_createWebhookDispatcher as createWebhookDispatcher, index_createWebhookMiddleware as createWebhookMiddleware, index$1 as events, index_getWebhookSchema as getWebhookSchema, index_isRequestWebhookSignatureError as isRequestWebhookSignatureError, index_parseWebhookEvent as parseWebhookEvent, testing_webhook as testing, index_verifyWebhookSignature as verifyWebhookSignature };
5476
5500
  }
5477
5501
 
5478
- export { type BuildRequestApiErrorOptions, type CreateClientOptions, HttpAdapter, HttpClient, Interceptor, type ParseRegistryOptions, type ParseResult, type ParseWithSchemaOptions, RequestApiError, type RequestClient, RequestEnvironment, type RequestEnvironmentName, type RequestErrorDetail, type RequestErrorMetadata, RequestOptions, RetryConfig, RuntimeValidationOption, type SchemaKey, type SchemaKind, type SchemaOutput, SchemaRegistry, ValidationError, browserFetchAdapter, buildRequestApiError, createHttpClient, createRequestClient, createRequestClientFromEnv, index$8 as currenciesV1, isRequestApiError, nodeFetchAdapter, parseWithRegistry, parseWithSchema, index$6 as pay, index$7 as payV1, index$5 as payerV1, index$4 as payerV2, index$3 as payments, index$2 as requestsV1, schemaRegistry, index as webhooks };
5502
+ export { type BuildRequestApiErrorOptions, type CreateClientOptions, HttpAdapter, HttpClient, Interceptor, type ParseRegistryOptions, type ParseResult, type ParseWithSchemaOptions, RequestApiError, type RequestClient, RequestEnvironment, type RequestEnvironmentName, type RequestErrorDetail, type RequestErrorMetadata, RequestOptions, RetryConfig, RuntimeValidationOption, type SchemaKey, type SchemaKind, type SchemaOutput, SchemaRegistry, ValidationError, browserFetchAdapter, buildRequestApiError, createHttpClient, createRequestClient, index$8 as currenciesV1, isRequestApiError, nodeFetchAdapter, parseWithRegistry, parseWithSchema, index$6 as pay, index$7 as payV1, index$5 as payerV1, index$4 as payerV2, index$3 as payments, index$2 as requestsV1, schemaRegistry, index as webhooks };
package/dist/esm/index.js CHANGED
@@ -2308,13 +2308,6 @@ function createRequestClient(options) {
2308
2308
  pay: createPayApi(http)
2309
2309
  };
2310
2310
  }
2311
- function createRequestClientFromEnv(options) {
2312
- const env = options?.env ?? process.env;
2313
- const baseUrl = env.REQUEST_API_URL ?? env.REQUEST_SDK_BASE_URL;
2314
- const apiKey = env.REQUEST_API_KEY ?? env.REQUEST_SDK_API_KEY;
2315
- const clientId = env.REQUEST_CLIENT_ID ?? env.REQUEST_SDK_CLIENT_ID;
2316
- return createRequestClient({ baseUrl, apiKey, clientId });
2317
- }
2318
2311
 
2319
2312
  // src/core/config/request-environment.config.ts
2320
2313
  var RequestEnvironment = {
@@ -3383,8 +3376,8 @@ function isAgreementRejected(payload) {
3383
3376
  }
3384
3377
  function complianceStatusSummary(payload) {
3385
3378
  const parts = [];
3386
- const kyc = payload.kycStatus ? String(payload.kycStatus).replace(/_/g, " ") : "unknown";
3387
- const agreement = payload.agreementStatus ? String(payload.agreementStatus).replace(/_/g, " ") : "unknown";
3379
+ const kyc = payload.kycStatus ? payload.kycStatus.replace(/_/g, " ") : "unknown";
3380
+ const agreement = payload.agreementStatus ? payload.agreementStatus.replace(/_/g, " ") : "unknown";
3388
3381
  parts.push(`KYC: ${kyc}`);
3389
3382
  parts.push(`Agreement: ${agreement}`);
3390
3383
  if (payload.clientUserId) {
@@ -3430,6 +3423,6 @@ function assertRequestRecurringEvent(event) {
3430
3423
  }
3431
3424
  }
3432
3425
 
3433
- export { DEFAULT_RETRY_CONFIG, RequestApiError, RequestEnvironment, SchemaRegistry, ValidationError, browserFetchAdapter, buildRequestApiError, client_ids_exports as clientIds, computeRetryDelay, createHttpClient, createRequestClient, createRequestClientFromEnv, currencies_exports as currencies, v1_exports as currenciesV1, isRequestApiError, nodeFetchAdapter, parseWithRegistry, parseWithSchema, pay_exports as pay, v1_exports2 as payV1, payer_exports as payer, v1_exports3 as payerV1, v2_exports as payerV2, payments_exports as payments, payouts_exports as payouts, requests_exports as requests, v1_exports4 as requestsV1, schemaRegistry, shouldRetryRequest, webhooks_exports as webhooks };
3426
+ export { DEFAULT_RETRY_CONFIG, RequestApiError, RequestEnvironment, SchemaRegistry, ValidationError, browserFetchAdapter, buildRequestApiError, client_ids_exports as clientIds, computeRetryDelay, createHttpClient, createRequestClient, currencies_exports as currencies, v1_exports as currenciesV1, isRequestApiError, nodeFetchAdapter, parseWithRegistry, parseWithSchema, pay_exports as pay, v1_exports2 as payV1, payer_exports as payer, v1_exports3 as payerV1, v2_exports as payerV2, payments_exports as payments, payouts_exports as payouts, requests_exports as requests, v1_exports4 as requestsV1, schemaRegistry, shouldRetryRequest, webhooks_exports as webhooks };
3434
3427
  //# sourceMappingURL=index.js.map
3435
3428
  //# sourceMappingURL=index.js.map