@alphawebai/hs-prism 0.1.0-rc.27

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.
Files changed (39) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +493 -0
  3. package/dist/src/alphaweb/contracts.d.ts +6 -0
  4. package/dist/src/alphaweb/contracts.js +14 -0
  5. package/dist/src/alphaweb/error.d.ts +13 -0
  6. package/dist/src/alphaweb/error.js +100 -0
  7. package/dist/src/alphaweb/index.d.ts +3 -0
  8. package/dist/src/alphaweb/index.js +22 -0
  9. package/dist/src/alphaweb/manifest.d.ts +28 -0
  10. package/dist/src/alphaweb/manifest.js +55 -0
  11. package/dist/src/alphaweb/money.d.ts +19 -0
  12. package/dist/src/alphaweb/money.js +128 -0
  13. package/dist/src/alphaweb/stripe-connector.d.ts +58 -0
  14. package/dist/src/alphaweb/stripe-connector.js +1402 -0
  15. package/dist/src/alphaweb/types.d.ts +255 -0
  16. package/dist/src/alphaweb/types.js +3 -0
  17. package/dist/src/http_client.d.ts +58 -0
  18. package/dist/src/http_client.js +179 -0
  19. package/dist/src/index.d.ts +10 -0
  20. package/dist/src/index.js +41 -0
  21. package/dist/src/payments/_generated_connector_client_flows.d.ts +112 -0
  22. package/dist/src/payments/_generated_connector_client_flows.js +215 -0
  23. package/dist/src/payments/_generated_flows.js +141 -0
  24. package/dist/src/payments/_generated_grpc_client.d.ts +194 -0
  25. package/dist/src/payments/_generated_grpc_client.js +905 -0
  26. package/dist/src/payments/_generated_uniffi_client_flows.d.ts +169 -0
  27. package/dist/src/payments/_generated_uniffi_client_flows.js +342 -0
  28. package/dist/src/payments/connector_client.d.ts +51 -0
  29. package/dist/src/payments/connector_client.js +152 -0
  30. package/dist/src/payments/errors.d.ts +27 -0
  31. package/dist/src/payments/errors.js +39 -0
  32. package/dist/src/payments/generated/libconnector_service_ffi.so +0 -0
  33. package/dist/src/payments/generated/proto.d.ts +49087 -0
  34. package/dist/src/payments/generated/proto.js +154163 -0
  35. package/dist/src/payments/grpc_client.d.ts +1 -0
  36. package/dist/src/payments/grpc_client.js +20 -0
  37. package/dist/src/payments/uniffi_client.d.ts +40 -0
  38. package/dist/src/payments/uniffi_client.js +249 -0
  39. package/package.json +79 -0
@@ -0,0 +1,255 @@
1
+ export type PrismEnvironment = 'test' | 'live';
2
+ export type PrismOperationKind = 'checkout' | 'post_purchase' | 'subscription_renewal' | 'refund' | 'cancel';
3
+ export interface PrismMoney {
4
+ amountMinor: string;
5
+ currency: string;
6
+ }
7
+ export type PrismReusableCapability = 'off_session' | 'post_purchase' | 'manual_capture' | 'subscription';
8
+ export interface PrismReusablePaymentReference {
9
+ version: 1;
10
+ connector: 'stripe';
11
+ credentialBindingId: string;
12
+ providerAccountId: string;
13
+ livemode: boolean;
14
+ connectorCustomerId: string;
15
+ connectorPaymentMethodId: string;
16
+ connectorMandateId?: string;
17
+ sourcePaymentIntentId?: string;
18
+ capabilities: PrismReusableCapability[];
19
+ }
20
+ export interface PrismMerchantOperation {
21
+ operationId: string;
22
+ idempotencyKey: string;
23
+ credentialBindingId: string;
24
+ kind: PrismOperationKind;
25
+ money: PrismMoney;
26
+ customerReference?: string;
27
+ reusableReference?: PrismReusablePaymentReference;
28
+ methodSelection: {
29
+ kind: 'interactive_dynamic';
30
+ paymentMethodConfigurationId?: string;
31
+ } | {
32
+ kind: 'reusable_reference';
33
+ };
34
+ metadata: Record<string, string>;
35
+ }
36
+ export interface PrismRetryPaymentInput extends PrismMerchantOperation {
37
+ connectorPaymentId: string;
38
+ }
39
+ export type PrismNormalizedPaymentStatus = 'requires_payment_method' | 'requires_customer_action' | 'pending_authorization' | 'authorized' | 'captured' | 'canceled' | 'failed' | 'unknown';
40
+ export interface PrismPaymentFailure {
41
+ category: 'declined' | 'customer_action' | 'invalid_payment_method' | 'unknown';
42
+ providerCode?: string;
43
+ declineCode?: string;
44
+ adviceCode?: string;
45
+ retryable: boolean;
46
+ }
47
+ export interface PrismPaymentResult {
48
+ connectorPaymentId: string | null;
49
+ status: PrismNormalizedPaymentStatus;
50
+ money: PrismMoney;
51
+ clientSecret?: string;
52
+ publishableKey?: string;
53
+ reusableReference?: PrismReusablePaymentReference;
54
+ providerRequestId?: string;
55
+ failure?: PrismPaymentFailure;
56
+ }
57
+ export interface PrismRefundResult {
58
+ connectorRefundId: string | null;
59
+ connectorPaymentId?: string;
60
+ status: 'pending' | 'succeeded' | 'failed' | 'unknown';
61
+ money: PrismMoney;
62
+ providerRequestId?: string;
63
+ }
64
+ export interface PrismRetrieveRefundInput {
65
+ connectorRefundId: string;
66
+ connectorPaymentId: string;
67
+ operationId?: string;
68
+ money?: PrismMoney;
69
+ }
70
+ export interface PrismFindRefundInput {
71
+ operationId: string;
72
+ connectorPaymentId: string;
73
+ money: PrismMoney;
74
+ }
75
+ export interface PrismDisputeResult {
76
+ connectorDisputeId: string;
77
+ connectorChargeId: string;
78
+ connectorPaymentId: string;
79
+ status: 'warning_needs_response' | 'needs_response' | 'under_review' | 'won' | 'lost' | 'closed' | 'unknown';
80
+ money: PrismMoney;
81
+ reason?: string;
82
+ evidenceDueAt?: string;
83
+ providerCreatedAt: string;
84
+ safeData: Record<string, string | number | boolean | null>;
85
+ }
86
+ export interface PrismRetrieveDisputeInput {
87
+ connectorDisputeId: string;
88
+ }
89
+ export interface PrismRetrievePaymentInput {
90
+ connectorPaymentId: string;
91
+ money: PrismMoney;
92
+ operationId: string;
93
+ expectedOwnerId?: string;
94
+ expectedConnectorCustomerId?: string;
95
+ }
96
+ export interface PrismEstablishReusableReferenceInput extends PrismRetrievePaymentInput {
97
+ expectedOwnerId: string;
98
+ purposes: Array<'post_purchase' | 'subscription'>;
99
+ }
100
+ export type PrismReusableReferenceDerivation = {
101
+ status: 'established';
102
+ reference: PrismReusablePaymentReference;
103
+ safeDisplay?: {
104
+ brand?: string;
105
+ last4?: string;
106
+ expMonth?: number;
107
+ expYear?: number;
108
+ };
109
+ } | {
110
+ status: 'not_supported';
111
+ reason: 'payment_method_not_reusable' | 'requested_capability_not_supported';
112
+ };
113
+ export interface PrismFindPaymentInput {
114
+ operationId: string;
115
+ createdAfter?: string;
116
+ money?: PrismMoney;
117
+ expectedOwnerId?: string;
118
+ expectedConnectorCustomerId?: string;
119
+ }
120
+ export interface PrismCaptureInput extends PrismRetrievePaymentInput {
121
+ idempotencyKey: string;
122
+ }
123
+ export interface PrismCancelInput {
124
+ connectorPaymentId: string;
125
+ operationId: string;
126
+ idempotencyKey: string;
127
+ }
128
+ export interface PrismRefundInput extends PrismRetrievePaymentInput {
129
+ idempotencyKey: string;
130
+ refundId: string;
131
+ }
132
+ export interface PrismWebhookSigningSecretBinding {
133
+ credentialBindingId: string;
134
+ providerAccountId: string;
135
+ livemode: boolean;
136
+ endpointId: string;
137
+ secret: string;
138
+ }
139
+ export interface PrismWebhookParseInput {
140
+ rawBody: Uint8Array;
141
+ signatureHeader: string;
142
+ signingSecretBindings: PrismWebhookSigningSecretBinding[];
143
+ expectedApiVersion: string;
144
+ }
145
+ export interface PrismVerifiedWebhookEnvelope {
146
+ provider: 'stripe';
147
+ providerEventId: string;
148
+ credentialBindingId: string;
149
+ providerAccountId: string;
150
+ livemode: boolean;
151
+ apiVersion: string | null;
152
+ type: string;
153
+ createdAt: string;
154
+ objectKind: 'payment_intent' | 'setup_intent' | 'refund' | 'dispute' | 'mandate' | 'payment_method' | 'unknown';
155
+ objectId: string | null;
156
+ paymentIntentId: string | null;
157
+ bodyDigest: string;
158
+ }
159
+ export interface PrismNormalizedWebhookEvent extends PrismVerifiedWebhookEnvelope {
160
+ customerId: string | null;
161
+ paymentMethodId: string | null;
162
+ mandateId: string | null;
163
+ merchantOperationId: string | null;
164
+ medusaPaymentSessionId: string | null;
165
+ status: PrismNormalizedPaymentStatus | null;
166
+ money: PrismMoney | null;
167
+ refunds: Array<{
168
+ refundId: string;
169
+ chargeId: string | null;
170
+ paymentIntentId: string | null;
171
+ status: 'pending' | 'succeeded' | 'failed' | 'canceled' | 'unknown';
172
+ money: PrismMoney;
173
+ }>;
174
+ safeData: Record<string, string | number | boolean | null>;
175
+ }
176
+ export type PrismWebhookParseResult = {
177
+ status: 'normalized';
178
+ event: PrismNormalizedWebhookEvent;
179
+ } | {
180
+ status: 'normalization_failed';
181
+ envelope: PrismVerifiedWebhookEnvelope;
182
+ error: {
183
+ code: 'WEBHOOK_SCHEMA_VERSION_MISMATCH' | 'WEBHOOK_EVENT_UNSUPPORTED' | 'WEBHOOK_OBJECT_INVALID';
184
+ safeMessage: string;
185
+ };
186
+ };
187
+ export interface PrismWebhookEndpoint {
188
+ endpointId: string;
189
+ url: string;
190
+ enabled: boolean;
191
+ apiVersion: string;
192
+ events: string[];
193
+ metadata: Record<string, string>;
194
+ }
195
+ export interface PrismWebhookEndpointCreated extends PrismWebhookEndpoint {
196
+ signingSecret: string;
197
+ }
198
+ export interface PrismCreateWebhookEndpointInput {
199
+ callbackUrl: string;
200
+ idempotencyKey: string;
201
+ metadata: Record<string, string>;
202
+ }
203
+ export interface PrismUpdateWebhookEndpointInput {
204
+ endpointId: string;
205
+ idempotencyKey: string;
206
+ callbackUrl?: string;
207
+ enabled?: boolean;
208
+ }
209
+ export interface PrismDeleteWebhookEndpointInput {
210
+ endpointId: string;
211
+ idempotencyKey: string;
212
+ }
213
+ export interface PrismRetrieveWebhookEndpointInput {
214
+ endpointId: string;
215
+ }
216
+ export interface PrismStripeRuntimeVerificationInput {
217
+ environment: PrismEnvironment;
218
+ secretKey: string;
219
+ publishableKey?: string;
220
+ expectedProviderAccountId?: string;
221
+ nativeLibraryPath?: string;
222
+ requestTimeoutMs?: number;
223
+ }
224
+ export interface PrismStripeRuntimeVerification {
225
+ providerAccountId: string;
226
+ livemode: boolean;
227
+ }
228
+ export interface PrismStripeConnectorV1 {
229
+ createPayment(input: PrismMerchantOperation): Promise<PrismPaymentResult>;
230
+ repeatPayment(input: PrismMerchantOperation): Promise<PrismPaymentResult>;
231
+ retryPayment(input: PrismRetryPaymentInput): Promise<PrismPaymentResult>;
232
+ retrievePayment(input: PrismRetrievePaymentInput): Promise<PrismPaymentResult>;
233
+ establishReusableReference(input: PrismEstablishReusableReferenceInput): Promise<PrismReusableReferenceDerivation>;
234
+ findPaymentsByMerchantOperation(input: PrismFindPaymentInput): Promise<PrismPaymentResult[]>;
235
+ capturePayment(input: PrismCaptureInput): Promise<PrismPaymentResult>;
236
+ cancelPayment(input: PrismCancelInput): Promise<PrismPaymentResult>;
237
+ refundPayment(input: PrismRefundInput): Promise<PrismRefundResult>;
238
+ retrieveRefund(input: PrismRetrieveRefundInput): Promise<PrismRefundResult>;
239
+ findRefundsByMerchantOperation(input: PrismFindRefundInput): Promise<PrismRefundResult[]>;
240
+ retrieveDispute(input: PrismRetrieveDisputeInput): Promise<PrismDisputeResult>;
241
+ parseWebhookEvent(input: PrismWebhookParseInput): Promise<PrismWebhookParseResult>;
242
+ createWebhookEndpoint(input: PrismCreateWebhookEndpointInput): Promise<PrismWebhookEndpointCreated>;
243
+ updateWebhookEndpoint(input: PrismUpdateWebhookEndpointInput): Promise<PrismWebhookEndpoint>;
244
+ deleteWebhookEndpoint(input: PrismDeleteWebhookEndpointInput): Promise<void>;
245
+ retrieveWebhookEndpoint(input: PrismRetrieveWebhookEndpointInput): Promise<PrismWebhookEndpoint>;
246
+ }
247
+ export interface PrismStripeConnectorOptions {
248
+ environment: PrismEnvironment;
249
+ credentialBindingId: string;
250
+ providerAccountId: string;
251
+ secretKey: string;
252
+ publishableKey?: string;
253
+ nativeLibraryPath?: string;
254
+ requestTimeoutMs?: number;
255
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,58 @@
1
+ import { Dispatcher } from "undici";
2
+ import { types } from "./payments/generated/proto";
3
+ /**
4
+ * Normalized HTTP Request structure for the Connector Service.
5
+ */
6
+ export interface HttpRequest {
7
+ url: string;
8
+ method: string;
9
+ headers?: Record<string, string>;
10
+ body?: Uint8Array;
11
+ }
12
+ /**
13
+ * Normalized HTTP Response structure.
14
+ */
15
+ export interface HttpResponse {
16
+ statusCode: number;
17
+ headers: Record<string, string>;
18
+ body: Uint8Array;
19
+ latencyMs: number;
20
+ }
21
+ /** Optional mock intercept — set by smoke test in mock mode only. */
22
+ export declare let _intercept: ((req: HttpRequest) => Promise<HttpResponse>) | null;
23
+ /** Network error codes from proto (single source of truth). */
24
+ export declare const NetworkErrorCode: typeof types.NetworkErrorCode;
25
+ /**
26
+ * Network error for HTTP transport failures (timeouts, connection errors, config).
27
+ * Uses proto-generated NetworkErrorCode for cross-SDK parity with IntegrationError/ConnectorError.
28
+ */
29
+ export declare class NetworkError extends Error {
30
+ code: types.NetworkErrorCode;
31
+ statusCode?: number | undefined;
32
+ body?: string | undefined;
33
+ headers?: Record<string, string> | undefined;
34
+ constructor(message: string, code?: types.NetworkErrorCode, statusCode?: number | undefined, body?: string | undefined, headers?: Record<string, string> | undefined);
35
+ /**
36
+ * String error code for parity with IntegrationError/ConnectorError (e.g. "CONNECT_TIMEOUT").
37
+ * Use for logging, display, and simple comparisons.
38
+ */
39
+ get errorCode(): string;
40
+ }
41
+ /**
42
+ * Resolve proxy URL, honoring bypass rules.
43
+ */
44
+ export declare function resolveProxyUrl(url: string, proxy?: types.IProxyOptions | null): string | null;
45
+ /**
46
+ * Generate a cache key from proxy configuration for HTTP client caching.
47
+ * Returns empty string when no proxy is configured.
48
+ */
49
+ export declare function generateProxyCacheKey(proxy?: types.IProxyOptions | null): string;
50
+ /**
51
+ * Creates a high-performance dispatcher with specialized fintech timeouts.
52
+ * (The instance-level connection pool)
53
+ */
54
+ export declare function createDispatcher(config: types.IHttpConfig): Dispatcher;
55
+ /**
56
+ * Standardized network execution engine for Unified Connector Service.
57
+ */
58
+ export declare function execute(request: HttpRequest, options?: types.IHttpConfig, dispatcher?: Dispatcher): Promise<HttpResponse>;
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NetworkError = exports.NetworkErrorCode = exports._intercept = void 0;
4
+ exports.resolveProxyUrl = resolveProxyUrl;
5
+ exports.generateProxyCacheKey = generateProxyCacheKey;
6
+ exports.createDispatcher = createDispatcher;
7
+ exports.execute = execute;
8
+ const undici_1 = require("undici");
9
+ // @ts-ignore
10
+ const proto_1 = require("./payments/generated/proto");
11
+ const Defaults = proto_1.types.HttpDefault;
12
+ /** Optional mock intercept — set by smoke test in mock mode only. */
13
+ exports._intercept = null;
14
+ /** Network error codes from proto (single source of truth). */
15
+ exports.NetworkErrorCode = proto_1.types.NetworkErrorCode;
16
+ /**
17
+ * Network error for HTTP transport failures (timeouts, connection errors, config).
18
+ * Uses proto-generated NetworkErrorCode for cross-SDK parity with IntegrationError/ConnectorError.
19
+ */
20
+ class NetworkError extends Error {
21
+ code;
22
+ statusCode;
23
+ body;
24
+ headers;
25
+ constructor(message, code = proto_1.types.NetworkErrorCode.NETWORK_ERROR_CODE_UNSPECIFIED, statusCode, body, headers) {
26
+ super(message);
27
+ this.code = code;
28
+ this.statusCode = statusCode;
29
+ this.body = body;
30
+ this.headers = headers;
31
+ this.name = "NetworkError";
32
+ }
33
+ /**
34
+ * String error code for parity with IntegrationError/ConnectorError (e.g. "CONNECT_TIMEOUT").
35
+ * Use for logging, display, and simple comparisons.
36
+ */
37
+ get errorCode() {
38
+ return proto_1.types.NetworkErrorCode[this.code] ?? "NETWORK_ERROR_CODE_UNSPECIFIED";
39
+ }
40
+ }
41
+ exports.NetworkError = NetworkError;
42
+ /**
43
+ * Resolve proxy URL, honoring bypass rules.
44
+ */
45
+ function resolveProxyUrl(url, proxy) {
46
+ if (!proxy)
47
+ return null;
48
+ const shouldBypass = Array.isArray(proxy.bypassUrls) && proxy.bypassUrls.includes(url);
49
+ if (shouldBypass)
50
+ return null;
51
+ return proxy.httpsUrl || proxy.httpUrl || null;
52
+ }
53
+ /**
54
+ * Generate a cache key from proxy configuration for HTTP client caching.
55
+ * Returns empty string when no proxy is configured.
56
+ */
57
+ function generateProxyCacheKey(proxy) {
58
+ if (!proxy)
59
+ return "";
60
+ const httpUrl = proxy.httpUrl || "";
61
+ const httpsUrl = proxy.httpsUrl || "";
62
+ const bypassUrls = Array.isArray(proxy.bypassUrls)
63
+ ? [...proxy.bypassUrls].sort().join(",")
64
+ : "";
65
+ return `${httpUrl}|${httpsUrl}|${bypassUrls}`;
66
+ }
67
+ /**
68
+ * Creates a high-performance dispatcher with specialized fintech timeouts.
69
+ * (The instance-level connection pool)
70
+ */
71
+ function createDispatcher(config) {
72
+ let ca;
73
+ if (config.caCert) {
74
+ if (config.caCert.pem) {
75
+ ca = config.caCert.pem;
76
+ }
77
+ else if (config.caCert.der) {
78
+ ca = config.caCert.der;
79
+ }
80
+ }
81
+ const connectOptions = {
82
+ timeout: config.connectTimeoutMs ?? Defaults.CONNECT_TIMEOUT_MS,
83
+ ca,
84
+ };
85
+ const commonOptions = {
86
+ headersTimeout: config.responseTimeoutMs ?? Defaults.RESPONSE_TIMEOUT_MS,
87
+ bodyTimeout: config.responseTimeoutMs ?? Defaults.RESPONSE_TIMEOUT_MS,
88
+ keepAliveTimeout: config.keepAliveTimeoutMs ?? Defaults.KEEP_ALIVE_TIMEOUT_MS,
89
+ };
90
+ const proxyUrl = config.proxy?.httpsUrl || config.proxy?.httpUrl;
91
+ try {
92
+ if (proxyUrl) {
93
+ // For a CONNECT proxy:
94
+ // - `connect` governs TLS to the proxy itself (HTTP proxy → no TLS needed)
95
+ // - `requestTls` governs TLS for the tunneled origin connection (the CONNECT tunnel)
96
+ // This is where the custom CA must live so Node trusts the
97
+ // mitmproxy-issued leaf certificate for api.stripe.com, etc.
98
+ return new undici_1.ProxyAgent({
99
+ uri: proxyUrl,
100
+ ...commonOptions,
101
+ connect: { timeout: config.connectTimeoutMs ?? Defaults.CONNECT_TIMEOUT_MS },
102
+ requestTls: { ca },
103
+ });
104
+ }
105
+ return new undici_1.Agent({ ...commonOptions, connect: connectOptions });
106
+ }
107
+ catch (error) {
108
+ const code = proxyUrl ? proto_1.types.NetworkErrorCode.INVALID_PROXY_CONFIGURATION : proto_1.types.NetworkErrorCode.CLIENT_INITIALIZATION_FAILURE;
109
+ throw new NetworkError(`Internal HTTP setup failed: ${error.message}`, code, 500);
110
+ }
111
+ }
112
+ /**
113
+ * Standardized network execution engine for Unified Connector Service.
114
+ */
115
+ async function execute(request, options = {}, dispatcher // Pass the instance-owned pool here
116
+ ) {
117
+ // Check for mock intercept (used in smoke test mock mode)
118
+ if (exports._intercept) {
119
+ return (0, exports._intercept)(request);
120
+ }
121
+ const { url, method, headers, body } = request;
122
+ try {
123
+ new URL(url);
124
+ }
125
+ catch {
126
+ throw new NetworkError(`Invalid URL: ${url}`, proto_1.types.NetworkErrorCode.URL_PARSING_FAILED);
127
+ }
128
+ const totalTimeout = options.totalTimeoutMs ?? Defaults.TOTAL_TIMEOUT_MS;
129
+ const controller = new AbortController();
130
+ const timeoutId = setTimeout(() => controller.abort(), totalTimeout);
131
+ const startTime = Date.now();
132
+ try {
133
+ const response = await fetch(url, {
134
+ method: method.toUpperCase(),
135
+ headers: headers || {},
136
+ body: body ? Buffer.from(body) : undefined,
137
+ redirect: "manual",
138
+ signal: controller.signal,
139
+ // @ts-ignore
140
+ dispatcher,
141
+ });
142
+ const responseHeaders = {};
143
+ response.headers.forEach((v, k) => { responseHeaders[k.toLowerCase()] = v; });
144
+ let responseBody;
145
+ try {
146
+ responseBody = new Uint8Array(await response.arrayBuffer());
147
+ }
148
+ catch (e) {
149
+ throw new NetworkError(`Failed to read response body: ${e?.message || e}`, proto_1.types.NetworkErrorCode.RESPONSE_DECODING_FAILED, response.status);
150
+ }
151
+ return {
152
+ statusCode: response.status,
153
+ headers: responseHeaders,
154
+ body: responseBody,
155
+ latencyMs: Date.now() - startTime
156
+ };
157
+ }
158
+ catch (error) {
159
+ if (error instanceof NetworkError)
160
+ throw error;
161
+ if (error.name === 'AbortError') {
162
+ throw new NetworkError(`Total Request Timeout: ${method} ${url} exceeded ${totalTimeout}ms`, proto_1.types.NetworkErrorCode.TOTAL_TIMEOUT_EXCEEDED, 504);
163
+ }
164
+ const cause = error.cause;
165
+ if (cause) {
166
+ if (cause.code === 'UND_ERR_CONNECT_TIMEOUT') {
167
+ throw new NetworkError(`Connection Timeout: Failed to connect to ${url}`, proto_1.types.NetworkErrorCode.CONNECT_TIMEOUT_EXCEEDED, 504);
168
+ }
169
+ if (cause.code === 'UND_ERR_BODY_TIMEOUT' || cause.code === 'UND_ERR_HEADERS_TIMEOUT') {
170
+ throw new NetworkError(`Response Timeout: Gateway ${url} accepted connection but failed to respond`, proto_1.types.NetworkErrorCode.RESPONSE_TIMEOUT_EXCEEDED, 504);
171
+ }
172
+ }
173
+ throw new NetworkError(`Network Error: ${error.message}`, proto_1.types.NetworkErrorCode.NETWORK_FAILURE, 500);
174
+ }
175
+ finally {
176
+ clearTimeout(timeoutId);
177
+ }
178
+ }
179
+ //# sourceMappingURL=http_client.js.map
@@ -0,0 +1,10 @@
1
+ export * from "./payments/_generated_connector_client_flows";
2
+ export { UniffiClient } from "./payments/_generated_uniffi_client_flows";
3
+ export type { RustBuffer, RustCallStatus } from "./payments/uniffi_client";
4
+ export * from "./http_client";
5
+ export * from './payments/generated/proto';
6
+ export { types } from './payments/generated/proto';
7
+ export { GrpcClient } from "./payments/grpc_client";
8
+ export type { GrpcConfig, GrpcPaymentClient, GrpcCustomerClient, GrpcPaymentMethodClient, GrpcPaymentMethodAuthenticationClient, GrpcEventClient, GrpcMerchantAuthenticationClient, GrpcRecurringPaymentClient, } from "./payments/grpc_client";
9
+ export { IntegrationError, ConnectorError } from './payments/connector_client';
10
+ export * from './alphaweb/index';
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ConnectorError = exports.IntegrationError = exports.GrpcClient = exports.types = exports.UniffiClient = void 0;
18
+ // Re-export client classes flat (high-level API)
19
+ __exportStar(require("./payments/_generated_connector_client_flows"), exports);
20
+ var _generated_uniffi_client_flows_1 = require("./payments/_generated_uniffi_client_flows");
21
+ Object.defineProperty(exports, "UniffiClient", { enumerable: true, get: function () { return _generated_uniffi_client_flows_1.UniffiClient; } });
22
+ __exportStar(require("./http_client"), exports);
23
+ __exportStar(require("./payments/generated/proto"), exports);
24
+ // Re-export types namespace explicitly for both runtime and type access
25
+ var proto_1 = require("./payments/generated/proto");
26
+ Object.defineProperty(exports, "types", { enumerable: true, get: function () { return proto_1.types; } });
27
+ // gRPC client (Rust-backed via hyperswitch_grpc_ffi native library)
28
+ var grpc_client_1 = require("./payments/grpc_client");
29
+ Object.defineProperty(exports, "GrpcClient", { enumerable: true, get: function () { return grpc_client_1.GrpcClient; } });
30
+ // Export error classes
31
+ var connector_client_1 = require("./payments/connector_client");
32
+ Object.defineProperty(exports, "IntegrationError", { enumerable: true, get: function () { return connector_client_1.IntegrationError; } });
33
+ Object.defineProperty(exports, "ConnectorError", { enumerable: true, get: function () { return connector_client_1.ConnectorError; } });
34
+ __exportStar(require("./alphaweb/index"), exports);
35
+ // ---------------------------------------------------------------------------
36
+ // Domain namespaces — runtime values
37
+ // Usage: import { payments, payment_methods, configs } from '@juspay/connector-service-sdk';
38
+ // const config: configs.IConnectorConfig = { ... };
39
+ // const client = new ConnectorClient(identity);
40
+ // ---------------------------------------------------------------------------
41
+ //# sourceMappingURL=index.js.map