@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/module.js CHANGED
@@ -2012,51 +2012,63 @@ async function $783922f5df7b52a4$export$ffc9f93b394316dd(integratedAccountId, co
2012
2012
  baseUrl: config.truto.baseUrl,
2013
2013
  token: config.truto.token
2014
2014
  });
2015
- const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods);
2015
+ const availableTools = await trutoApi.integratedAccount.tools(integratedAccountId, config?.methods, config?.tags);
2016
2016
  (0, $8b5aa36aaeb84d98$export$2e2bcd8739ae039)(availableTools, (availableTool)=>{
2017
2017
  const toolName = availableTool.name;
2018
2018
  tools[toolName] = (0, $7dQ0M$tool)(async (config)=>{
2019
- const resourceName = availableTool.resource;
2020
- const methodToCall = availableTool.method;
2021
- const query = $783922f5df7b52a4$export$34efffa2116fc158(config, availableTool.query_schema) || {};
2022
- const body = $783922f5df7b52a4$export$34efffa2116fc158(config, availableTool.body_schema) || {};
2023
- switch(methodToCall){
2024
- case "list":
2025
- return JSON.stringify(await trutoApi.proxyApi.list({
2026
- integrated_account_id: integratedAccountId,
2027
- resource: resourceName,
2028
- ...query
2029
- }).next(), null, 2);
2030
- case "get":
2031
- return JSON.stringify(await trutoApi.proxyApi.get(config?.id, {
2032
- integrated_account_id: integratedAccountId,
2033
- resource: resourceName,
2034
- ...query
2035
- }), null, 2);
2036
- case "create":
2037
- return JSON.stringify(await trutoApi.proxyApi.create(body, {
2038
- integrated_account_id: integratedAccountId,
2039
- resource: resourceName,
2040
- ...query
2041
- }), null, 2);
2042
- case "update":
2043
- return JSON.stringify(await trutoApi.proxyApi.update(config?.id, body, {
2044
- integrated_account_id: integratedAccountId,
2045
- resource: resourceName,
2046
- ...query
2047
- }), null, 2);
2048
- case "delete":
2049
- return JSON.stringify(await trutoApi.proxyApi.delete(config?.id, {
2050
- integrated_account_id: integratedAccountId,
2051
- resource: resourceName,
2052
- ...query
2053
- }), null, 2);
2054
- default:
2055
- return JSON.stringify(await trutoApi.proxyApi.customMethod(methodToCall, body, {
2056
- integrated_account_id: integratedAccountId,
2057
- resource: resourceName,
2058
- ...query
2059
- }), null, 2);
2019
+ try {
2020
+ const resourceName = availableTool.resource;
2021
+ const methodToCall = availableTool.method;
2022
+ const query = $783922f5df7b52a4$export$34efffa2116fc158(config, availableTool.query_schema) || {};
2023
+ const body = $783922f5df7b52a4$export$34efffa2116fc158(config, availableTool.body_schema) || {};
2024
+ switch(methodToCall){
2025
+ case "list":
2026
+ return JSON.stringify(await trutoApi.proxyApi.list({
2027
+ integrated_account_id: integratedAccountId,
2028
+ resource: resourceName,
2029
+ ...query
2030
+ }).next(), null, 2);
2031
+ case "get":
2032
+ return JSON.stringify(await trutoApi.proxyApi.get(config?.id, {
2033
+ integrated_account_id: integratedAccountId,
2034
+ resource: resourceName,
2035
+ ...query
2036
+ }), null, 2);
2037
+ case "create":
2038
+ return JSON.stringify(await trutoApi.proxyApi.create(body, {
2039
+ integrated_account_id: integratedAccountId,
2040
+ resource: resourceName,
2041
+ ...query
2042
+ }), null, 2);
2043
+ case "update":
2044
+ return JSON.stringify(await trutoApi.proxyApi.update(config?.id, body, {
2045
+ integrated_account_id: integratedAccountId,
2046
+ resource: resourceName,
2047
+ ...query
2048
+ }), null, 2);
2049
+ case "delete":
2050
+ return JSON.stringify(await trutoApi.proxyApi.delete(config?.id, {
2051
+ integrated_account_id: integratedAccountId,
2052
+ resource: resourceName,
2053
+ ...query
2054
+ }), null, 2);
2055
+ default:
2056
+ return JSON.stringify(await trutoApi.proxyApi.customMethod(methodToCall, body, {
2057
+ integrated_account_id: integratedAccountId,
2058
+ resource: resourceName,
2059
+ ...query
2060
+ }), null, 2);
2061
+ }
2062
+ } catch (error) {
2063
+ try {
2064
+ return JSON.stringify(error, null, 2);
2065
+ } catch (stringifyError) {
2066
+ try {
2067
+ return String(error);
2068
+ } catch (finalError) {
2069
+ return "Unknown error occurred";
2070
+ }
2071
+ }
2060
2072
  }
2061
2073
  }, {
2062
2074
  name: toolName,