@solvapay/server 2.4.0-preview-3f68079d7097167693fa7cdc76752dcf23fd1ab6 → 2.4.0

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/edge.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { z } from 'zod';
2
1
  import { BusinessDetailsInput, TaxBreakdown } from '@solvapay/core';
3
2
 
4
3
  interface components {
@@ -5422,52 +5421,6 @@ declare class PaywallError extends Error {
5422
5421
  /** JSON body shape for HTTP adapters and MCP text content (stable fields for clients). */
5423
5422
  declare function paywallErrorToClientPayload(error: PaywallError): Record<string, unknown>;
5424
5423
 
5425
- /**
5426
- * Zod schemas for `PaywallStructuredContent`. Declared so MCP hosts can
5427
- * hydrate `structuredContent` and so we fail loud when a required field
5428
- * the narrator claims to print is missing. Every recovery field is
5429
- * optional — a default here would invent data the backend did not send.
5430
- */
5431
-
5432
- declare const PaywallStructuredContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5433
- planRef: z.ZodOptional<z.ZodString>;
5434
- plans: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
5435
- meterName: z.ZodOptional<z.ZodString>;
5436
- unitPriceMinor: z.ZodOptional<z.ZodNumber>;
5437
- currency: z.ZodOptional<z.ZodString>;
5438
- included: z.ZodOptional<z.ZodObject<{
5439
- total: z.ZodNumber;
5440
- used: z.ZodNumber;
5441
- remaining: z.ZodNumber;
5442
- }, z.core.$strip>>;
5443
- creditBalance: z.ZodOptional<z.ZodNumber>;
5444
- balance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5445
- productDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5446
- kind: z.ZodLiteral<"payment_required">;
5447
- product: z.ZodString;
5448
- checkoutUrl: z.ZodString;
5449
- message: z.ZodString;
5450
- }, z.core.$strip>, z.ZodObject<{
5451
- planRef: z.ZodOptional<z.ZodString>;
5452
- plans: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
5453
- meterName: z.ZodOptional<z.ZodString>;
5454
- unitPriceMinor: z.ZodOptional<z.ZodNumber>;
5455
- currency: z.ZodOptional<z.ZodString>;
5456
- included: z.ZodOptional<z.ZodObject<{
5457
- total: z.ZodNumber;
5458
- used: z.ZodNumber;
5459
- remaining: z.ZodNumber;
5460
- }, z.core.$strip>>;
5461
- creditBalance: z.ZodOptional<z.ZodNumber>;
5462
- balance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5463
- productDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5464
- kind: z.ZodLiteral<"activation_required">;
5465
- product: z.ZodString;
5466
- checkoutUrl: z.ZodString;
5467
- message: z.ZodString;
5468
- confirmationUrl: z.ZodOptional<z.ZodString>;
5469
- }, z.core.$strip>], "kind">;
5470
-
5471
5424
  /**
5472
5425
  * Pure state engine that classifies a `LimitResponseWithPlan` into a
5473
5426
  * recovery-tool-specific `PaywallState`, and produces the human-readable
@@ -6309,4 +6262,4 @@ declare function verifyWebhook({ body, signature, secret, }: {
6309
6262
  secret: string;
6310
6263
  }): Promise<WebhookEvent>;
6311
6264
 
6312
- export { type ActivatePlanResult, type AuthenticatedUser, type ConfigureMcpPlansRequest, type ConfigureMcpPlansResponse, type CreateSolvaPayConfig, type CustomerBalanceResult, type CustomerResponseMapped, type CustomerWebhookObject, type ErrorResult, type GetUsageResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type LimitResponseWithPlan, type McpBootstrapPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type McpToolPlanMappingInput, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableAllowResult, type PayableFunction, type PayableGateOptions, type PayableGateResult, type PayableOptions, type PayablePaywallResult, type PaymentMethodInfo, type PaywallArgs, type PaywallDecision, PaywallError, type PaywallMetadata, type PaywallState, type PaywallStructuredContent, PaywallStructuredContentSchema, type ProcessPaymentResult, type ProductConfigurationStatus, type PurchaseCheckResult, type RetryOptions, type SdkMerchantResponse, type SdkProductResponse, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, type TopupProcessResult, type VerifyProductConfigurationOptions, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, activatePlanCore, attachBusinessDetailsCore, buildGateMessage, buildNudgeMessage, buildPaywallGate, cancelPurchaseCore, checkLimitsCore, checkPurchaseCore, classifyPaywallState, type components, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createTopupPaymentIntentCore, deriveUsageSnapshot, disableAutoRechargeCore, getAuthenticatedUserCore, getAutoRechargeCore, getCustomerBalanceCore, getHistoryCore, getMerchantCore, getPaymentMethodCore, getProductCore, getUsageCore, handleRouteError, isErrorResult, isPaywallStructuredContent, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, processTopupPaymentIntentCore, reactivatePurchaseCore, saveAutoRechargeCore, syncCustomerCore, trackUsageCore, verifyProductConfiguration, verifyWebhook, withRetry };
6265
+ export { type ActivatePlanResult, type AuthenticatedUser, type ConfigureMcpPlansRequest, type ConfigureMcpPlansResponse, type CreateSolvaPayConfig, type CustomerBalanceResult, type CustomerResponseMapped, type CustomerWebhookObject, type ErrorResult, type GetUsageResult, type HttpAdapterOptions, type LimitActivationBalance, type LimitActivationProduct, type LimitPlanSummary, type LimitResponseWithPlan, type McpBootstrapPlanInput, type McpBootstrapRequest, type McpBootstrapResponse, type McpToolPlanMappingInput, type NextAdapterOptions, type OneTimePurchaseInfo, type PayableAllowResult, type PayableFunction, type PayableGateOptions, type PayableGateResult, type PayableOptions, type PayablePaywallResult, type PaymentMethodInfo, type PaywallArgs, type PaywallDecision, PaywallError, type PaywallMetadata, type PaywallState, type PaywallStructuredContent, type ProcessPaymentResult, type ProductConfigurationStatus, type PurchaseCheckResult, type RetryOptions, type SdkMerchantResponse, type SdkProductResponse, type ServerClientOptions, type SolvaPay, type SolvaPayClient, type ToolPlanMappingInput, type TopupProcessResult, type VerifyProductConfigurationOptions, type WebhookEvent, type WebhookEventForType, type WebhookEventObjectMap, type WebhookEventType, type WebhookProduct, activatePlanCore, attachBusinessDetailsCore, buildGateMessage, buildNudgeMessage, buildPaywallGate, cancelPurchaseCore, checkLimitsCore, checkPurchaseCore, classifyPaywallState, type components, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, createTopupPaymentIntentCore, deriveUsageSnapshot, disableAutoRechargeCore, getAuthenticatedUserCore, getAutoRechargeCore, getCustomerBalanceCore, getHistoryCore, getMerchantCore, getPaymentMethodCore, getProductCore, getUsageCore, handleRouteError, isErrorResult, isPaywallStructuredContent, listPlansCore, paywallErrorToClientPayload, processPaymentIntentCore, processTopupPaymentIntentCore, reactivatePurchaseCore, saveAutoRechargeCore, syncCustomerCore, trackUsageCore, verifyProductConfiguration, verifyWebhook, withRetry };
package/dist/edge.js CHANGED
@@ -2129,34 +2129,34 @@ function isJsonSchemaObject(value) {
2129
2129
  return Boolean(value && typeof value === "object");
2130
2130
  }
2131
2131
  function toZodSchema(property) {
2132
- const z2 = getZod();
2132
+ const z = getZod();
2133
2133
  if (Array.isArray(property.enum) && property.enum.length > 0) {
2134
2134
  if (property.enum.every((value) => typeof value === "string")) {
2135
2135
  const [first, ...rest] = property.enum;
2136
- return z2.enum([first, ...rest]);
2136
+ return z.enum([first, ...rest]);
2137
2137
  }
2138
2138
  if (property.enum.length === 1) {
2139
- return z2.literal(property.enum[0]);
2139
+ return z.literal(property.enum[0]);
2140
2140
  }
2141
- return z2.union(property.enum.map((value) => z2.literal(value)));
2141
+ return z.union(property.enum.map((value) => z.literal(value)));
2142
2142
  }
2143
2143
  switch (property.type) {
2144
2144
  case "string":
2145
- return z2.string();
2145
+ return z.string();
2146
2146
  case "number":
2147
- return z2.number();
2147
+ return z.number();
2148
2148
  case "integer":
2149
- return z2.number().int();
2149
+ return z.number().int();
2150
2150
  case "boolean":
2151
- return z2.boolean();
2151
+ return z.boolean();
2152
2152
  case "array":
2153
- return z2.array(
2154
- isJsonSchemaObject(property.items) ? toZodSchema(property.items) : z2.any()
2153
+ return z.array(
2154
+ isJsonSchemaObject(property.items) ? toZodSchema(property.items) : z.any()
2155
2155
  );
2156
2156
  case "object":
2157
- return z2.object(jsonSchemaToZodRawShape(property.properties || {}));
2157
+ return z.object(jsonSchemaToZodRawShape(property.properties || {}));
2158
2158
  default:
2159
- return z2.any();
2159
+ return z.any();
2160
2160
  }
2161
2161
  }
2162
2162
  function jsonSchemaToZodRawShape(properties, required = []) {
@@ -2191,12 +2191,12 @@ function registerVirtualToolsMcpImpl(server, apiClient, options) {
2191
2191
  if (filter && !filter(toolDefinition)) continue;
2192
2192
  const mappedDefinition = mapDefinition ? mapDefinition(toolDefinition) : toolDefinition;
2193
2193
  const wrappedHandler = wrapHandler ? wrapHandler(mappedDefinition.handler, mappedDefinition) : mappedDefinition.handler;
2194
- const z2 = getZod();
2194
+ const z = getZod();
2195
2195
  server.registerTool(
2196
2196
  mappedDefinition.name,
2197
2197
  {
2198
2198
  description: mappedDefinition.description,
2199
- inputSchema: z2.object(
2199
+ inputSchema: z.object(
2200
2200
  jsonSchemaToZodRawShape(
2201
2201
  mappedDefinition.inputSchema.properties,
2202
2202
  mappedDefinition.inputSchema.required || []
@@ -2483,42 +2483,6 @@ function isPaywallStructuredContent(value) {
2483
2483
  return kind === "payment_required" || kind === "activation_required";
2484
2484
  }
2485
2485
 
2486
- // src/types/paywall-schema.ts
2487
- import { z } from "zod";
2488
- var includedSchema = z.object({
2489
- total: z.number(),
2490
- used: z.number(),
2491
- remaining: z.number()
2492
- });
2493
- var recoveryFields2 = {
2494
- planRef: z.string().optional(),
2495
- plans: z.array(z.record(z.string(), z.unknown())).optional(),
2496
- meterName: z.string().optional(),
2497
- unitPriceMinor: z.number().optional(),
2498
- currency: z.string().optional(),
2499
- included: includedSchema.optional(),
2500
- creditBalance: z.number().optional(),
2501
- balance: z.record(z.string(), z.unknown()).optional(),
2502
- productDetails: z.record(z.string(), z.unknown()).optional()
2503
- };
2504
- var PaywallStructuredContentSchema = z.discriminatedUnion("kind", [
2505
- z.object({
2506
- kind: z.literal("payment_required"),
2507
- product: z.string(),
2508
- checkoutUrl: z.string(),
2509
- message: z.string(),
2510
- ...recoveryFields2
2511
- }),
2512
- z.object({
2513
- kind: z.literal("activation_required"),
2514
- product: z.string(),
2515
- checkoutUrl: z.string(),
2516
- message: z.string(),
2517
- confirmationUrl: z.string().optional(),
2518
- ...recoveryFields2
2519
- })
2520
- ]);
2521
-
2522
2486
  // src/helpers/error.ts
2523
2487
  import { SolvaPayError as SolvaPayError5 } from "@solvapay/core";
2524
2488
  function isErrorResult(result) {
@@ -3648,7 +3612,6 @@ async function verifyWebhook({
3648
3612
  }
3649
3613
  export {
3650
3614
  PaywallError,
3651
- PaywallStructuredContentSchema,
3652
3615
  activatePlanCore,
3653
3616
  attachBusinessDetailsCore,
3654
3617
  buildGateMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/server",
3
- "version": "2.4.0-preview-3f68079d7097167693fa7cdc76752dcf23fd1ab6",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "sideEffects": false,
44
44
  "dependencies": {
45
- "@solvapay/core": "1.7.0-preview-3f68079d7097167693fa7cdc76752dcf23fd1ab6"
45
+ "@solvapay/core": "1.7.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "zod": "^4.2.0",