@zauthx402/sdk 0.1.1
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/README.md +199 -0
- package/dist/index-CzB2rK59.d.mts +1114 -0
- package/dist/index-CzB2rK59.d.ts +1114 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +5645 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5622 -0
- package/dist/index.mjs.map +1 -0
- package/dist/middleware/index.d.mts +2 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.js +5355 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/index.mjs +5352 -0
- package/dist/middleware/index.mjs.map +1 -0
- package/package.json +71 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { V as ValidationConfig, a as ValidationResult } from './index-CzB2rK59.mjs';
|
|
2
|
+
export { Q as BatchingConfig, K as ConfirmRefundRequest, L as ConfirmRefundResponse, a6 as DEFAULT_CONFIG, W as EndpointRefundConfig, E as EndpointStatus, B as ErrorEvent, F as EventBatch, G as EventSubmitResponse, _ as ExecutedRefund, H as HealthCheckEvent, P as PaymentEvent, I as PendingRefund, J as PendingRefundsResponse, a2 as ProviderMiddlewareConfig, a0 as RefundCondition, S as RefundConfig, $ as RefundError, y as RefundEvent, R as RefundHandler, Y as RefundPollingConfig, A as RefundReason, f as RefundRequest, g as RefundResult, T as RefundSigner, U as RefundTriggers, M as RejectRefundRequest, N as RejectRefundResponse, w as RequestEvent, a5 as ResolvedConfig, a4 as ResolvedRefundConfig, a3 as ResolvedValidationConfig, x as ResponseEvent, a1 as TelemetryConfig, C as ValidationCheck, X as X402Network, p as X402PaymentInfo, n as X402PaymentPayload, j as X402PaymentRequirement, o as X402PaymentResponse, m as X402Response, k as X402ResponseV1, l as X402ResponseV2, h as X402Scheme, i as X402Version, Z as ZauthClient, O as ZauthConfig, D as ZauthEvent, v as ZauthEventBase, d as ZauthMiddlewareOptions, c as createClient, e as createRefundHandler, b as createZauthMiddleware, t as decodePaymentResponse, u as encodePaymentPayload, r as getPaymentRequirements, s as getPriceUsdc, q as parseX402Response, a7 as resolveConfig, z as zauthProvider } from './index-CzB2rK59.mjs';
|
|
3
|
+
import 'express';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Response validator for determining if responses are "meaningful"
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validate a response against configured rules
|
|
11
|
+
*/
|
|
12
|
+
declare function validateResponse(body: unknown, statusCode: number, config: ValidationConfig): ValidationResult;
|
|
13
|
+
/**
|
|
14
|
+
* Simple schema validator (basic implementation)
|
|
15
|
+
* For production, consider using ajv or zod
|
|
16
|
+
*/
|
|
17
|
+
declare function validateSchema(body: unknown, schema: Record<string, unknown>): ValidationResult;
|
|
18
|
+
/**
|
|
19
|
+
* Create a validator from a JSON schema
|
|
20
|
+
*/
|
|
21
|
+
declare function createSchemaValidator(schema: Record<string, unknown>): (body: unknown, statusCode: number) => ValidationResult;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Utility functions for zauthSDK
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Extract base URL without query parameters
|
|
29
|
+
*/
|
|
30
|
+
declare function getBaseUrl(url: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse query parameters from URL
|
|
33
|
+
*/
|
|
34
|
+
declare function parseQueryParams(url: string): Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Redact sensitive headers
|
|
37
|
+
*/
|
|
38
|
+
declare function redactHeaders(headers: Record<string, string | string[] | undefined>, redactList: string[]): Record<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if response body indicates an error
|
|
41
|
+
*/
|
|
42
|
+
declare function hasErrorIndicators(body: unknown, errorFields?: string[]): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check if body is empty or minimal
|
|
45
|
+
*/
|
|
46
|
+
declare function isEmptyResponse(body: unknown, minSize?: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Detect x402 version from response
|
|
49
|
+
*/
|
|
50
|
+
declare function detectX402Version(body: unknown): 1 | 2 | null;
|
|
51
|
+
|
|
52
|
+
export { ValidationConfig, ValidationResult, createSchemaValidator, detectX402Version, getBaseUrl, hasErrorIndicators, isEmptyResponse, parseQueryParams, redactHeaders, validateResponse, validateSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { V as ValidationConfig, a as ValidationResult } from './index-CzB2rK59.js';
|
|
2
|
+
export { Q as BatchingConfig, K as ConfirmRefundRequest, L as ConfirmRefundResponse, a6 as DEFAULT_CONFIG, W as EndpointRefundConfig, E as EndpointStatus, B as ErrorEvent, F as EventBatch, G as EventSubmitResponse, _ as ExecutedRefund, H as HealthCheckEvent, P as PaymentEvent, I as PendingRefund, J as PendingRefundsResponse, a2 as ProviderMiddlewareConfig, a0 as RefundCondition, S as RefundConfig, $ as RefundError, y as RefundEvent, R as RefundHandler, Y as RefundPollingConfig, A as RefundReason, f as RefundRequest, g as RefundResult, T as RefundSigner, U as RefundTriggers, M as RejectRefundRequest, N as RejectRefundResponse, w as RequestEvent, a5 as ResolvedConfig, a4 as ResolvedRefundConfig, a3 as ResolvedValidationConfig, x as ResponseEvent, a1 as TelemetryConfig, C as ValidationCheck, X as X402Network, p as X402PaymentInfo, n as X402PaymentPayload, j as X402PaymentRequirement, o as X402PaymentResponse, m as X402Response, k as X402ResponseV1, l as X402ResponseV2, h as X402Scheme, i as X402Version, Z as ZauthClient, O as ZauthConfig, D as ZauthEvent, v as ZauthEventBase, d as ZauthMiddlewareOptions, c as createClient, e as createRefundHandler, b as createZauthMiddleware, t as decodePaymentResponse, u as encodePaymentPayload, r as getPaymentRequirements, s as getPriceUsdc, q as parseX402Response, a7 as resolveConfig, z as zauthProvider } from './index-CzB2rK59.js';
|
|
3
|
+
import 'express';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Response validator for determining if responses are "meaningful"
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validate a response against configured rules
|
|
11
|
+
*/
|
|
12
|
+
declare function validateResponse(body: unknown, statusCode: number, config: ValidationConfig): ValidationResult;
|
|
13
|
+
/**
|
|
14
|
+
* Simple schema validator (basic implementation)
|
|
15
|
+
* For production, consider using ajv or zod
|
|
16
|
+
*/
|
|
17
|
+
declare function validateSchema(body: unknown, schema: Record<string, unknown>): ValidationResult;
|
|
18
|
+
/**
|
|
19
|
+
* Create a validator from a JSON schema
|
|
20
|
+
*/
|
|
21
|
+
declare function createSchemaValidator(schema: Record<string, unknown>): (body: unknown, statusCode: number) => ValidationResult;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Utility functions for zauthSDK
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Extract base URL without query parameters
|
|
29
|
+
*/
|
|
30
|
+
declare function getBaseUrl(url: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse query parameters from URL
|
|
33
|
+
*/
|
|
34
|
+
declare function parseQueryParams(url: string): Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Redact sensitive headers
|
|
37
|
+
*/
|
|
38
|
+
declare function redactHeaders(headers: Record<string, string | string[] | undefined>, redactList: string[]): Record<string, string>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if response body indicates an error
|
|
41
|
+
*/
|
|
42
|
+
declare function hasErrorIndicators(body: unknown, errorFields?: string[]): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check if body is empty or minimal
|
|
45
|
+
*/
|
|
46
|
+
declare function isEmptyResponse(body: unknown, minSize?: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Detect x402 version from response
|
|
49
|
+
*/
|
|
50
|
+
declare function detectX402Version(body: unknown): 1 | 2 | null;
|
|
51
|
+
|
|
52
|
+
export { ValidationConfig, ValidationResult, createSchemaValidator, detectX402Version, getBaseUrl, hasErrorIndicators, isEmptyResponse, parseQueryParams, redactHeaders, validateResponse, validateSchema };
|