Skip to content

Conversation

@lpan
Copy link

@lpan lpan commented Aug 4, 2025

Why

What

  • Refactor this codebase so it does not depend on runtime Prisma deps. Only the types
  • Caller is required to pass in their own Prisma object

lpan and others added 6 commits August 4, 2025 14:59
BREAKING CHANGE: withBark now returns a function that accepts the Prisma namespace

This change allows the extension to work with custom Prisma output paths,
which is essential for monorepo setups. Instead of hardcoding imports from
@prisma/client, users now pass their own Prisma namespace.

Before:
```js
const xprisma = new PrismaClient().$extends(
  withBark({ modelNames: ['node'] })
)
```

After:
```js
import { PrismaClient, Prisma } from '../generated/client'
const xprisma = new PrismaClient().$extends(
  withBark({ modelNames: ['node'] })(Prisma)
)
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed all import statements from '@prisma/client/extension'
- Replaced Prisma.getExtensionContext(this) with direct 'this' usage
- Removed type annotations that depended on @prisma/client
- All tests pass with the refactored code

This completes the removal of hardcoded Prisma imports, making the
extension fully compatible with custom Prisma output paths.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added postinstall script to automatically build dist files
- Moved esbuild to dependencies to support GitHub installations
- Added documentation for installing directly from GitHub
- This allows users to test the changes before npm publication

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added specific pnpm installation commands for monorepo
- Clarified different installation methods for various package managers
- Simplified instructions to avoid confusion

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added integration tests verifying the new API works correctly
- Added TypeScript tests to verify type definitions
- Fixed type definition for Prisma parameter (though 'as any' still needed due to TS limitations)
- Added test scripts for TypeScript validation
- Verified that withBark works with Prisma namespace parameter

The tests confirm the implementation works correctly, though TypeScript's
inference limitations mean users still need 'as any' for now.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ility

- Added tests to verify all standard Prisma CRUD operations work correctly
- Tested findMany, findUnique, findFirst, create, update, delete, etc.
- Verified Bark methods work alongside standard Prisma methods
- Tested transactions mixing both Bark and Prisma operations
- Confirmed select, where, orderBy, and other query options work
- Added tests for aggregate, groupBy, count operations

These tests ensure that adding the Bark extension doesn't break
any existing Prisma functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Aug 4, 2025

🦋 Changeset detected

Latest commit: 4f5c986

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
prisma-extension-bark Minor
playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

lpan and others added 3 commits August 4, 2025 18:53
Remove the "Installing from GitHub" section and custom Prisma output paths
documentation that were added in this branch, reverting to the simpler
API documentation from main.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add changeset describing the custom Prisma client path support feature
that warrants a minor version bump.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
esbuild is only needed during the build process and should not be
a runtime dependency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Error when using Bark Middleware with Prisma on a custom output location

1 participant