Skip to content

Releases: 47ng/prisma-field-encryption

v1.6.0-beta.1

25 Jun 12:53
8e4769a
Compare
Choose a tag to compare
v1.6.0-beta.1 Pre-release
Pre-release

1.6.0-beta.1 (2024-06-25)

Features

v1.5.2

07 Feb 18:46
edd4283
Compare
Choose a tag to compare

1.5.2 (2024-02-07)

Bug Fixes

v1.5.2-beta.1

06 Feb 22:57
edd4283
Compare
Choose a tag to compare
v1.5.2-beta.1 Pre-release
Pre-release

1.5.2-beta.1 (2024-02-06)

Bug Fixes

v1.5.1

24 Dec 04:43
057efba
Compare
Choose a tag to compare

1.5.1 (2023-12-24)

Bug Fixes

v1.5.1-beta.1

02 Nov 08:18
Compare
Choose a tag to compare
v1.5.1-beta.1 Pre-release
Pre-release

1.5.1-beta.1 (2023-11-02)

Bug Fixes

v1.5.0

23 Jul 18:41
Compare
Choose a tag to compare

1.5.0 (2023-07-23)

Features

  • Provide Prisma client extension (9b9b34a), closes #63 (see migration path below)

Bug Fixes

  • Default to sequential migrations (eba3899)
  • Default to using extensions in CI script (2710c16)
  • Remove global DMMF import (1532709)
  • Use Prisma.defineExtension for export (37cbc84)

Migration from 1.4.x

While the middleware interface is still exported and functional, it is recommended you upgrade your Prisma client to 4.7.0+ and switch to the client extension mechanism.

Prisma client version

For Prisma client versions 4.7.0 to 4.15.0 (included), you'll need to enable the clientExtensions feature flag:

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["clientExtensions"]
}

For Prisma client version 4.16.0+, the client extensions mechanism is generally available without the need for a preview feature flag.

Converting the middleware to an extension

This assumes you create and export your Prisma client and attach the middleware in the same file. In v1.4.0, it would have looked like this:

import { PrismaClient } from '@prisma/client'
import { fieldEncryptionMiddleware } from 'prisma-field-encryption'

export const client = new PrismaClient()

client.$use(fieldEncryptionMiddleware())

Client extensions require exporting the result of the extended client, so the equivalent code will look like this:

import { PrismaClient } from '@prisma/client'
import { fieldEncryptionExtension } from 'prisma-field-encryption'

// Create a Prisma client
const globalClient = new PrismaClient()

// Extend with encryption support and export the resulting client
export const client = globalClient.$extends(
  fieldEncryptionExtension()
)

Migrations

When calling the generated migrate function for data migrations (to rotate encryption keys), you'll have to do an explicit cast of the client type, due to an issue with Prisma types not allowing to precisely represent extended clients in function arguments (see prisma/prisma#20326):

// Import from your generated client location, not @prisma/client
import { PrismaClient } from '.prisma/client' // or custom path
import { migrate } from './where/you/want/your/migrations'
import { fieldEncryptionExtension } from 'prisma-field-encryption'

const client = new PrismaClient().$extends(fieldEncryptionExtension())

// Explicit cast needed here ↴
await migrate(client as PrismaClient)

v1.5.0-beta.2

19 Jul 08:02
Compare
Choose a tag to compare
v1.5.0-beta.2 Pre-release
Pre-release

1.5.0-beta.2 (2023-07-19)

Bug Fixes

  • Remove global DMMF import (035bb05)
  • Use Prisma.defineExtension for export (1de4d23)

v1.5.0-beta.1

21 Jun 14:28
Compare
Choose a tag to compare
v1.5.0-beta.1 Pre-release
Pre-release

1.5.0-beta.1 (2023-06-21)

Bug Fixes

  • Default to using extensions in CI script (9c4ff08)

Features

  • Provide Prisma client extension (f1829ab), closes #63

v1.4.5

21 Jun 12:20
Compare
Choose a tag to compare

1.4.5 (2023-06-21)

Bug Fixes

v1.4.4

20 Jun 10:35
Compare
Choose a tag to compare

1.4.4 (2023-06-20)

Bug Fixes

  • Hashed fields in readonly mode (d25ecdd)