@truto/langchain-toolset 0.1.1 → 0.1.2

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 CHANGED
@@ -2024,51 +2024,59 @@ 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
- const resourceName = availableTool.resource;
2032
- const methodToCall = availableTool.method;
2033
- const query = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.query_schema) || {};
2034
- const body = $4de6ba44f0531b39$export$34efffa2116fc158(config, availableTool.body_schema) || {};
2035
- switch(methodToCall){
2036
- case "list":
2037
- return JSON.stringify(await trutoApi.proxyApi.list({
2038
- integrated_account_id: integratedAccountId,
2039
- resource: resourceName,
2040
- ...query
2041
- }).next(), null, 2);
2042
- case "get":
2043
- return JSON.stringify(await trutoApi.proxyApi.get(config?.id, {
2044
- integrated_account_id: integratedAccountId,
2045
- resource: resourceName,
2046
- ...query
2047
- }), null, 2);
2048
- case "create":
2049
- return JSON.stringify(await trutoApi.proxyApi.create(body, {
2050
- integrated_account_id: integratedAccountId,
2051
- resource: resourceName,
2052
- ...query
2053
- }), null, 2);
2054
- case "update":
2055
- return JSON.stringify(await trutoApi.proxyApi.update(config?.id, body, {
2056
- integrated_account_id: integratedAccountId,
2057
- resource: resourceName,
2058
- ...query
2059
- }), null, 2);
2060
- case "delete":
2061
- return JSON.stringify(await trutoApi.proxyApi.delete(config?.id, {
2062
- integrated_account_id: integratedAccountId,
2063
- resource: resourceName,
2064
- ...query
2065
- }), null, 2);
2066
- default:
2067
- return JSON.stringify(await trutoApi.proxyApi.customMethod(methodToCall, body, {
2068
- integrated_account_id: integratedAccountId,
2069
- resource: resourceName,
2070
- ...query
2071
- }), null, 2);
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
+ return JSON.stringify({
2076
+ error: true,
2077
+ message: error instanceof Error ? error.message : "Unknown error occurred",
2078
+ details: error instanceof Error ? error.stack : String(error)
2079
+ }, null, 2);
2072
2080
  }
2073
2081
  }, {
2074
2082
  name: toolName,