@paysponge/sdk 0.1.98 → 0.1.115
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/api/generated/openapi/apis/default-api.d.ts +1137 -11
- package/dist/api/generated/openapi/apis/default-api.d.ts.map +1 -1
- package/dist/api/generated/openapi/apis/default-api.js +1124 -1
- package/dist/api/generated/openapi/apis/default-api.js.map +1 -1
- package/dist/api/generated/openapi/models/index.d.ts +4 -0
- package/dist/api/generated/openapi/models/index.d.ts.map +1 -1
- package/dist/api/generated/openapi/models/index.js +4 -0
- package/dist/api/generated/openapi/models/index.js.map +1 -1
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request-steps-inner.d.ts +187 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request-steps-inner.d.ts.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request-steps-inner.js +125 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request-steps-inner.js.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request.d.ts +58 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request.d.ts.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request.js +57 -0
- package/dist/api/generated/openapi/models/post-api-agent-requests-plans-request.js.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-request.d.ts +65 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-request.d.ts.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-request.js +62 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-request.js.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-setup-intent-request.d.ts +53 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-setup-intent-request.d.ts.map +1 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-setup-intent-request.js +50 -0
- package/dist/api/generated/openapi/models/post-api-agents-by-id-stripe-payment-methods-setup-intent-request.js.map +1 -0
- package/dist/api/generated/openapi/models/post-api-cards-request.d.ts +2 -2
- package/dist/api/generated/openapi/models/post-api-cards-request.js +2 -2
- package/dist/api/generated/openapi/models/post-api-cards-request.js.map +1 -1
- package/dist/api/generated/openapi/models/post-api-mpp-session-request-request.d.ts +6 -0
- package/dist/api/generated/openapi/models/post-api-mpp-session-request-request.d.ts.map +1 -1
- package/dist/api/generated/openapi/models/post-api-mpp-session-request-request.js +2 -0
- package/dist/api/generated/openapi/models/post-api-mpp-session-request-request.js.map +1 -1
- package/dist/api/http.d.ts +2 -0
- package/dist/api/http.d.ts.map +1 -1
- package/dist/api/http.js +14 -1
- package/dist/api/http.js.map +1 -1
- package/dist/api/public-tools.d.ts +60 -3
- package/dist/api/public-tools.d.ts.map +1 -1
- package/dist/api/public-tools.js +31 -0
- package/dist/api/public-tools.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +105 -15
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +45 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +33 -5
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +95 -21
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/executor.d.ts.map +1 -1
- package/dist/tools/executor.js +48 -1
- package/dist/tools/executor.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
@@ -845,7 +845,7 @@ function registerCuratedCommands(program, shared) {
|
|
|
845
845
|
});
|
|
846
846
|
});
|
|
847
847
|
const payCmd = program.command("pay").description("Paid API and payment helpers");
|
|
848
|
-
shared(payCmd.command("discover").description("Discover paid API services"))
|
|
848
|
+
shared(payCmd.command("discover").description("Discover x402/MPP paid API services"))
|
|
849
849
|
.usage("[query] [options]")
|
|
850
850
|
.argument("[query]", "service search query")
|
|
851
851
|
.option("--query <query>", "service search query")
|
|
@@ -926,6 +926,67 @@ function registerCuratedCommands(program, shared) {
|
|
|
926
926
|
body: opts.body,
|
|
927
927
|
});
|
|
928
928
|
});
|
|
929
|
+
const mppSessionCmd = payCmd.command("mpp-session").description("Manage MPP payment sessions");
|
|
930
|
+
shared(mppSessionCmd.command("start").description("Start an MPP payment session"))
|
|
931
|
+
.addOption(new Option("--chain <chain>", "MPP session chain").choices(["tempo-testnet", "tempo"]))
|
|
932
|
+
.option("--max-deposit <amount>", "maximum session spend in the chain's primary Tempo stable token")
|
|
933
|
+
.option("--deposit <amount>", "initial on-chain deposit amount")
|
|
934
|
+
.action(async (opts) => {
|
|
935
|
+
await executeToolCommand(opts, "mpp_session", {
|
|
936
|
+
action: "start",
|
|
937
|
+
chain: opts.chain,
|
|
938
|
+
max_deposit: opts.maxDeposit,
|
|
939
|
+
deposit: opts.deposit,
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
shared(mppSessionCmd.command("request").description("Make a request through an MPP payment session"))
|
|
943
|
+
.requiredOption("--session-id <id>", "MPP session ID")
|
|
944
|
+
.requiredOption("--url <url>", "target URL")
|
|
945
|
+
.addOption(new Option("--method <method>", "HTTP method").choices(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("GET"))
|
|
946
|
+
.option("--headers <json>", "headers as JSON", parseJsonObject)
|
|
947
|
+
.option("--body <json>", "request body as JSON", parseJsonValue)
|
|
948
|
+
.option("--stream", "request an SSE/streaming response")
|
|
949
|
+
.action(async (opts) => {
|
|
950
|
+
if (opts.stream) {
|
|
951
|
+
await executeMppSessionStreamCommand(opts, {
|
|
952
|
+
session_id: opts.sessionId,
|
|
953
|
+
url: opts.url,
|
|
954
|
+
method: opts.method,
|
|
955
|
+
headers: opts.headers,
|
|
956
|
+
body: opts.body,
|
|
957
|
+
});
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
await executeToolCommand(opts, "mpp_session", {
|
|
961
|
+
action: "request",
|
|
962
|
+
session_id: opts.sessionId,
|
|
963
|
+
url: opts.url,
|
|
964
|
+
method: opts.method,
|
|
965
|
+
headers: opts.headers,
|
|
966
|
+
body: opts.body,
|
|
967
|
+
stream: opts.stream,
|
|
968
|
+
});
|
|
969
|
+
});
|
|
970
|
+
shared(mppSessionCmd.command("close").description("Close an MPP payment session"))
|
|
971
|
+
.requiredOption("--session-id <id>", "MPP session ID")
|
|
972
|
+
.option("--reason <reason>", "close reason")
|
|
973
|
+
.action(async (opts) => {
|
|
974
|
+
await executeToolCommand(opts, "mpp_session", {
|
|
975
|
+
action: "close",
|
|
976
|
+
session_id: opts.sessionId,
|
|
977
|
+
reason: opts.reason,
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
shared(mppSessionCmd.command("list").description("List MPP payment sessions"))
|
|
981
|
+
.addOption(new Option("--status <status>", "session status filter").choices(["created", "active", "closing", "closed", "error"]))
|
|
982
|
+
.option("--limit <n>", "maximum sessions to return", parseInt)
|
|
983
|
+
.action(async (opts) => {
|
|
984
|
+
await executeToolCommand(opts, "mpp_session", {
|
|
985
|
+
action: "list",
|
|
986
|
+
status: opts.status,
|
|
987
|
+
limit: opts.limit,
|
|
988
|
+
});
|
|
989
|
+
});
|
|
929
990
|
const keysCmd = program.command("keys").description("Stored service keys");
|
|
930
991
|
shared(keysCmd.command("list").description("List stored keys"))
|
|
931
992
|
.action(async (opts) => {
|
|
@@ -1017,15 +1078,15 @@ function registerCuratedCommands(program, shared) {
|
|
|
1017
1078
|
enrollment_id: opts.enrollmentId,
|
|
1018
1079
|
});
|
|
1019
1080
|
});
|
|
1020
|
-
shared(cardCmd.command("get").description("Fetch the user's card (Sponge Card or
|
|
1021
|
-
.option("--card-type <type>", "explicit card source:
|
|
1022
|
-
.option("--payment-method-id <id>", "specific
|
|
1023
|
-
.option("--amount <amount>", "transaction amount for spending-limit checks (
|
|
1024
|
-
.option("--currency <code>", "ISO currency code (
|
|
1025
|
-
.option("--merchant-name <name>", "merchant name (
|
|
1026
|
-
.option("--merchant-url <url>", "merchant URL (
|
|
1081
|
+
shared(cardCmd.command("get").description("Fetch the user's card (Sponge Card or stored card)"))
|
|
1082
|
+
.option("--card-type <type>", "explicit card source: Sponge Card or 'stored_card'")
|
|
1083
|
+
.option("--payment-method-id <id>", "specific saved payment method ID")
|
|
1084
|
+
.option("--amount <amount>", "transaction amount for spending-limit checks (stored-card path only)")
|
|
1085
|
+
.option("--currency <code>", "ISO currency code (stored-card path only)")
|
|
1086
|
+
.option("--merchant-name <name>", "merchant name (stored-card path only)")
|
|
1087
|
+
.option("--merchant-url <url>", "merchant URL (stored-card path only)")
|
|
1027
1088
|
.action(async (opts) => {
|
|
1028
|
-
await executeToolCommand(opts, "
|
|
1089
|
+
await executeToolCommand(opts, "get_credit_card", {
|
|
1029
1090
|
card_type: opts.cardType,
|
|
1030
1091
|
payment_method_id: opts.paymentMethodId,
|
|
1031
1092
|
amount: opts.amount,
|
|
@@ -1034,15 +1095,15 @@ function registerCuratedCommands(program, shared) {
|
|
|
1034
1095
|
merchant_url: opts.merchantUrl,
|
|
1035
1096
|
});
|
|
1036
1097
|
});
|
|
1037
|
-
shared(cardCmd.command("vaulted").description("Fetch a
|
|
1038
|
-
.option("--payment-method-id <id>", "specific
|
|
1098
|
+
shared(cardCmd.command("vaulted").description("Fetch a stored card session"))
|
|
1099
|
+
.option("--payment-method-id <id>", "specific saved payment method ID")
|
|
1039
1100
|
.option("--amount <amount>", "transaction amount for spending-limit checks")
|
|
1040
1101
|
.option("--currency <code>", "ISO currency code")
|
|
1041
1102
|
.option("--merchant-name <name>", "merchant name")
|
|
1042
1103
|
.option("--merchant-url <url>", "merchant URL")
|
|
1043
1104
|
.action(async (opts) => {
|
|
1044
|
-
await executeToolCommand(opts, "
|
|
1045
|
-
card_type: "
|
|
1105
|
+
await executeToolCommand(opts, "get_credit_card", {
|
|
1106
|
+
card_type: "stored_card",
|
|
1046
1107
|
payment_method_id: opts.paymentMethodId,
|
|
1047
1108
|
amount: opts.amount,
|
|
1048
1109
|
currency: opts.currency,
|
|
@@ -1728,6 +1789,35 @@ async function executeToolCommand(opts, toolName, input) {
|
|
|
1728
1789
|
}
|
|
1729
1790
|
displayToolResult(getToolDefinition(toolName), result.data);
|
|
1730
1791
|
}
|
|
1792
|
+
async function executeMppSessionStreamCommand(opts, input) {
|
|
1793
|
+
const wallet = await connectWallet(opts);
|
|
1794
|
+
const response = await wallet.streamMppSessionRequest({
|
|
1795
|
+
session_id: String(input.session_id),
|
|
1796
|
+
url: String(input.url),
|
|
1797
|
+
method: input.method,
|
|
1798
|
+
headers: input.headers,
|
|
1799
|
+
body: input.body,
|
|
1800
|
+
});
|
|
1801
|
+
await pipeResponseBodyToStdout(response);
|
|
1802
|
+
}
|
|
1803
|
+
async function pipeResponseBodyToStdout(response) {
|
|
1804
|
+
if (!response.body)
|
|
1805
|
+
return;
|
|
1806
|
+
const reader = response.body.getReader();
|
|
1807
|
+
const decoder = new TextDecoder();
|
|
1808
|
+
while (true) {
|
|
1809
|
+
const { value, done } = await reader.read();
|
|
1810
|
+
if (done)
|
|
1811
|
+
break;
|
|
1812
|
+
if (value) {
|
|
1813
|
+
process.stdout.write(decoder.decode(value, { stream: true }));
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
const remaining = decoder.decode();
|
|
1817
|
+
if (remaining) {
|
|
1818
|
+
process.stdout.write(remaining);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1731
1821
|
function getToolDefinition(name) {
|
|
1732
1822
|
const tool = TOOL_DEFINITIONS.find((entry) => entry.name === name);
|
|
1733
1823
|
if (!tool) {
|
|
@@ -1792,8 +1882,8 @@ async function handleCardAdd(opts) {
|
|
|
1792
1882
|
flow === "link"
|
|
1793
1883
|
? "This opens the Link card connection flow."
|
|
1794
1884
|
: flow === "basis-theory"
|
|
1795
|
-
? "This opens the manual card flow
|
|
1796
|
-
: "Choose manual
|
|
1885
|
+
? "This opens the secure manual card setup flow."
|
|
1886
|
+
: "Choose manual card setup or Link in the dashboard.",
|
|
1797
1887
|
].join("\n"));
|
|
1798
1888
|
if (opts.browser === false)
|
|
1799
1889
|
return;
|