Skip to content

Commit

Permalink
feat: add custom auth data in JS SDK (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit authored Oct 22, 2024
1 parent b78e771 commit c574679
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
1 change: 0 additions & 1 deletion js/src/env/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class WorkspaceFactory {
await workspace.setup();
break;
case ExecEnv.HOST:
logger.warn("Local tools are not supported in host environment - see docs https://docs.composio.dev/swekit-js/workspace-env");
break;
case ExecEnv.E2B:
workspace = new E2BWorkspace(this.workspaceConfig);
Expand Down
2 changes: 1 addition & 1 deletion js/src/sdk/models/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Entity {
actionName: actionName
});
if (!action) {
throw new Error("Could not find action: " + actionName);
throw new Error(`Could not find action: ${actionName}`);
}
const app = await this.apps.get({
appKey: action.appKey!
Expand Down
39 changes: 39 additions & 0 deletions js/src/sdk/models/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,40 @@ export type GetListActionsData = {
filterImportantActions?: boolean;
}

export type Parameter = {
/**
* The name of the parameter.
*/
name: string;

/**
* The location of the parameter (e.g., query, header).
*/
in: string;

/**
* The value of the parameter.
*/
value: string | number;
};

export type CustomAuthData = {
/**
* The base URL for the custom authentication.
*/
base_url?: string;

/**
* An array of parameters for the custom authentication.
*/
parameters: Parameter[];

/**
* An optional object containing the body for the custom authentication.
*/
body?: Record<string, unknown>;
}

export type ExecuteActionData = {
/**
* The name of the action to execute.
Expand All @@ -78,6 +112,11 @@ export type ExecuteActionData = {
* appropriate input parameters.
*/
text?: string;

/**
* The custom authentication configuration for executing the action.
*/
authConfig?: CustomAuthData;
};
};

Expand Down

0 comments on commit c574679

Please sign in to comment.