Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update backend types #1082

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

himanshu-dixit
Copy link
Collaborator

@himanshu-dixit himanshu-dixit commented Dec 23, 2024

[!IMPORTANT]

Refactor backend types and update API methods to align with new specifications, including renaming functions and updating models.

  • Behavior​:- Rename getConnections to listConnections in connections.ts.
    • Rename executeActionProxyV2 to executeWithHttpClient in actionRegistry.ts.

    • Rename AuthService to ClientService in client.ts.

  • Models​:- Add error types like HttpError, BadRequestError in schemas.gen.ts.
    • Update DTOs with new fields and descriptions in schemas.gen.ts.

    • Update types to reflect new API changes in types.gen.ts.

  • Misc​:- Update service methods in services.gen.ts to align with new API endpoints.
    • Refactor Entity.ts, actions.ts, and connectedAccounts.ts to use updated API methods.

This description was created by

<https://www.ellipsis.dev?ref=ComposioHQ%2Fcomposio&utm_source=github&utm_medium=referral%7Chttps://img.shields.io/badge/Ellipsis-blue?color=175173%7CEllipsis><sup> for 52712ed. It will automatically update as commits are pushed.


Important

Refactor backend types and update API methods to align with new specifications, including renaming functions and updating models.

  • Behavior:
    • Rename getConnections to listConnections in connections.ts.
    • Rename executeActionProxyV2 to executeWithHttpClient in actionRegistry.ts.
    • Rename AuthService to ClientService in client.ts.
  • Models:
    • Add error types like HttpError, BadRequestError in schemas.gen.ts.
    • Update DTOs with new fields and descriptions in schemas.gen.ts.
    • Update types to reflect new API changes in types.gen.ts.
  • Misc:
    • Update service methods in services.gen.ts to align with new API endpoints.
    • Refactor Entity.ts, actions.ts, and connectedAccounts.ts to use updated API methods.

This description was created by Ellipsis for b45089d. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2024 5:00am

Copy link

github-actions bot commented Dec 23, 2024

This comment was generated by github-actions[bot]!

JS SDK Coverage Report

📊 Coverage report for JS SDK can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-12489581638/coverage/index.html

📁 Test report folder can be found at the following URL:
https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-12489581638/html-report/report.html

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 09c5f08 in 1 minute and 48 seconds

More details
  • Looked at 6480 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:100
  • Draft comment:
    Typo: The property successfull is misspelled. It should be successful. This typo is also present in the toolResponse object.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. js/src/sdk/client/client.ts:7
  • Draft comment:
    The change from clientAuth: SDKClient.AuthService to clientAuth: SDKClient.ClientService might break existing code that relies on AuthService. Ensure that all references to AuthService are updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. js/src/cli/connections.ts:26
  • Draft comment:
    The method getConnections has been replaced with listConnections. Ensure that this change is consistent across the codebase and that all references to getConnections are updated.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_GXGF6gSCr3abQWJf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

* Whether the action execution was successfully executed or not. If this is false, error field will be populated with the error message.
* @deprecated
*/
successfull: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The successfull field (with double 'l') is marked as deprecated but still required in the type definition. This could cause confusion. Consider:

  1. Making it optional if it's deprecated
  2. Adding a migration guide for users to switch to successful
  3. Adding a timeline for when successfull will be removed

@@ -1213,7 +2019,7 @@ export type AdvancedUseCaseSearchQueryDTO = {
* Use case is deprecated. Please provide this in the body instead to avoid max-uri-length error.
* @deprecated
*/
useCase: string;
useCase?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useCase parameter is marked as deprecated in the comment but the type definition doesn't reflect this. Consider:

  1. Adding @deprecated JSDoc tag
  2. Making it optional in the type definition
  3. Adding a note about what to use instead

/**
* The yaml of the app
*/
yaml?: unknown;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The yaml field has been removed from SingleAppInfoResDTO but there's no deprecation notice or migration guide. If this is a breaking change, consider:

  1. Adding a deprecation cycle first
  2. Providing migration instructions
  3. Documenting alternative ways to access this information

/**
* The type of error
*/
export type type = "BadRequestError";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type enum is defined multiple times with different values (type, type2, type3, type4, type5). This could lead to confusion and type safety issues. Consider:

  1. Using more descriptive names for these types (e.g., ErrorType, RequestBodyType, etc.)
  2. Consolidating similar enums where possible
  3. Adding documentation to clarify the purpose of each type

@shreysingla11
Copy link
Collaborator

Code Review Summary

Positive Aspects

  • Comprehensive type definitions with detailed JSDoc comments
  • Better error handling with specific error types
  • Improved type safety with stricter enums and unions
  • Good deprecation notices for most deprecated fields

Areas for Improvement

  1. Deprecation Handling

    • Some deprecated fields still marked as required
    • Inconsistent deprecation notices between comments and types
    • Missing migration guides for breaking changes
  2. Type Safety

    • Multiple similarly named type enums could cause confusion
    • Some type definitions could be more specific
    • Some optional fields could benefit from stricter types
  3. Documentation

    • Some breaking changes lack proper migration guides
    • Some deprecated fields need clearer alternatives
    • Some type descriptions could be more detailed

Recommendations

  1. Add proper deprecation cycles for breaking changes
  2. Use more descriptive names for type enums
  3. Add migration guides for deprecated features
  4. Make deprecated fields optional where possible
  5. Add more examples in documentation

Overall, this is a solid improvement to the type system, but needs some refinement in deprecation handling and documentation.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on f9b8813 in 1 minute and 42 seconds

More details
  • Looked at 527 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. js/src/frameworks/vercel.ts:37
  • Draft comment:
    The type casting to RawActionData is unnecessary here since actionSchema is already of type RawActionData. Consider removing the as RawActionData cast for cleaner code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change from TRawActionData to RawActionData is consistent across the files, but the type casting in generateVercelTool and getTools methods is unnecessary and could be removed for cleaner code.
2. js/src/sdk/actionRegistry.ts:61
  • Draft comment:
    The type casting to RawActionData is unnecessary here since composioSchema is already of type RawActionData. Consider removing the as unknown as RawActionData cast for cleaner code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change from TRawActionData to RawActionData is consistent across the files, but the type casting in generateVercelTool and getTools methods is unnecessary and could be removed for cleaner code.
3. js/src/sdk/actionRegistry.ts:95
  • Draft comment:
    The type casting to RawActionData is unnecessary here since composioSchema is already of type RawActionData. Consider removing the as unknown as RawActionData cast for cleaner code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change from TRawActionData to RawActionData is consistent across the files, but the type casting in generateVercelTool and getTools methods is unnecessary and could be removed for cleaner code.
4. js/src/sdk/actionRegistry.ts:106
  • Draft comment:
    The type casting to RawActionData is unnecessary here since action!.schema is already of type RawActionData. Consider removing the as RawActionData cast for cleaner code.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The change from TRawActionData to RawActionData is consistent across the files, but the type casting in generateVercelTool and getTools methods is unnecessary and could be removed for cleaner code.

Workflow ID: wflow_29qVsstx1tWdi94y


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 6375402 in 58 seconds

More details
  • Looked at 66 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/frameworks/cloudflare.ts:11
  • Draft comment:
    Ensure that the import path for Optional and Sequence is updated consistently across all files to ../types/util to avoid import errors.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_8lQvohpFmg8uezNf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 52712ed in 1 minute and 33 seconds

More details
  • Looked at 226 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. js/src/sdk/actionRegistry.spec.ts:91
  • Draft comment:
    The expected result should match the ActionExecuteResponse type. Adjust the test to expect the correct structure.
  • Reason this comment was not posted:
    Marked as duplicate.
2. js/src/sdk/actionRegistry.spec.ts:124
  • Draft comment:
    The expected result should match the ActionExecuteResponse type. Adjust the test to expect the correct structure.
  • Reason this comment was not posted:
    Marked as duplicate.
3. js/src/sdk/actionRegistry.spec.ts:27
  • Draft comment:
    The expected result should match the ActionExecuteResponse type. Adjust the test to expect the correct structure.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_1GwNrGdz19a2u08p


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -76,7 +76,7 @@ describe("ActionRegistry", () => {
description: "This is a test action",
inputParams: params,
callback: async function () {
return { success: true };
return { data: { success: true }, successful: true };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected result should match the ActionExecuteResponse type. Adjust the test to expect the correct structure.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on fdfe3ea in 1 minute and 15 seconds

More details
  • Looked at 50 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/frameworks/langchain.spec.ts:73
  • Draft comment:
    There's a typo in the test expectation. It should be successful instead of successfull.
    expect(actionOuput).toHaveProperty("successful", true);
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_LmyCjgpiA3LqsSBC


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 290e7ad in 2 minutes and 22 seconds

More details
  • Looked at 47 lines of code in 4 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/examples/market_research_agent/package.json:2
  • Draft comment:
    Inconsistent versioning of composio-core across different examples. Ensure consistent versions to avoid compatibility issues. This is also applicable in newsletter_twitter_threads/package.json, scheduling-agent/package.json, and vercel/nextjs-vercel-demo/package.json.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_7RQSPDEWdGau8Qou


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on de804f7 in 1 minute and 6 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/sdk/base.toolset.ts:50
  • Draft comment:
    The default value for apiKey has been changed to null. Ensure this change is intentional and does not affect the expected behavior when apiKey is not provided.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_11RebFKSe5cxhCeV


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 9a71bfe in 1 minute and 3 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/workflows/examples_js.yml:66
  • Draft comment:
    Consider updating the lockfile to ensure consistency in dependencies across environments.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_2wzP62zXVQ4qXAxS


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on bd22018 in 2 minutes and 39 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/workflows/examples_js.yml:66
  • Draft comment:
    Including 'langchain' alongside '@langchain/core' and '@langchain/openai' may be redundant and could lead to version conflicts. Consider removing 'langchain' if it's not needed separately.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_sfsiG6XrdrSeDfQF


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on b45089d in 1 minute and 16 seconds

More details
  • Looked at 98 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. js/src/sdk/base.toolset.spec.ts:42
  • Draft comment:
    The appName parameter is removed from the TSchemaProcessor type in base_toolset.ts but is still present here. This can lead to type errors. Please remove appName from the TSchemaProcessor usage here.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_Av6oG16XJuTfwAM8


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants