modern-treasury-mcp 3.2.0 → 3.3.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/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +269 -7
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +269 -7
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +11 -13
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +11 -13
- package/code-tool.mjs.map +1 -1
- package/dynamic-tools.d.mts +1 -1
- package/dynamic-tools.d.ts +1 -1
- package/dynamic-tools.js +1 -1
- package/dynamic-tools.mjs +1 -1
- package/options.d.mts.map +1 -1
- package/options.d.ts.map +1 -1
- package/options.js +6 -3
- package/options.js.map +1 -1
- package/options.mjs +6 -3
- package/options.mjs.map +1 -1
- package/package.json +4 -2
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-worker.ts +314 -7
- package/src/code-tool.ts +14 -13
- package/src/dynamic-tools.ts +1 -1
- package/src/options.ts +10 -3
- package/src/server.ts +1 -1
- package/src/tools/bulk-requests/create-bulk-requests.ts +1 -0
- package/src/tools/counterparties/create-counterparties.ts +1 -5
- package/src/tools/external-accounts/create-external-accounts.ts +1 -5
- package/src/tools/payment-orders/create-async-payment-orders.ts +1 -0
- package/src/tools/payment-orders/create-payment-orders.ts +1 -0
- package/src/tools/payment-orders/update-payment-orders.ts +1 -0
- package/tools/bulk-requests/create-bulk-requests.d.mts.map +1 -1
- package/tools/bulk-requests/create-bulk-requests.d.ts.map +1 -1
- package/tools/bulk-requests/create-bulk-requests.js +1 -0
- package/tools/bulk-requests/create-bulk-requests.js.map +1 -1
- package/tools/bulk-requests/create-bulk-requests.mjs +1 -0
- package/tools/bulk-requests/create-bulk-requests.mjs.map +1 -1
- package/tools/counterparties/create-counterparties.d.mts.map +1 -1
- package/tools/counterparties/create-counterparties.d.ts.map +1 -1
- package/tools/counterparties/create-counterparties.js +1 -5
- package/tools/counterparties/create-counterparties.js.map +1 -1
- package/tools/counterparties/create-counterparties.mjs +1 -5
- package/tools/counterparties/create-counterparties.mjs.map +1 -1
- package/tools/external-accounts/create-external-accounts.d.mts.map +1 -1
- package/tools/external-accounts/create-external-accounts.d.ts.map +1 -1
- package/tools/external-accounts/create-external-accounts.js +1 -5
- package/tools/external-accounts/create-external-accounts.js.map +1 -1
- package/tools/external-accounts/create-external-accounts.mjs +1 -5
- package/tools/external-accounts/create-external-accounts.mjs.map +1 -1
- package/tools/payment-orders/create-async-payment-orders.d.mts.map +1 -1
- package/tools/payment-orders/create-async-payment-orders.d.ts.map +1 -1
- package/tools/payment-orders/create-async-payment-orders.js +1 -0
- package/tools/payment-orders/create-async-payment-orders.js.map +1 -1
- package/tools/payment-orders/create-async-payment-orders.mjs +1 -0
- package/tools/payment-orders/create-async-payment-orders.mjs.map +1 -1
- package/tools/payment-orders/create-payment-orders.d.mts.map +1 -1
- package/tools/payment-orders/create-payment-orders.d.ts.map +1 -1
- package/tools/payment-orders/create-payment-orders.js +1 -0
- package/tools/payment-orders/create-payment-orders.js.map +1 -1
- package/tools/payment-orders/create-payment-orders.mjs +1 -0
- package/tools/payment-orders/create-payment-orders.mjs.map +1 -1
- package/tools/payment-orders/update-payment-orders.d.mts.map +1 -1
- package/tools/payment-orders/update-payment-orders.d.ts.map +1 -1
- package/tools/payment-orders/update-payment-orders.js +1 -0
- package/tools/payment-orders/update-payment-orders.js.map +1 -1
- package/tools/payment-orders/update-payment-orders.mjs +1 -0
- package/tools/payment-orders/update-payment-orders.mjs.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.d.mts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"code-tool-worker.d.mts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAwS0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAwDrD,wBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.d.ts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"code-tool-worker.d.ts","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";iBAwS0B,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAwDrD,wBAAyB"}
|
package/code-tool-worker.js
CHANGED
|
@@ -5,9 +5,275 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const node_util_1 = __importDefault(require("node:util"));
|
|
8
|
+
const fuse_js_1 = __importDefault(require("fuse.js"));
|
|
9
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
10
|
const modern_treasury_1 = require("modern-treasury");
|
|
11
|
+
function getRunFunctionNode(code) {
|
|
12
|
+
const sourceFile = typescript_1.default.createSourceFile('code.ts', code, typescript_1.default.ScriptTarget.Latest, true);
|
|
13
|
+
for (const statement of sourceFile.statements) {
|
|
14
|
+
// Check for top-level function declarations
|
|
15
|
+
if (typescript_1.default.isFunctionDeclaration(statement)) {
|
|
16
|
+
if (statement.name?.text === 'run') {
|
|
17
|
+
return statement;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Check for variable declarations: const run = () => {} or const run = function() {}
|
|
21
|
+
if (typescript_1.default.isVariableStatement(statement)) {
|
|
22
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
23
|
+
if (typescript_1.default.isIdentifier(declaration.name) && declaration.name.text === 'run') {
|
|
24
|
+
// Check if it's initialized with a function
|
|
25
|
+
if (declaration.initializer &&
|
|
26
|
+
(typescript_1.default.isFunctionExpression(declaration.initializer) || typescript_1.default.isArrowFunction(declaration.initializer))) {
|
|
27
|
+
return declaration.initializer;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const fuse = new fuse_js_1.default([
|
|
36
|
+
'client.ping',
|
|
37
|
+
'client.connections.list',
|
|
38
|
+
'client.counterparties.collectAccount',
|
|
39
|
+
'client.counterparties.create',
|
|
40
|
+
'client.counterparties.delete',
|
|
41
|
+
'client.counterparties.list',
|
|
42
|
+
'client.counterparties.retrieve',
|
|
43
|
+
'client.counterparties.update',
|
|
44
|
+
'client.events.list',
|
|
45
|
+
'client.events.retrieve',
|
|
46
|
+
'client.expectedPayments.create',
|
|
47
|
+
'client.expectedPayments.delete',
|
|
48
|
+
'client.expectedPayments.list',
|
|
49
|
+
'client.expectedPayments.retrieve',
|
|
50
|
+
'client.expectedPayments.update',
|
|
51
|
+
'client.externalAccounts.completeVerification',
|
|
52
|
+
'client.externalAccounts.create',
|
|
53
|
+
'client.externalAccounts.delete',
|
|
54
|
+
'client.externalAccounts.list',
|
|
55
|
+
'client.externalAccounts.retrieve',
|
|
56
|
+
'client.externalAccounts.update',
|
|
57
|
+
'client.externalAccounts.verify',
|
|
58
|
+
'client.incomingPaymentDetails.createAsync',
|
|
59
|
+
'client.incomingPaymentDetails.list',
|
|
60
|
+
'client.incomingPaymentDetails.retrieve',
|
|
61
|
+
'client.incomingPaymentDetails.update',
|
|
62
|
+
'client.invoices.addPaymentOrder',
|
|
63
|
+
'client.invoices.create',
|
|
64
|
+
'client.invoices.list',
|
|
65
|
+
'client.invoices.retrieve',
|
|
66
|
+
'client.invoices.update',
|
|
67
|
+
'client.invoices.lineItems.create',
|
|
68
|
+
'client.invoices.lineItems.delete',
|
|
69
|
+
'client.invoices.lineItems.list',
|
|
70
|
+
'client.invoices.lineItems.retrieve',
|
|
71
|
+
'client.invoices.lineItems.update',
|
|
72
|
+
'client.documents.create',
|
|
73
|
+
'client.documents.list',
|
|
74
|
+
'client.documents.retrieve',
|
|
75
|
+
'client.accountCollectionFlows.create',
|
|
76
|
+
'client.accountCollectionFlows.list',
|
|
77
|
+
'client.accountCollectionFlows.retrieve',
|
|
78
|
+
'client.accountCollectionFlows.update',
|
|
79
|
+
'client.accountDetails.create',
|
|
80
|
+
'client.accountDetails.delete',
|
|
81
|
+
'client.accountDetails.list',
|
|
82
|
+
'client.accountDetails.retrieve',
|
|
83
|
+
'client.routingDetails.create',
|
|
84
|
+
'client.routingDetails.delete',
|
|
85
|
+
'client.routingDetails.list',
|
|
86
|
+
'client.routingDetails.retrieve',
|
|
87
|
+
'client.internalAccounts.create',
|
|
88
|
+
'client.internalAccounts.list',
|
|
89
|
+
'client.internalAccounts.retrieve',
|
|
90
|
+
'client.internalAccounts.update',
|
|
91
|
+
'client.internalAccounts.updateAccountCapability',
|
|
92
|
+
'client.internalAccounts.balanceReports.create',
|
|
93
|
+
'client.internalAccounts.balanceReports.delete',
|
|
94
|
+
'client.internalAccounts.balanceReports.list',
|
|
95
|
+
'client.internalAccounts.balanceReports.retrieve',
|
|
96
|
+
'client.ledgers.create',
|
|
97
|
+
'client.ledgers.delete',
|
|
98
|
+
'client.ledgers.list',
|
|
99
|
+
'client.ledgers.retrieve',
|
|
100
|
+
'client.ledgers.update',
|
|
101
|
+
'client.ledgerAccountCategories.addLedgerAccount',
|
|
102
|
+
'client.ledgerAccountCategories.addNestedCategory',
|
|
103
|
+
'client.ledgerAccountCategories.create',
|
|
104
|
+
'client.ledgerAccountCategories.delete',
|
|
105
|
+
'client.ledgerAccountCategories.list',
|
|
106
|
+
'client.ledgerAccountCategories.removeLedgerAccount',
|
|
107
|
+
'client.ledgerAccountCategories.removeNestedCategory',
|
|
108
|
+
'client.ledgerAccountCategories.retrieve',
|
|
109
|
+
'client.ledgerAccountCategories.update',
|
|
110
|
+
'client.ledgerAccounts.create',
|
|
111
|
+
'client.ledgerAccounts.delete',
|
|
112
|
+
'client.ledgerAccounts.list',
|
|
113
|
+
'client.ledgerAccounts.retrieve',
|
|
114
|
+
'client.ledgerAccounts.update',
|
|
115
|
+
'client.ledgerAccountBalanceMonitors.create',
|
|
116
|
+
'client.ledgerAccountBalanceMonitors.delete',
|
|
117
|
+
'client.ledgerAccountBalanceMonitors.list',
|
|
118
|
+
'client.ledgerAccountBalanceMonitors.retrieve',
|
|
119
|
+
'client.ledgerAccountBalanceMonitors.update',
|
|
120
|
+
'client.ledgerAccountStatements.create',
|
|
121
|
+
'client.ledgerAccountStatements.retrieve',
|
|
122
|
+
'client.ledgerEntries.list',
|
|
123
|
+
'client.ledgerEntries.retrieve',
|
|
124
|
+
'client.ledgerEntries.update',
|
|
125
|
+
'client.ledgerTransactions.create',
|
|
126
|
+
'client.ledgerTransactions.createPartialPost',
|
|
127
|
+
'client.ledgerTransactions.createReversal',
|
|
128
|
+
'client.ledgerTransactions.list',
|
|
129
|
+
'client.ledgerTransactions.retrieve',
|
|
130
|
+
'client.ledgerTransactions.update',
|
|
131
|
+
'client.ledgerTransactions.versions.list',
|
|
132
|
+
'client.lineItems.list',
|
|
133
|
+
'client.lineItems.retrieve',
|
|
134
|
+
'client.lineItems.update',
|
|
135
|
+
'client.paymentFlows.create',
|
|
136
|
+
'client.paymentFlows.list',
|
|
137
|
+
'client.paymentFlows.retrieve',
|
|
138
|
+
'client.paymentFlows.update',
|
|
139
|
+
'client.paymentOrders.create',
|
|
140
|
+
'client.paymentOrders.createAsync',
|
|
141
|
+
'client.paymentOrders.list',
|
|
142
|
+
'client.paymentOrders.retrieve',
|
|
143
|
+
'client.paymentOrders.update',
|
|
144
|
+
'client.paymentOrders.reversals.create',
|
|
145
|
+
'client.paymentOrders.reversals.list',
|
|
146
|
+
'client.paymentOrders.reversals.retrieve',
|
|
147
|
+
'client.paymentReferences.list',
|
|
148
|
+
'client.paymentReferences.retireve',
|
|
149
|
+
'client.paymentReferences.retrieve',
|
|
150
|
+
'client.returns.create',
|
|
151
|
+
'client.returns.list',
|
|
152
|
+
'client.returns.retrieve',
|
|
153
|
+
'client.transactions.create',
|
|
154
|
+
'client.transactions.delete',
|
|
155
|
+
'client.transactions.list',
|
|
156
|
+
'client.transactions.retrieve',
|
|
157
|
+
'client.transactions.update',
|
|
158
|
+
'client.transactions.lineItems.create',
|
|
159
|
+
'client.transactions.lineItems.delete',
|
|
160
|
+
'client.transactions.lineItems.list',
|
|
161
|
+
'client.transactions.lineItems.retrieve',
|
|
162
|
+
'client.validations.validateRoutingNumber',
|
|
163
|
+
'client.virtualAccounts.create',
|
|
164
|
+
'client.virtualAccounts.delete',
|
|
165
|
+
'client.virtualAccounts.list',
|
|
166
|
+
'client.virtualAccounts.retrieve',
|
|
167
|
+
'client.virtualAccounts.update',
|
|
168
|
+
'client.bulkRequests.create',
|
|
169
|
+
'client.bulkRequests.list',
|
|
170
|
+
'client.bulkRequests.retrieve',
|
|
171
|
+
'client.bulkResults.list',
|
|
172
|
+
'client.bulkResults.retrieve',
|
|
173
|
+
'client.ledgerAccountSettlements.create',
|
|
174
|
+
'client.ledgerAccountSettlements.list',
|
|
175
|
+
'client.ledgerAccountSettlements.retrieve',
|
|
176
|
+
'client.ledgerAccountSettlements.update',
|
|
177
|
+
'client.ledgerAccountSettlements.accountEntries.delete',
|
|
178
|
+
'client.ledgerAccountSettlements.accountEntries.update',
|
|
179
|
+
'client.foreignExchangeQuotes.create',
|
|
180
|
+
'client.foreignExchangeQuotes.list',
|
|
181
|
+
'client.foreignExchangeQuotes.retrieve',
|
|
182
|
+
'client.connectionLegalEntities.create',
|
|
183
|
+
'client.connectionLegalEntities.list',
|
|
184
|
+
'client.connectionLegalEntities.retrieve',
|
|
185
|
+
'client.connectionLegalEntities.update',
|
|
186
|
+
'client.legalEntities.create',
|
|
187
|
+
'client.legalEntities.list',
|
|
188
|
+
'client.legalEntities.retrieve',
|
|
189
|
+
'client.legalEntities.update',
|
|
190
|
+
'client.legalEntityAssociations.create',
|
|
191
|
+
'client.paymentActions.create',
|
|
192
|
+
'client.paymentActions.list',
|
|
193
|
+
'client.paymentActions.retrieve',
|
|
194
|
+
'client.paymentActions.update',
|
|
195
|
+
], { threshold: 1, shouldSort: true });
|
|
196
|
+
function getMethodSuggestions(fullyQualifiedMethodName) {
|
|
197
|
+
return fuse
|
|
198
|
+
.search(fullyQualifiedMethodName)
|
|
199
|
+
.map(({ item }) => item)
|
|
200
|
+
.slice(0, 5);
|
|
201
|
+
}
|
|
202
|
+
const proxyToObj = new WeakMap();
|
|
203
|
+
const objToProxy = new WeakMap();
|
|
204
|
+
function makeSdkProxy(obj, { path, isBelievedBad = false }) {
|
|
205
|
+
let proxy = objToProxy.get(obj);
|
|
206
|
+
if (!proxy) {
|
|
207
|
+
proxy = new Proxy(obj, {
|
|
208
|
+
get(target, prop, receiver) {
|
|
209
|
+
const propPath = [...path, String(prop)];
|
|
210
|
+
const value = Reflect.get(target, prop, receiver);
|
|
211
|
+
if (isBelievedBad || (!(prop in target) && value === undefined)) {
|
|
212
|
+
// If we're accessing a path that doesn't exist, it will probably eventually error.
|
|
213
|
+
// Let's proxy it and mark it bad so that we can control the error message.
|
|
214
|
+
// We proxy an empty class so that an invocation or construction attempt is possible.
|
|
215
|
+
return makeSdkProxy(class {
|
|
216
|
+
}, { path: propPath, isBelievedBad: true });
|
|
217
|
+
}
|
|
218
|
+
if (value !== null && (typeof value === 'object' || typeof value === 'function')) {
|
|
219
|
+
return makeSdkProxy(value, { path: propPath, isBelievedBad });
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
},
|
|
223
|
+
apply(target, thisArg, args) {
|
|
224
|
+
if (isBelievedBad || typeof target !== 'function') {
|
|
225
|
+
const fullyQualifiedMethodName = path.join('.');
|
|
226
|
+
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
227
|
+
throw new Error(`${fullyQualifiedMethodName} is not a function. Did you mean: ${suggestions.join(', ')}`);
|
|
228
|
+
}
|
|
229
|
+
return Reflect.apply(target, proxyToObj.get(thisArg) ?? thisArg, args);
|
|
230
|
+
},
|
|
231
|
+
construct(target, args, newTarget) {
|
|
232
|
+
if (isBelievedBad || typeof target !== 'function') {
|
|
233
|
+
const fullyQualifiedMethodName = path.join('.');
|
|
234
|
+
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
235
|
+
throw new Error(`${fullyQualifiedMethodName} is not a constructor. Did you mean: ${suggestions.join(', ')}`);
|
|
236
|
+
}
|
|
237
|
+
return Reflect.construct(target, args, newTarget);
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
objToProxy.set(obj, proxy);
|
|
241
|
+
proxyToObj.set(proxy, obj);
|
|
242
|
+
}
|
|
243
|
+
return proxy;
|
|
244
|
+
}
|
|
245
|
+
function parseError(code, error) {
|
|
246
|
+
if (!(error instanceof Error))
|
|
247
|
+
return;
|
|
248
|
+
const message = error.name ? `${error.name}: ${error.message}` : error.message;
|
|
249
|
+
try {
|
|
250
|
+
// Deno uses V8; the first "<anonymous>:LINE:COLUMN" is the top of stack.
|
|
251
|
+
const lineNumber = error.stack?.match(/<anonymous>:([0-9]+):[0-9]+/)?.[1];
|
|
252
|
+
// -1 for the zero-based indexing
|
|
253
|
+
const line = lineNumber &&
|
|
254
|
+
code
|
|
255
|
+
.split('\n')
|
|
256
|
+
.at(parseInt(lineNumber, 10) - 1)
|
|
257
|
+
?.trim();
|
|
258
|
+
return line ? `${message}\n at line ${lineNumber}\n ${line}` : message;
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return message;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
9
264
|
const fetch = async (req) => {
|
|
10
265
|
const { opts, code } = (await req.json());
|
|
266
|
+
if (code == null) {
|
|
267
|
+
return Response.json({
|
|
268
|
+
message: 'The code param is missing. Provide one containing a top-level `run` function. Write code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```',
|
|
269
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
270
|
+
}
|
|
271
|
+
const runFunctionNode = getRunFunctionNode(code);
|
|
272
|
+
if (!runFunctionNode) {
|
|
273
|
+
return Response.json({
|
|
274
|
+
message: 'The code is missing a top-level `run` function. Write code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```',
|
|
275
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
276
|
+
}
|
|
11
277
|
const client = new modern_treasury_1.ModernTreasury({
|
|
12
278
|
...opts,
|
|
13
279
|
});
|
|
@@ -23,11 +289,8 @@ const fetch = async (req) => {
|
|
|
23
289
|
};
|
|
24
290
|
try {
|
|
25
291
|
let run_ = async (client) => { };
|
|
26
|
-
eval(
|
|
27
|
-
|
|
28
|
-
run_ = run;
|
|
29
|
-
`);
|
|
30
|
-
const result = await run_(client);
|
|
292
|
+
eval(`${code}\nrun_ = run;`);
|
|
293
|
+
const result = await run_(makeSdkProxy(client, { path: ['client'] }));
|
|
31
294
|
return Response.json({
|
|
32
295
|
result,
|
|
33
296
|
logLines,
|
|
@@ -35,9 +298,8 @@ const fetch = async (req) => {
|
|
|
35
298
|
});
|
|
36
299
|
}
|
|
37
300
|
catch (e) {
|
|
38
|
-
const message = e instanceof Error ? e.message : undefined;
|
|
39
301
|
return Response.json({
|
|
40
|
-
message,
|
|
302
|
+
message: parseError(code, e),
|
|
41
303
|
}, { status: 400, statusText: 'Code execution error' });
|
|
42
304
|
}
|
|
43
305
|
};
|
package/code-tool-worker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.js","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;AAEtF,0DAA6B;AAE7B,qDAAiD;AAEjD,MAAM,KAAK,GAAG,KAAK,EAAE,GAAY,EAAqB,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,gCAAc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AC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,IAAI,CAAC;YACnB,MAAM;YACN,QAAQ;YACR,QAAQ;SACe,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC,IAAI,CAClB;YACE,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;SACP,EACvB,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,sBAAsB,EAAE,CACpD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,EAAE,KAAK,EAAE,CAAC"}
|
package/code-tool-worker.mjs
CHANGED
|
@@ -1,8 +1,274 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import util from 'node:util';
|
|
3
|
+
import Fuse from 'fuse.js';
|
|
4
|
+
import ts from 'typescript';
|
|
3
5
|
import { ModernTreasury } from 'modern-treasury';
|
|
6
|
+
function getRunFunctionNode(code) {
|
|
7
|
+
const sourceFile = ts.createSourceFile('code.ts', code, ts.ScriptTarget.Latest, true);
|
|
8
|
+
for (const statement of sourceFile.statements) {
|
|
9
|
+
// Check for top-level function declarations
|
|
10
|
+
if (ts.isFunctionDeclaration(statement)) {
|
|
11
|
+
if (statement.name?.text === 'run') {
|
|
12
|
+
return statement;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
// Check for variable declarations: const run = () => {} or const run = function() {}
|
|
16
|
+
if (ts.isVariableStatement(statement)) {
|
|
17
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
18
|
+
if (ts.isIdentifier(declaration.name) && declaration.name.text === 'run') {
|
|
19
|
+
// Check if it's initialized with a function
|
|
20
|
+
if (declaration.initializer &&
|
|
21
|
+
(ts.isFunctionExpression(declaration.initializer) || ts.isArrowFunction(declaration.initializer))) {
|
|
22
|
+
return declaration.initializer;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const fuse = new Fuse([
|
|
31
|
+
'client.ping',
|
|
32
|
+
'client.connections.list',
|
|
33
|
+
'client.counterparties.collectAccount',
|
|
34
|
+
'client.counterparties.create',
|
|
35
|
+
'client.counterparties.delete',
|
|
36
|
+
'client.counterparties.list',
|
|
37
|
+
'client.counterparties.retrieve',
|
|
38
|
+
'client.counterparties.update',
|
|
39
|
+
'client.events.list',
|
|
40
|
+
'client.events.retrieve',
|
|
41
|
+
'client.expectedPayments.create',
|
|
42
|
+
'client.expectedPayments.delete',
|
|
43
|
+
'client.expectedPayments.list',
|
|
44
|
+
'client.expectedPayments.retrieve',
|
|
45
|
+
'client.expectedPayments.update',
|
|
46
|
+
'client.externalAccounts.completeVerification',
|
|
47
|
+
'client.externalAccounts.create',
|
|
48
|
+
'client.externalAccounts.delete',
|
|
49
|
+
'client.externalAccounts.list',
|
|
50
|
+
'client.externalAccounts.retrieve',
|
|
51
|
+
'client.externalAccounts.update',
|
|
52
|
+
'client.externalAccounts.verify',
|
|
53
|
+
'client.incomingPaymentDetails.createAsync',
|
|
54
|
+
'client.incomingPaymentDetails.list',
|
|
55
|
+
'client.incomingPaymentDetails.retrieve',
|
|
56
|
+
'client.incomingPaymentDetails.update',
|
|
57
|
+
'client.invoices.addPaymentOrder',
|
|
58
|
+
'client.invoices.create',
|
|
59
|
+
'client.invoices.list',
|
|
60
|
+
'client.invoices.retrieve',
|
|
61
|
+
'client.invoices.update',
|
|
62
|
+
'client.invoices.lineItems.create',
|
|
63
|
+
'client.invoices.lineItems.delete',
|
|
64
|
+
'client.invoices.lineItems.list',
|
|
65
|
+
'client.invoices.lineItems.retrieve',
|
|
66
|
+
'client.invoices.lineItems.update',
|
|
67
|
+
'client.documents.create',
|
|
68
|
+
'client.documents.list',
|
|
69
|
+
'client.documents.retrieve',
|
|
70
|
+
'client.accountCollectionFlows.create',
|
|
71
|
+
'client.accountCollectionFlows.list',
|
|
72
|
+
'client.accountCollectionFlows.retrieve',
|
|
73
|
+
'client.accountCollectionFlows.update',
|
|
74
|
+
'client.accountDetails.create',
|
|
75
|
+
'client.accountDetails.delete',
|
|
76
|
+
'client.accountDetails.list',
|
|
77
|
+
'client.accountDetails.retrieve',
|
|
78
|
+
'client.routingDetails.create',
|
|
79
|
+
'client.routingDetails.delete',
|
|
80
|
+
'client.routingDetails.list',
|
|
81
|
+
'client.routingDetails.retrieve',
|
|
82
|
+
'client.internalAccounts.create',
|
|
83
|
+
'client.internalAccounts.list',
|
|
84
|
+
'client.internalAccounts.retrieve',
|
|
85
|
+
'client.internalAccounts.update',
|
|
86
|
+
'client.internalAccounts.updateAccountCapability',
|
|
87
|
+
'client.internalAccounts.balanceReports.create',
|
|
88
|
+
'client.internalAccounts.balanceReports.delete',
|
|
89
|
+
'client.internalAccounts.balanceReports.list',
|
|
90
|
+
'client.internalAccounts.balanceReports.retrieve',
|
|
91
|
+
'client.ledgers.create',
|
|
92
|
+
'client.ledgers.delete',
|
|
93
|
+
'client.ledgers.list',
|
|
94
|
+
'client.ledgers.retrieve',
|
|
95
|
+
'client.ledgers.update',
|
|
96
|
+
'client.ledgerAccountCategories.addLedgerAccount',
|
|
97
|
+
'client.ledgerAccountCategories.addNestedCategory',
|
|
98
|
+
'client.ledgerAccountCategories.create',
|
|
99
|
+
'client.ledgerAccountCategories.delete',
|
|
100
|
+
'client.ledgerAccountCategories.list',
|
|
101
|
+
'client.ledgerAccountCategories.removeLedgerAccount',
|
|
102
|
+
'client.ledgerAccountCategories.removeNestedCategory',
|
|
103
|
+
'client.ledgerAccountCategories.retrieve',
|
|
104
|
+
'client.ledgerAccountCategories.update',
|
|
105
|
+
'client.ledgerAccounts.create',
|
|
106
|
+
'client.ledgerAccounts.delete',
|
|
107
|
+
'client.ledgerAccounts.list',
|
|
108
|
+
'client.ledgerAccounts.retrieve',
|
|
109
|
+
'client.ledgerAccounts.update',
|
|
110
|
+
'client.ledgerAccountBalanceMonitors.create',
|
|
111
|
+
'client.ledgerAccountBalanceMonitors.delete',
|
|
112
|
+
'client.ledgerAccountBalanceMonitors.list',
|
|
113
|
+
'client.ledgerAccountBalanceMonitors.retrieve',
|
|
114
|
+
'client.ledgerAccountBalanceMonitors.update',
|
|
115
|
+
'client.ledgerAccountStatements.create',
|
|
116
|
+
'client.ledgerAccountStatements.retrieve',
|
|
117
|
+
'client.ledgerEntries.list',
|
|
118
|
+
'client.ledgerEntries.retrieve',
|
|
119
|
+
'client.ledgerEntries.update',
|
|
120
|
+
'client.ledgerTransactions.create',
|
|
121
|
+
'client.ledgerTransactions.createPartialPost',
|
|
122
|
+
'client.ledgerTransactions.createReversal',
|
|
123
|
+
'client.ledgerTransactions.list',
|
|
124
|
+
'client.ledgerTransactions.retrieve',
|
|
125
|
+
'client.ledgerTransactions.update',
|
|
126
|
+
'client.ledgerTransactions.versions.list',
|
|
127
|
+
'client.lineItems.list',
|
|
128
|
+
'client.lineItems.retrieve',
|
|
129
|
+
'client.lineItems.update',
|
|
130
|
+
'client.paymentFlows.create',
|
|
131
|
+
'client.paymentFlows.list',
|
|
132
|
+
'client.paymentFlows.retrieve',
|
|
133
|
+
'client.paymentFlows.update',
|
|
134
|
+
'client.paymentOrders.create',
|
|
135
|
+
'client.paymentOrders.createAsync',
|
|
136
|
+
'client.paymentOrders.list',
|
|
137
|
+
'client.paymentOrders.retrieve',
|
|
138
|
+
'client.paymentOrders.update',
|
|
139
|
+
'client.paymentOrders.reversals.create',
|
|
140
|
+
'client.paymentOrders.reversals.list',
|
|
141
|
+
'client.paymentOrders.reversals.retrieve',
|
|
142
|
+
'client.paymentReferences.list',
|
|
143
|
+
'client.paymentReferences.retireve',
|
|
144
|
+
'client.paymentReferences.retrieve',
|
|
145
|
+
'client.returns.create',
|
|
146
|
+
'client.returns.list',
|
|
147
|
+
'client.returns.retrieve',
|
|
148
|
+
'client.transactions.create',
|
|
149
|
+
'client.transactions.delete',
|
|
150
|
+
'client.transactions.list',
|
|
151
|
+
'client.transactions.retrieve',
|
|
152
|
+
'client.transactions.update',
|
|
153
|
+
'client.transactions.lineItems.create',
|
|
154
|
+
'client.transactions.lineItems.delete',
|
|
155
|
+
'client.transactions.lineItems.list',
|
|
156
|
+
'client.transactions.lineItems.retrieve',
|
|
157
|
+
'client.validations.validateRoutingNumber',
|
|
158
|
+
'client.virtualAccounts.create',
|
|
159
|
+
'client.virtualAccounts.delete',
|
|
160
|
+
'client.virtualAccounts.list',
|
|
161
|
+
'client.virtualAccounts.retrieve',
|
|
162
|
+
'client.virtualAccounts.update',
|
|
163
|
+
'client.bulkRequests.create',
|
|
164
|
+
'client.bulkRequests.list',
|
|
165
|
+
'client.bulkRequests.retrieve',
|
|
166
|
+
'client.bulkResults.list',
|
|
167
|
+
'client.bulkResults.retrieve',
|
|
168
|
+
'client.ledgerAccountSettlements.create',
|
|
169
|
+
'client.ledgerAccountSettlements.list',
|
|
170
|
+
'client.ledgerAccountSettlements.retrieve',
|
|
171
|
+
'client.ledgerAccountSettlements.update',
|
|
172
|
+
'client.ledgerAccountSettlements.accountEntries.delete',
|
|
173
|
+
'client.ledgerAccountSettlements.accountEntries.update',
|
|
174
|
+
'client.foreignExchangeQuotes.create',
|
|
175
|
+
'client.foreignExchangeQuotes.list',
|
|
176
|
+
'client.foreignExchangeQuotes.retrieve',
|
|
177
|
+
'client.connectionLegalEntities.create',
|
|
178
|
+
'client.connectionLegalEntities.list',
|
|
179
|
+
'client.connectionLegalEntities.retrieve',
|
|
180
|
+
'client.connectionLegalEntities.update',
|
|
181
|
+
'client.legalEntities.create',
|
|
182
|
+
'client.legalEntities.list',
|
|
183
|
+
'client.legalEntities.retrieve',
|
|
184
|
+
'client.legalEntities.update',
|
|
185
|
+
'client.legalEntityAssociations.create',
|
|
186
|
+
'client.paymentActions.create',
|
|
187
|
+
'client.paymentActions.list',
|
|
188
|
+
'client.paymentActions.retrieve',
|
|
189
|
+
'client.paymentActions.update',
|
|
190
|
+
], { threshold: 1, shouldSort: true });
|
|
191
|
+
function getMethodSuggestions(fullyQualifiedMethodName) {
|
|
192
|
+
return fuse
|
|
193
|
+
.search(fullyQualifiedMethodName)
|
|
194
|
+
.map(({ item }) => item)
|
|
195
|
+
.slice(0, 5);
|
|
196
|
+
}
|
|
197
|
+
const proxyToObj = new WeakMap();
|
|
198
|
+
const objToProxy = new WeakMap();
|
|
199
|
+
function makeSdkProxy(obj, { path, isBelievedBad = false }) {
|
|
200
|
+
let proxy = objToProxy.get(obj);
|
|
201
|
+
if (!proxy) {
|
|
202
|
+
proxy = new Proxy(obj, {
|
|
203
|
+
get(target, prop, receiver) {
|
|
204
|
+
const propPath = [...path, String(prop)];
|
|
205
|
+
const value = Reflect.get(target, prop, receiver);
|
|
206
|
+
if (isBelievedBad || (!(prop in target) && value === undefined)) {
|
|
207
|
+
// If we're accessing a path that doesn't exist, it will probably eventually error.
|
|
208
|
+
// Let's proxy it and mark it bad so that we can control the error message.
|
|
209
|
+
// We proxy an empty class so that an invocation or construction attempt is possible.
|
|
210
|
+
return makeSdkProxy(class {
|
|
211
|
+
}, { path: propPath, isBelievedBad: true });
|
|
212
|
+
}
|
|
213
|
+
if (value !== null && (typeof value === 'object' || typeof value === 'function')) {
|
|
214
|
+
return makeSdkProxy(value, { path: propPath, isBelievedBad });
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
},
|
|
218
|
+
apply(target, thisArg, args) {
|
|
219
|
+
if (isBelievedBad || typeof target !== 'function') {
|
|
220
|
+
const fullyQualifiedMethodName = path.join('.');
|
|
221
|
+
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
222
|
+
throw new Error(`${fullyQualifiedMethodName} is not a function. Did you mean: ${suggestions.join(', ')}`);
|
|
223
|
+
}
|
|
224
|
+
return Reflect.apply(target, proxyToObj.get(thisArg) ?? thisArg, args);
|
|
225
|
+
},
|
|
226
|
+
construct(target, args, newTarget) {
|
|
227
|
+
if (isBelievedBad || typeof target !== 'function') {
|
|
228
|
+
const fullyQualifiedMethodName = path.join('.');
|
|
229
|
+
const suggestions = getMethodSuggestions(fullyQualifiedMethodName);
|
|
230
|
+
throw new Error(`${fullyQualifiedMethodName} is not a constructor. Did you mean: ${suggestions.join(', ')}`);
|
|
231
|
+
}
|
|
232
|
+
return Reflect.construct(target, args, newTarget);
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
objToProxy.set(obj, proxy);
|
|
236
|
+
proxyToObj.set(proxy, obj);
|
|
237
|
+
}
|
|
238
|
+
return proxy;
|
|
239
|
+
}
|
|
240
|
+
function parseError(code, error) {
|
|
241
|
+
if (!(error instanceof Error))
|
|
242
|
+
return;
|
|
243
|
+
const message = error.name ? `${error.name}: ${error.message}` : error.message;
|
|
244
|
+
try {
|
|
245
|
+
// Deno uses V8; the first "<anonymous>:LINE:COLUMN" is the top of stack.
|
|
246
|
+
const lineNumber = error.stack?.match(/<anonymous>:([0-9]+):[0-9]+/)?.[1];
|
|
247
|
+
// -1 for the zero-based indexing
|
|
248
|
+
const line = lineNumber &&
|
|
249
|
+
code
|
|
250
|
+
.split('\n')
|
|
251
|
+
.at(parseInt(lineNumber, 10) - 1)
|
|
252
|
+
?.trim();
|
|
253
|
+
return line ? `${message}\n at line ${lineNumber}\n ${line}` : message;
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
return message;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
4
259
|
const fetch = async (req) => {
|
|
5
260
|
const { opts, code } = (await req.json());
|
|
261
|
+
if (code == null) {
|
|
262
|
+
return Response.json({
|
|
263
|
+
message: 'The code param is missing. Provide one containing a top-level `run` function. Write code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```',
|
|
264
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
265
|
+
}
|
|
266
|
+
const runFunctionNode = getRunFunctionNode(code);
|
|
267
|
+
if (!runFunctionNode) {
|
|
268
|
+
return Response.json({
|
|
269
|
+
message: 'The code is missing a top-level `run` function. Write code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```',
|
|
270
|
+
}, { status: 400, statusText: 'Code execution error' });
|
|
271
|
+
}
|
|
6
272
|
const client = new ModernTreasury({
|
|
7
273
|
...opts,
|
|
8
274
|
});
|
|
@@ -18,11 +284,8 @@ const fetch = async (req) => {
|
|
|
18
284
|
};
|
|
19
285
|
try {
|
|
20
286
|
let run_ = async (client) => { };
|
|
21
|
-
eval(
|
|
22
|
-
|
|
23
|
-
run_ = run;
|
|
24
|
-
`);
|
|
25
|
-
const result = await run_(client);
|
|
287
|
+
eval(`${code}\nrun_ = run;`);
|
|
288
|
+
const result = await run_(makeSdkProxy(client, { path: ['client'] }));
|
|
26
289
|
return Response.json({
|
|
27
290
|
result,
|
|
28
291
|
logLines,
|
|
@@ -30,9 +293,8 @@ const fetch = async (req) => {
|
|
|
30
293
|
});
|
|
31
294
|
}
|
|
32
295
|
catch (e) {
|
|
33
|
-
const message = e instanceof Error ? e.message : undefined;
|
|
34
296
|
return Response.json({
|
|
35
|
-
message,
|
|
297
|
+
message: parseError(code, e),
|
|
36
298
|
}, { status: 400, statusText: 'Code execution error' });
|
|
37
299
|
}
|
|
38
300
|
};
|
package/code-tool-worker.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-worker.mjs","sourceRoot":"","sources":["src/code-tool-worker.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,IAAI,MAAM,WAAW;OAErB,EAAE,cAAc,EAAE,MAAM,iBAAiB;AAEhD,MAAM,KAAK,GAAG,KAAK,EAAE,GAAY,EAAqB,EAAE;IACtD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;IACzD,MA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E,GAAE,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,IAAI,CAAC;YACnB,MAAM;YACN,QAAQ;YACR,QAAQ;SACe,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC,IAAI,CAClB;YACE,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;SACP,EACvB,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,sBAAsB,EAAE,CACpD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,EAAE,KAAK,EAAE,CAAC"}
|
package/code-tool.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { Endpoint } from "./tools/types.mjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* A tool that runs code against a copy of the SDK.
|
|
4
4
|
*
|
|
5
|
-
* Instead of exposing every endpoint as
|
|
5
|
+
* Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
|
|
6
6
|
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
7
7
|
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
8
8
|
*
|
package/code-tool.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAgB,QAAQ,EAA4B;AAM3D;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAgIlD"}
|