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(openIntProxyLink): Adding Openint proxy link #39

Merged
merged 15 commits into from
Dec 4, 2024

Conversation

pellicceama
Copy link
Collaborator

@pellicceama pellicceama commented Nov 24, 2024

Important

Add OpenInt proxy link feature with validation, client integration, and tests for new authentication methods.

  • Feature:
    • Add openIntProxyLink in openIntProxyLink.ts for handling proxy requests with OpenInt.
    • Validate options using validateOpenIntProxyLinkOptions() for correct authentication combinations.
    • Integrate openIntProxyLink into createClient() in createClient.ts when auth options are provided.
  • Tests:
    • Add tests in createClient.spec.ts for link array length and overrides.
    • Add tests in index.spec.ts for sdk-qbo to verify new authentication methods.
  • Misc:
    • Update ClientOptions in createClient.ts to include auth for proxy link options.
    • Modify index.ts in sdk-qbo to support new authentication methods.
    • Add authLink.ts to handle different authentication methods.

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

Copy link

@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. Reviewed everything up to 4feb3cf in 1 minute and 51 seconds

More details
  • Looked at 257 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. packages/fetch-links/links/openIntProxyLink.ts:60
  • Draft comment:
    The TODO comment indicates that the openIntProxyLink function needs testing. Ensure this function is tested before merging.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. sdks/sdk-qbo/src/index.ts:27
  • Draft comment:
    The accessToken is destructured from options.auth but not used. If not needed, consider removing it to avoid confusion.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_nlUPX5czG40GYYuT


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.

return expectsAuthProxy
}

interface OpenIntProxyHeaders {
Copy link

Choose a reason for hiding this comment

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

The OpenIntProxyHeaders interface is defined twice in this file. Consider removing the duplicate definition to avoid confusion.

Copy link

@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 f34d9ad in 20 seconds

More details
  • Looked at 117 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. packages/runtime/createClient.ts:57
  • Draft comment:
    Consider providing a more descriptive error message to help users understand the issue better. For example, specify which authentication methods are conflicting.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The error message in the createClient function should be more descriptive to help users understand the issue better.
2. packages/runtime/createClient.ts:63
  • Draft comment:
    Check if fetchLink is already included in defaultLinks before adding it again to avoid redundancy.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The fetchLink is added to the links array when hasOtherAuthMethods is true, but it might not be necessary if the default links already include it.
3. sdks/sdk-qbo/src/index.spec.ts:14
  • Draft comment:
    Ensure that all possible authentication methods are covered in the test cases.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The test cases in index.spec.ts are correctly updated to use the new auth structure, but it's important to ensure that all possible authentication methods are covered.

Workflow ID: wflow_aB5JoGKMOgo4JnIH


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

Copy link

@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 e20fed1 in 1 minute and 3 seconds

More details
  • Looked at 217 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/fetch-links/links/authLink.ts:27
  • Draft comment:
    Consider adding a validation step to ensure that headers['authorization'] is not empty before returning the link. This will prevent requests from being sent without proper authorization.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment suggests a potential improvement to ensure that requests are not sent without proper authorization. However, the current logic already handles different authentication methods and defaults to an empty string if none are provided. The necessity of this validation depends on the intended behavior of the function. If sending requests without authorization is acceptable in some cases, then the comment may not be necessary. Without strong evidence that this validation is required, the comment may not be useful.
    I might be underestimating the importance of ensuring that requests are not sent without authorization. There could be security implications if requests are sent without proper authorization headers.
    The function's current design seems to allow for requests without authorization if no credentials are provided, which might be intentional. Without clear evidence that this is a mistake, the comment may not be necessary.
    The comment does not provide strong evidence that a validation step is required. The current logic seems to handle authorization as intended, allowing for empty headers if no credentials are provided. Therefore, the comment should be deleted.

Workflow ID: wflow_waWLQIWHvz8eH13Q


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.

@@ -33,6 +44,8 @@ export function createClient<Paths extends {}>({
}: ClientOptions = {}) {
const links = typeof _links === 'function' ? _links(defaultLinks) : _links

links.unshift(authLink(clientOptions.auth ?? {}, clientOptions.baseUrl ?? ''))
Copy link

Choose a reason for hiding this comment

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

Consider adding validation for the auth object before calling authLink to ensure it contains valid authentication data. This will prevent unnecessary processing and potential errors.

Copy link

@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 4434f24 in 27 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. sdks/sdk-qbo/src/index.spec.ts:5
  • Draft comment:
    Using the non-null assertion operator (!) on environment variables can lead to runtime errors if the variables are not set. Consider adding a check or default value to handle cases where the environment variable might be undefined.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_nrPiT7F9qbxZf1Zp


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

Copy link

@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 9e79f96 in 26 seconds

More details
  • Looked at 26 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/fetch-links/links/openIntProxyLink.ts:67
  • Draft comment:
    The use of let for headers is unnecessary since the variable is not reassigned. Consider using const instead for better readability and adherence to best practices.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_wfHrhBG7zbniquXL


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

Copy link

@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 9fbcc5a in 29 seconds

More details
  • Looked at 305 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/runtime/createClient.ts:49
  • Draft comment:
    Ensure that _links is handled properly when it is undefined to avoid unexpected behavior in createClient.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_zGXjtEapj49TY05T


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

Copy link

@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 1356b24 in 31 seconds

More details
  • Looked at 104 lines of code in 4 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. packages/fetch-links/package.json:46
  • Draft comment:
    The addition of type-fest as a devDependency is appropriate for the new types used in authLink.ts.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The import of type-fest in package.json is correct and necessary for the new types used in authLink.ts. No issues here.
2. packages/runtime/createClient.spec.ts:58
  • Draft comment:
    The test description should be corrected to 'expect links array to have 1 element by default'.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The test description in createClient.spec.ts should be corrected to match the expected behavior of the code.
3. packages/runtime/createClient.ts:45
  • Draft comment:
    The integration of authLink based on the presence of auth options is correctly implemented.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The change in createClient.ts to handle the auth option correctly integrates the new authLink functionality. No issues here.

Workflow ID: wflow_d7P0x0KZexj1q4cr


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

Copy link

@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 2787124 in 15 seconds

More details
  • Looked at 35 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_uYHUROMIjMZ2QGmz


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

Copy link

@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 bc25c89 in 21 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/runtime/createClient.spec.ts:78
  • Draft comment:
    The expected number of links should be 3, which is correct, as the auth link should be added to the default link, making it 2, and then the fetchLink adds another, making it 3.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The test case on line 70 checks for the number of links when auth is present and links are overridden. The expected number of links should be 3, which is correct, as the auth link should be added to the default link, making it 2, and then the fetchLink adds another, making it 3.

Workflow ID: wflow_Farcn1oBVl5t7AFN


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

Copy link

@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 01ebc72 in 10 seconds

More details
  • Looked at 58 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. packages/runtime/createClient.ts:9
  • Draft comment:
    The import of ClientAuthOptions is redundant as it is already imported in authLink. Consider removing it to avoid duplication.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The import statement for ClientAuthOptions in createClient.ts is redundant since it's already imported in authLink.

Workflow ID: wflow_2E09W9qzwG7omGm5


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

@pellicceama pellicceama merged commit 2505875 into main Dec 4, 2024
2 of 4 checks passed
@pellicceama pellicceama deleted the openint-proxy-link branch December 4, 2024 02:39
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