@solvapay/mcp-core 0.2.6-preview-4fc78fc1b86faff0348e15fb04bb3daa798eaf03 → 0.2.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.
- package/dist/index.cjs +9 -39
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +10 -36
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
buildSolvaPayPrompts: () => buildSolvaPayPrompts,
|
|
54
54
|
buildSolvaPayRequest: () => buildSolvaPayRequest,
|
|
55
55
|
createBuildBootstrapPayload: () => createBuildBootstrapPayload,
|
|
56
|
-
creditsToDisplayMinorUnits: () => creditsToDisplayMinorUnits,
|
|
56
|
+
creditsToDisplayMinorUnits: () => import_core2.creditsToDisplayMinorUnits,
|
|
57
57
|
decodeJwtPayload: () => decodeJwtPayload,
|
|
58
58
|
defaultGetCustomerRef: () => defaultGetCustomerRef,
|
|
59
59
|
defaultIsChatGptRequest: () => defaultIsChatGptRequest,
|
|
@@ -64,9 +64,9 @@ __export(index_exports, {
|
|
|
64
64
|
getCustomerRefFromJwtPayload: () => getCustomerRefFromJwtPayload,
|
|
65
65
|
getOAuthAuthorizationServerResponse: () => getOAuthAuthorizationServerResponse,
|
|
66
66
|
getOAuthProtectedResourceResponse: () => getOAuthProtectedResourceResponse,
|
|
67
|
-
isZeroDecimalCurrency: () => isZeroDecimalCurrency,
|
|
67
|
+
isZeroDecimalCurrency: () => import_core2.isZeroDecimalCurrency,
|
|
68
68
|
mergeCsp: () => mergeCsp,
|
|
69
|
-
minorUnitsPerMajor: () => minorUnitsPerMajor,
|
|
69
|
+
minorUnitsPerMajor: () => import_core2.minorUnitsPerMajor,
|
|
70
70
|
narrateActivatePlan: () => narrateActivatePlan,
|
|
71
71
|
narrateManageAccount: () => narrateManageAccount,
|
|
72
72
|
narrateTopup: () => narrateTopup,
|
|
@@ -118,44 +118,11 @@ var VIEW_FOR_TOOL = Object.fromEntries(
|
|
|
118
118
|
var OPEN_TOOL_FOR_VIEW = TOOL_FOR_VIEW;
|
|
119
119
|
var VIEW_FOR_OPEN_TOOL = VIEW_FOR_TOOL;
|
|
120
120
|
|
|
121
|
-
// src/credit-display.ts
|
|
122
|
-
var ZERO_DECIMAL = /* @__PURE__ */ new Set([
|
|
123
|
-
"bif",
|
|
124
|
-
"clp",
|
|
125
|
-
"djf",
|
|
126
|
-
"gnf",
|
|
127
|
-
"jpy",
|
|
128
|
-
"kmf",
|
|
129
|
-
"krw",
|
|
130
|
-
"mga",
|
|
131
|
-
"pyg",
|
|
132
|
-
"rwf",
|
|
133
|
-
"ugx",
|
|
134
|
-
"vnd",
|
|
135
|
-
"vuv",
|
|
136
|
-
"xaf",
|
|
137
|
-
"xof",
|
|
138
|
-
"xpf"
|
|
139
|
-
]);
|
|
140
|
-
function minorUnitsPerMajor(currency) {
|
|
141
|
-
return ZERO_DECIMAL.has(currency.toLowerCase()) ? 1 : 100;
|
|
142
|
-
}
|
|
143
|
-
function isZeroDecimalCurrency(currency) {
|
|
144
|
-
return ZERO_DECIMAL.has(currency.toLowerCase());
|
|
145
|
-
}
|
|
146
|
-
function creditsToDisplayMinorUnits(input) {
|
|
147
|
-
const { credits, creditsPerMinorUnit, displayExchangeRate, displayCurrency } = input;
|
|
148
|
-
if (!creditsPerMinorUnit || creditsPerMinorUnit <= 0) return null;
|
|
149
|
-
const usdMajor = credits / creditsPerMinorUnit / 100;
|
|
150
|
-
return Math.round(
|
|
151
|
-
usdMajor * (displayExchangeRate || 1) * minorUnitsPerMajor(displayCurrency)
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
121
|
// src/narrate.ts
|
|
122
|
+
var import_core = require("@solvapay/core");
|
|
156
123
|
function formatMoney(amountMinor, currency) {
|
|
157
124
|
if (amountMinor == null || !currency) return null;
|
|
158
|
-
const zero = isZeroDecimalCurrency(currency);
|
|
125
|
+
const zero = (0, import_core.isZeroDecimalCurrency)(currency);
|
|
159
126
|
const major = zero ? amountMinor : amountMinor / 100;
|
|
160
127
|
try {
|
|
161
128
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -197,7 +164,7 @@ function balanceRow(customer) {
|
|
|
197
164
|
if (!credits && credits !== 0) return null;
|
|
198
165
|
const currency = customer.balance.displayCurrency;
|
|
199
166
|
const creditsPerMinorUnit = customer.balance.creditsPerMinorUnit;
|
|
200
|
-
const displayMinor = currency && typeof creditsPerMinorUnit === "number" && creditsPerMinorUnit > 0 ? creditsToDisplayMinorUnits({
|
|
167
|
+
const displayMinor = currency && typeof creditsPerMinorUnit === "number" && creditsPerMinorUnit > 0 ? (0, import_core.creditsToDisplayMinorUnits)({
|
|
201
168
|
credits,
|
|
202
169
|
creditsPerMinorUnit,
|
|
203
170
|
displayExchangeRate: customer.balance.displayExchangeRate ?? 1,
|
|
@@ -522,6 +489,9 @@ function previewJson(value, max = 400) {
|
|
|
522
489
|
}
|
|
523
490
|
}
|
|
524
491
|
|
|
492
|
+
// src/index.ts
|
|
493
|
+
var import_core2 = require("@solvapay/core");
|
|
494
|
+
|
|
525
495
|
// src/paywallToolResult.ts
|
|
526
496
|
var import_server = require("@solvapay/server");
|
|
527
497
|
async function paywallToolResult(errOrGate, _ctx = {}) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ZodTypeAny } from 'zod';
|
|
2
2
|
import { PurchaseCheckResult, PaymentMethodInfo, CustomerBalanceResult, GetUsageResult, SdkMerchantResponse, SdkProductResponse, components, SolvaPay, PaywallError, PaywallStructuredContent } from '@solvapay/server';
|
|
3
|
+
export { creditsToDisplayMinorUnits, isZeroDecimalCurrency, minorUnitsPerMajor } from '@solvapay/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Canonical MCP tool names for the SolvaPay transport + bootstrap tools.
|
|
@@ -793,22 +794,6 @@ declare function toolErrorResult(error: {
|
|
|
793
794
|
*/
|
|
794
795
|
declare function previewJson(value: unknown, max?: number): string;
|
|
795
796
|
|
|
796
|
-
/**
|
|
797
|
-
* Shared credit → fiat conversion for MCP bootstrap narration and React
|
|
798
|
-
* balance surfaces. Backend contract: `credits = USD_cents × creditsPerMinorUnit`
|
|
799
|
-
* (mint scale; `creditsPerMinorUnit` is typically 100), and
|
|
800
|
-
* `displayExchangeRate` is USD → display currency (e.g. 9.46 for SEK).
|
|
801
|
-
*/
|
|
802
|
-
declare function minorUnitsPerMajor(currency: string): number;
|
|
803
|
-
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
804
|
-
/** Fiat value of a credit balance, in MINOR units of `displayCurrency`. */
|
|
805
|
-
declare function creditsToDisplayMinorUnits(input: {
|
|
806
|
-
credits: number;
|
|
807
|
-
creditsPerMinorUnit: number;
|
|
808
|
-
displayExchangeRate: number;
|
|
809
|
-
displayCurrency: string;
|
|
810
|
-
}): number | null;
|
|
811
|
-
|
|
812
797
|
/**
|
|
813
798
|
* Standalone `buildBootstrapPayload` factory — same logic
|
|
814
799
|
* `buildSolvaPayDescriptors` wires under the intent tools, exposed
|
|
@@ -1374,4 +1359,4 @@ interface BuildAuthInfoFromBearerOptions extends McpBearerCustomerRefOptions {
|
|
|
1374
1359
|
}
|
|
1375
1360
|
declare function buildAuthInfoFromBearer(authorization?: string | null, options?: BuildAuthInfoFromBearerOptions): McpToolExtra['authInfo'] | null;
|
|
1376
1361
|
|
|
1377
|
-
export { type ApplyHideToolsByAudienceContext, type ApplyHideToolsByAudienceExtra, type ApplyHideToolsByAudienceOptions, type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type HideToolsByAudienceBypass, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_BOOTSTRAP_MIME_TYPE, SOLVAPAY_BOOTSTRAP_URI, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayBootstrapResourceDescriptor, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, applyHideToolsByAudience, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload,
|
|
1362
|
+
export { type ApplyHideToolsByAudienceContext, type ApplyHideToolsByAudienceExtra, type ApplyHideToolsByAudienceOptions, type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type HideToolsByAudienceBypass, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_BOOTSTRAP_MIME_TYPE, SOLVAPAY_BOOTSTRAP_URI, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayBootstrapResourceDescriptor, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, applyHideToolsByAudience, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload, decodeJwtPayload, defaultGetCustomerRef, defaultIsChatGptRequest, deriveIcons, enrichPurchase, extractBearerToken, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, mergeCsp, narrateActivatePlan, narrateManageAccount, narrateTopup, narrateUpgrade, narratedToolResult, parseMode, paywallToolResult, previewJson, resolveOAuthPaths, toolErrorResult, toolResult, uiPlaceholder, withoutTrailingSlash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ZodTypeAny } from 'zod';
|
|
2
2
|
import { PurchaseCheckResult, PaymentMethodInfo, CustomerBalanceResult, GetUsageResult, SdkMerchantResponse, SdkProductResponse, components, SolvaPay, PaywallError, PaywallStructuredContent } from '@solvapay/server';
|
|
3
|
+
export { creditsToDisplayMinorUnits, isZeroDecimalCurrency, minorUnitsPerMajor } from '@solvapay/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Canonical MCP tool names for the SolvaPay transport + bootstrap tools.
|
|
@@ -793,22 +794,6 @@ declare function toolErrorResult(error: {
|
|
|
793
794
|
*/
|
|
794
795
|
declare function previewJson(value: unknown, max?: number): string;
|
|
795
796
|
|
|
796
|
-
/**
|
|
797
|
-
* Shared credit → fiat conversion for MCP bootstrap narration and React
|
|
798
|
-
* balance surfaces. Backend contract: `credits = USD_cents × creditsPerMinorUnit`
|
|
799
|
-
* (mint scale; `creditsPerMinorUnit` is typically 100), and
|
|
800
|
-
* `displayExchangeRate` is USD → display currency (e.g. 9.46 for SEK).
|
|
801
|
-
*/
|
|
802
|
-
declare function minorUnitsPerMajor(currency: string): number;
|
|
803
|
-
declare function isZeroDecimalCurrency(currency: string): boolean;
|
|
804
|
-
/** Fiat value of a credit balance, in MINOR units of `displayCurrency`. */
|
|
805
|
-
declare function creditsToDisplayMinorUnits(input: {
|
|
806
|
-
credits: number;
|
|
807
|
-
creditsPerMinorUnit: number;
|
|
808
|
-
displayExchangeRate: number;
|
|
809
|
-
displayCurrency: string;
|
|
810
|
-
}): number | null;
|
|
811
|
-
|
|
812
797
|
/**
|
|
813
798
|
* Standalone `buildBootstrapPayload` factory — same logic
|
|
814
799
|
* `buildSolvaPayDescriptors` wires under the intent tools, exposed
|
|
@@ -1374,4 +1359,4 @@ interface BuildAuthInfoFromBearerOptions extends McpBearerCustomerRefOptions {
|
|
|
1374
1359
|
}
|
|
1375
1360
|
declare function buildAuthInfoFromBearer(authorization?: string | null, options?: BuildAuthInfoFromBearerOptions): McpToolExtra['authInfo'] | null;
|
|
1376
1361
|
|
|
1377
|
-
export { type ApplyHideToolsByAudienceContext, type ApplyHideToolsByAudienceExtra, type ApplyHideToolsByAudienceOptions, type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type HideToolsByAudienceBypass, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_BOOTSTRAP_MIME_TYPE, SOLVAPAY_BOOTSTRAP_URI, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayBootstrapResourceDescriptor, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, applyHideToolsByAudience, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload,
|
|
1362
|
+
export { type ApplyHideToolsByAudienceContext, type ApplyHideToolsByAudienceExtra, type ApplyHideToolsByAudienceOptions, type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type HideToolsByAudienceBypass, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_BOOTSTRAP_MIME_TYPE, SOLVAPAY_BOOTSTRAP_URI, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayBootstrapResourceDescriptor, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, applyHideToolsByAudience, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload, decodeJwtPayload, defaultGetCustomerRef, defaultIsChatGptRequest, deriveIcons, enrichPurchase, extractBearerToken, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, mergeCsp, narrateActivatePlan, narrateManageAccount, narrateTopup, narrateUpgrade, narratedToolResult, parseMode, paywallToolResult, previewJson, resolveOAuthPaths, toolErrorResult, toolResult, uiPlaceholder, withoutTrailingSlash };
|
package/dist/index.js
CHANGED
|
@@ -33,41 +33,8 @@ var VIEW_FOR_TOOL = Object.fromEntries(
|
|
|
33
33
|
var OPEN_TOOL_FOR_VIEW = TOOL_FOR_VIEW;
|
|
34
34
|
var VIEW_FOR_OPEN_TOOL = VIEW_FOR_TOOL;
|
|
35
35
|
|
|
36
|
-
// src/credit-display.ts
|
|
37
|
-
var ZERO_DECIMAL = /* @__PURE__ */ new Set([
|
|
38
|
-
"bif",
|
|
39
|
-
"clp",
|
|
40
|
-
"djf",
|
|
41
|
-
"gnf",
|
|
42
|
-
"jpy",
|
|
43
|
-
"kmf",
|
|
44
|
-
"krw",
|
|
45
|
-
"mga",
|
|
46
|
-
"pyg",
|
|
47
|
-
"rwf",
|
|
48
|
-
"ugx",
|
|
49
|
-
"vnd",
|
|
50
|
-
"vuv",
|
|
51
|
-
"xaf",
|
|
52
|
-
"xof",
|
|
53
|
-
"xpf"
|
|
54
|
-
]);
|
|
55
|
-
function minorUnitsPerMajor(currency) {
|
|
56
|
-
return ZERO_DECIMAL.has(currency.toLowerCase()) ? 1 : 100;
|
|
57
|
-
}
|
|
58
|
-
function isZeroDecimalCurrency(currency) {
|
|
59
|
-
return ZERO_DECIMAL.has(currency.toLowerCase());
|
|
60
|
-
}
|
|
61
|
-
function creditsToDisplayMinorUnits(input) {
|
|
62
|
-
const { credits, creditsPerMinorUnit, displayExchangeRate, displayCurrency } = input;
|
|
63
|
-
if (!creditsPerMinorUnit || creditsPerMinorUnit <= 0) return null;
|
|
64
|
-
const usdMajor = credits / creditsPerMinorUnit / 100;
|
|
65
|
-
return Math.round(
|
|
66
|
-
usdMajor * (displayExchangeRate || 1) * minorUnitsPerMajor(displayCurrency)
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
36
|
// src/narrate.ts
|
|
37
|
+
import { creditsToDisplayMinorUnits, isZeroDecimalCurrency } from "@solvapay/core";
|
|
71
38
|
function formatMoney(amountMinor, currency) {
|
|
72
39
|
if (amountMinor == null || !currency) return null;
|
|
73
40
|
const zero = isZeroDecimalCurrency(currency);
|
|
@@ -437,6 +404,13 @@ function previewJson(value, max = 400) {
|
|
|
437
404
|
}
|
|
438
405
|
}
|
|
439
406
|
|
|
407
|
+
// src/index.ts
|
|
408
|
+
import {
|
|
409
|
+
creditsToDisplayMinorUnits as creditsToDisplayMinorUnits2,
|
|
410
|
+
isZeroDecimalCurrency as isZeroDecimalCurrency2,
|
|
411
|
+
minorUnitsPerMajor
|
|
412
|
+
} from "@solvapay/core";
|
|
413
|
+
|
|
440
414
|
// src/paywallToolResult.ts
|
|
441
415
|
import { PaywallError } from "@solvapay/server";
|
|
442
416
|
async function paywallToolResult(errOrGate, _ctx = {}) {
|
|
@@ -1487,7 +1461,7 @@ export {
|
|
|
1487
1461
|
buildSolvaPayPrompts,
|
|
1488
1462
|
buildSolvaPayRequest,
|
|
1489
1463
|
createBuildBootstrapPayload,
|
|
1490
|
-
creditsToDisplayMinorUnits,
|
|
1464
|
+
creditsToDisplayMinorUnits2 as creditsToDisplayMinorUnits,
|
|
1491
1465
|
decodeJwtPayload,
|
|
1492
1466
|
defaultGetCustomerRef,
|
|
1493
1467
|
defaultIsChatGptRequest,
|
|
@@ -1498,7 +1472,7 @@ export {
|
|
|
1498
1472
|
getCustomerRefFromJwtPayload,
|
|
1499
1473
|
getOAuthAuthorizationServerResponse,
|
|
1500
1474
|
getOAuthProtectedResourceResponse,
|
|
1501
|
-
isZeroDecimalCurrency,
|
|
1475
|
+
isZeroDecimalCurrency2 as isZeroDecimalCurrency,
|
|
1502
1476
|
mergeCsp,
|
|
1503
1477
|
minorUnitsPerMajor,
|
|
1504
1478
|
narrateActivatePlan,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solvapay/mcp-core",
|
|
3
|
-
"version": "0.2.6
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Framework-neutral MCP contracts for the SolvaPay SDK (tool names, descriptors, payable handler, paywall meta, CSP, bootstrap payload, OAuth discovery JSON builders, bearer/JWT helpers).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
},
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@solvapay/core": "1.0
|
|
33
|
+
"@solvapay/core": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"zod": "^3.25.0 || ^4.0.0",
|
|
37
|
-
"@solvapay/server": "^1.2.1
|
|
37
|
+
"@solvapay/server": "^1.2.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.5.1",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vitest": "^4.1.2",
|
|
43
43
|
"zod": "^4.3.6",
|
|
44
|
-
"@solvapay/server": "1.2.1
|
|
44
|
+
"@solvapay/server": "1.2.1",
|
|
45
45
|
"@solvapay/test-utils": "^0.0.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|