@truto/langchain-toolset 0.1.1 → 0.1.3
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/main.cjs +54 -42
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +54 -42
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/main.cjs
CHANGED
|
@@ -2024,51 +2024,63 @@ async function $4de6ba44f0531b39$export$ffc9f93b394316dd(integratedAccountId, co
|
|
|
2024
2024
|
baseUrl: config.truto.baseUrl,
|
|
2025
2025
|
token: config.truto.token
|
|
2026
2026
|
});
|
|
2027
|
-
const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods);
|
|
2027
|
+
const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods, config?.tags);
|
|
2028
2028
|
(0, $c6f51911d1519af6$export$2e2bcd8739ae039)(availableTools, (availableTool)=>{
|
|
2029
2029
|
const toolName = availableTool.name;
|
|
2030
2030
|
tools[toolName] = (0, $krXZW$langchaincoretools.tool)(async (config)=>{
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2031
|
+
try {
|
|
2032
|
+
const resourceName = availableTool.resource;
|
|
2033
|
+
const methodToCall = availableTool.method;
|
|
2034
|
+
const query = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.query_schema) || {};
|
|
2035
|
+
const body = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.body_schema) || {};
|
|
2036
|
+
switch(methodToCall){
|
|
2037
|
+
case "list":
|
|
2038
|
+
return JSON.stringify(await trutoApi.proxyApi.list({
|
|
2039
|
+
integrated_account_id: integratedAccountId,
|
|
2040
|
+
resource: resourceName,
|
|
2041
|
+
...query
|
|
2042
|
+
}).next(), null, 2);
|
|
2043
|
+
case "get":
|
|
2044
|
+
return JSON.stringify(await trutoApi.proxyApi.get(config?.id, {
|
|
2045
|
+
integrated_account_id: integratedAccountId,
|
|
2046
|
+
resource: resourceName,
|
|
2047
|
+
...query
|
|
2048
|
+
}), null, 2);
|
|
2049
|
+
case "create":
|
|
2050
|
+
return JSON.stringify(await trutoApi.proxyApi.create(body, {
|
|
2051
|
+
integrated_account_id: integratedAccountId,
|
|
2052
|
+
resource: resourceName,
|
|
2053
|
+
...query
|
|
2054
|
+
}), null, 2);
|
|
2055
|
+
case "update":
|
|
2056
|
+
return JSON.stringify(await trutoApi.proxyApi.update(config?.id, body, {
|
|
2057
|
+
integrated_account_id: integratedAccountId,
|
|
2058
|
+
resource: resourceName,
|
|
2059
|
+
...query
|
|
2060
|
+
}), null, 2);
|
|
2061
|
+
case "delete":
|
|
2062
|
+
return JSON.stringify(await trutoApi.proxyApi.delete(config?.id, {
|
|
2063
|
+
integrated_account_id: integratedAccountId,
|
|
2064
|
+
resource: resourceName,
|
|
2065
|
+
...query
|
|
2066
|
+
}), null, 2);
|
|
2067
|
+
default:
|
|
2068
|
+
return JSON.stringify(await trutoApi.proxyApi.customMethod(methodToCall, body, {
|
|
2069
|
+
integrated_account_id: integratedAccountId,
|
|
2070
|
+
resource: resourceName,
|
|
2071
|
+
...query
|
|
2072
|
+
}), null, 2);
|
|
2073
|
+
}
|
|
2074
|
+
} catch (error) {
|
|
2075
|
+
try {
|
|
2076
|
+
return JSON.stringify(error, null, 2);
|
|
2077
|
+
} catch (stringifyError) {
|
|
2078
|
+
try {
|
|
2079
|
+
return String(error);
|
|
2080
|
+
} catch (finalError) {
|
|
2081
|
+
return "Unknown error occurred";
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2072
2084
|
}
|
|
2073
2085
|
}, {
|
|
2074
2086
|
name: toolName,
|