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

update hook signature #12

Merged
merged 2 commits into from
Dec 12, 2024
Merged

update hook signature #12

merged 2 commits into from
Dec 12, 2024

Conversation

markusahlstrand
Copy link
Owner

@markusahlstrand markusahlstrand commented Dec 12, 2024

Summary by CodeRabbit

  • New Features

    • Updated changelog entries for version 0.5.3 and 0.25.0 reflecting dependency changes.
    • New export for Hooks types enhancing the public API.
  • Bug Fixes

    • Minor change in the hook signature for OnExecuteCredentialsExchange.
  • Documentation

    • Updated changelogs for both the demo and authhero packages to reflect recent changes.
  • Chores

    • Version updates in package.json for both demo and authhero packages.

Copy link

vercel bot commented Dec 12, 2024

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

Name Status Preview Comments Updated (UTC)
authhero-react-admin ❌ Failed (Inspect) Dec 12, 2024 0:19am

Copy link

coderabbitai bot commented Dec 12, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/authhero/src/index.ts

Oops! Something went wrong! :(

ESLint: 9.5.0

file:///eslint.config.mjs?mtime=1734006571563:6
import { configs, rules as reactRules } from "eslint-plugin-react";
^^^^^^^
SyntaxError: Named export 'configs' not found. The requested module 'eslint-plugin-react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'eslint-plugin-react';
const { configs, rules: reactRules } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:483:26)
at async loadFlatConfigFile (/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:316:21)
at async calculateConfigArray (/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:396:28)
at async ESLint.lintFiles (/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js:815:25)
at async Object.execute (/node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli.js:500:23)
at async main (/node_modules/.pnpm/[email protected]/node_modules/eslint/bin/eslint.js:153:22)

Walkthrough

This pull request introduces updates to the authhero package and its dependencies, specifically upgrading the authhero dependency from version 0.24.0 to 0.25.0. The changes include updates to the changelogs for both the @authhero/demo and authhero packages, reflecting the new version and modifications in the dependency structure. Additionally, a new export for Hooks types has been added to the authhero package, and the signature of a specific hook type has been modified. The overall structure of the package.json files remains consistent.

Changes

File Path Change Summary
apps/demo/CHANGELOG.md Added version entry 0.5.3, updated authhero dependency from 0.24.0 to 0.25.0.
apps/demo/package.json Updated project version from 0.5.2 to 0.5.3, updated authhero dependency from ^0.24.0 to ^0.25.0.
packages/authhero/CHANGELOG.md Added version entry 0.25.0, noted minor change updating hook signature.
packages/authhero/package.json Updated version from 0.24.0 to 0.25.0.
packages/authhero/src/index.ts Added export for Hooks types from ./types/Hooks.
packages/authhero/src/types/Hooks.ts Updated parameter name in OnExecuteCredentialsExchange type from api to access.
packages/authhero/test/hooks/credentials-exchange.spec.ts Changed type in test from OnExecuteCredentialsExchangeAPI to OnExecuteCredentialsExchangeAccess.

Possibly related PRs

🐇 In the garden where updates bloom,
The authhero leaps, dispelling gloom.
With hooks refined and versions bright,
We hop along, our code takes flight!
Dependencies dance in a joyful cheer,
A patch of progress, oh so dear!
🥕


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
packages/authhero/src/types/Hooks.ts (1)

22-22: Consider renaming the type to match the parameter name

The parameter name has been changed from api to access, but the type name OnExecuteCredentialsExchangeAPI still contains "API". Consider renaming the type to OnExecuteCredentialsExchangeAccess for consistency.

-export type OnExecuteCredentialsExchangeAPI = {
+export type OnExecuteCredentialsExchangeAccess = {
   accessToken: {
     setCustomClaim: (claim: string, value: any) => void;
   };
   access: {
     deny: (code: string, reason?: string) => void;
   };
 };

 export type OnExecuteCredentialsExchange = (
   event: OnExecuteCredentialsExchangeEvent,
-  access: OnExecuteCredentialsExchangeAPI,
+  access: OnExecuteCredentialsExchangeAccess,
 ) => Promise<void>;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc3b87 and d995aa6.

📒 Files selected for processing (7)
  • apps/demo/CHANGELOG.md (1 hunks)
  • apps/demo/package.json (2 hunks)
  • packages/authhero/CHANGELOG.md (1 hunks)
  • packages/authhero/package.json (1 hunks)
  • packages/authhero/src/index.ts (1 hunks)
  • packages/authhero/src/types/Hooks.ts (1 hunks)
  • packages/authhero/test/hooks/credentials-exchange.spec.ts (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/authhero/CHANGELOG.md
  • packages/authhero/package.json
  • apps/demo/package.json
🔇 Additional comments (2)
apps/demo/CHANGELOG.md (1)

3-8: LGTM! Changelog update follows semantic versioning.

The patch version bump and dependency update are correctly documented following the Changesets format.

Let's verify the dependency update is properly reflected in the package configuration:

✅ Verification successful

Dependency update is correctly reflected in package.json

The package.json correctly shows the updated dependency version of authhero to ^0.25.0, which matches the changelog entry. The version bump and dependency update are properly synchronized.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the dependency update in package.json

# Check if the package.json reflects this dependency update
rg -A 5 '"authhero":\s*"\^0.25.0"' apps/demo/package.json

# Verify the PR description or commit messages mention the hook signature update
git log -1 --pretty=format:%B | rg -i "hook"

Length of output: 212

packages/authhero/src/index.ts (1)

11-11: Document this as a breaking change

The addition of this export is correct and necessary. However, since this modifies the public API and includes a breaking change in the hook signature, ensure this is properly documented in the CHANGELOG.md with a major version bump following semver.

@markusahlstrand markusahlstrand merged commit 0c61fdf into main Dec 12, 2024
2 of 3 checks passed
@markusahlstrand markusahlstrand deleted the update-hook-signature branch December 12, 2024 12:39
@coderabbitai coderabbitai bot mentioned this pull request Dec 16, 2024
@coderabbitai coderabbitai bot mentioned this pull request Dec 29, 2024
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.

1 participant