Skip to content

Commit e9e81e6

Browse files
authored
Merge pull request #608 from cipherstash/chore/prisma-next-0.14-upgrade
Chore/prisma next 0.14 upgrade
2 parents 8ac66a8 + 85175c2 commit e9e81e6

69 files changed

Lines changed: 6546 additions & 3331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/prisma-next-0-14.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@cipherstash/prisma-next': minor
3+
---
4+
5+
Upgrade to Prisma Next 0.14.0 (from 0.8.0). Every `@prisma-next/*` dependency is now pinned at 0.14.0; consuming apps must run Prisma Next 0.14 to use this release.
6+
7+
Highlights of the upgrade:
8+
9+
- The extension contract space is re-emitted in the 0.14 canonical shape: storage is namespace-enveloped (`storage.namespaces.public.entries.table`), the domain plane replaces flat `models`, and the baseline EQL-install migration is re-pinned to the new storage hash. The vendored EQL bundle SQL is unchanged byte-for-byte.
10+
- `deriveStackSchemas` reads the namespace-enveloped contract shape emitted by Prisma Next 0.10+.
11+
- The bulk-encrypt middleware accepts the widened insert/update AST value unions introduced through 0.9–0.11.
12+
- README examples use the namespace-qualified ORM accessors (`db.orm.public.User`) required since Prisma Next 0.14.

‎docs/superpowers/plans/2026-07-08-eql-v3-prisma-next.md‎

Lines changed: 2935 additions & 0 deletions
Large diffs are not rendered by default.

‎docs/superpowers/specs/2026-07-08-eql-v3-prisma-next-design.md‎

Lines changed: 467 additions & 0 deletions
Large diffs are not rendered by default.

‎e2e/tests/prisma-example-readme.e2e.test.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ const authConfigured = (() => {
2020
if (process.env.CS_CLIENT_ID && process.env.CS_CLIENT_KEY) return true
2121
const home = process.env.HOME
2222
if (!home) return false
23-
return existsSync(join(home, '.cipherstash', 'auth.json'))
23+
// `stash auth login` stores either an `auth.json` (legacy PKCE flow) or a
24+
// `device.json` (device-code flow) under the profile directory; both let
25+
// the stack client authenticate without CS_* env vars.
26+
return (
27+
existsSync(join(home, '.cipherstash', 'auth.json')) ||
28+
existsSync(join(home, '.cipherstash', 'device.json'))
29+
)
2430
})()
2531

2632
interface StepResult {
@@ -62,10 +68,15 @@ function runStep(commandLine: string, timeoutMs: number): StepResult {
6268
}
6369
}
6470

71+
// `.env` is included so a developer's real credentials file survives the
72+
// walkthrough: the README's `cp .env.example .env` step overwrites it, and
73+
// without the snapshot the teardown would delete it outright. The snapshot
74+
// captures it before the run and the restore puts the original back.
6575
const TRANSIENT_PATHS = [
6676
'migrations/app',
6777
'src/prisma/contract.json',
6878
'src/prisma/contract.d.ts',
79+
'.env',
6980
] as const
7081

7182
async function snapshotTransientOutputs(): Promise<string> {
@@ -170,10 +181,11 @@ describe.skipIf(!authConfigured)(
170181
afterAll(async () => {
171182
// Teardown the bundled Postgres container regardless of outcome.
172183
runStep('docker compose down -v', 60_000)
173-
// Restore the transient outputs from snapshot so the working tree is clean.
184+
// Restore the transient outputs from snapshot so the working tree is
185+
// clean. `.env` is part of the snapshot: the walkthrough's
186+
// `cp .env.example .env` overwrote it, and the restore brings back the
187+
// developer's original (or removes the copy when none existed before).
174188
await restoreTransientOutputs(snapDir)
175-
// Remove the .env we copied in the walkthrough (not tracked anyway).
176-
rmSync(join(EXAMPLE_DIR, '.env'), { force: true })
177189
}, 120_000)
178190

179191
// Per-step exit-zero assertion, registered once per non-skipped README line.

‎examples/prisma/.env.example‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#
55
# Defaults match the bundled `docker-compose.yml`. Run
66
# `docker compose up -d` from this directory to start a Postgres on
7-
# port 5544 with these credentials.
8-
DATABASE_URL=postgres://postgres:postgres@localhost:5544/cipherstash_prisma_example
7+
# port 54338 with these credentials.
8+
DATABASE_URL=postgres://postgres:postgres@localhost:54338/cipherstash_prisma_example
99

1010
# CipherStash workspace credentials — **deployment only**.
1111
#

‎examples/prisma/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A single `User` model with one column per cipherstash codec (string, double, big
1010

1111
| Path | Purpose |
1212
| -------------------------- | --------------------------------------------------------------------------------------------- |
13-
| `docker-compose.yml` | Local Postgres 16 on port 5544. |
13+
| `docker-compose.yml` | Local Postgres 16 on port 54338. |
1414
| `prisma/schema.prisma` | Application schema (one `User` model exercising all six cipherstash codecs). |
1515
| `prisma-next.config.ts` | Wires `cipherstash` into `extensionPacks`. |
1616
| `src/db.ts` | One-call setup via `cipherstashFromStack({ contractJson })`. |
@@ -20,7 +20,7 @@ A single `User` model with one column per cipherstash codec (string, double, big
2020

2121
## Prerequisites
2222

23-
1. **Docker** for the bundled Postgres on port 5544 (or any Postgres 16+).
23+
1. **Docker** for the bundled Postgres on port 54338 (or any Postgres 16+).
2424
2. **A CipherStash workspace** — sign up at [cipherstash.com](https://cipherstash.com), then run `stash auth login` (PKCE; caches credentials in your OS keychain — no `CS_*` env vars needed in local dev).
2525

2626
## Run it
@@ -33,7 +33,7 @@ docker compose up -d
3333
pnpm install
3434
pnpm emit # PSL → contract.{json,d.ts}
3535
pnpm migration:plan --name initial
36-
pnpm migration:apply # installs EQL bundle + your app schema in one sweep
36+
pnpm migration:apply # installs EQL bundle + your app schema in one sweep (runs `prisma-next migrate`)
3737
pnpm start # runs the demo
3838
```
3939

‎examples/prisma/docker-compose.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# docker compose down -v # stop + delete volume (fresh state)
66
#
77
# The DATABASE_URL in .env.example matches the values below:
8-
# postgres://postgres:postgres@localhost:5544/cipherstash_prisma_example
8+
# postgres://postgres:postgres@localhost:54338/cipherstash_prisma_example
99
#
10-
# Port 5544 (not 5432) is used to avoid colliding with any host-side
10+
# Port 54338 (not 5432) is used to avoid colliding with any host-side
1111
# Postgres / other example containers.
1212

1313
services:
@@ -20,7 +20,7 @@ services:
2020
POSTGRES_PASSWORD: postgres
2121
POSTGRES_DB: cipherstash_prisma_example
2222
ports:
23-
- "5544:5432"
23+
- "54338:5432"
2424
volumes:
2525
- cipherstash-prisma-example-pg-data:/var/lib/postgresql/data
2626
healthcheck:

0 commit comments

Comments
 (0)