@prisma/dev 0.0.0-dev.202607271058 → 0.0.0-dev.202607271405
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -5
- package/dist/chunk-J6FIMHSD.js +1 -0
- package/dist/{chunk-A5B4L65Y.js → chunk-MD3K2IUP.js} +1 -1
- package/dist/daemon.cjs +13 -13
- package/dist/daemon.js +1 -1
- package/dist/index.cjs +20 -20
- package/dist/index.d.cts +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +1 -1
- package/dist/vite.cjs +26 -26
- package/dist/vite.d.cts +17 -7
- package/dist/vite.d.ts +17 -7
- package/dist/vite.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-MTR5KBPH.js +0 -1
package/README.md
CHANGED
|
@@ -68,6 +68,8 @@ export default defineConfig({
|
|
|
68
68
|
|
|
69
69
|
The hook runs before any application or framework code executes, so nothing can observe an unprepared database. `vite dev` waits for it, so a slow migration delays startup.
|
|
70
70
|
|
|
71
|
+
The plugin does this work in Vite's `configureServer` hook. That is the earliest hook which only runs for a dev server that is actually going to serve. Anything earlier also runs for config resolutions that serve nothing — a bare `resolveConfig` call, or the child compiler a framework builds from your config file — and starting a database for those is wrong. See [Frameworks that build a child compiler](#frameworks-that-build-a-child-compiler).
|
|
72
|
+
|
|
71
73
|
One hook is registered, but it can do as much as you need. Sequence with plain `await`:
|
|
72
74
|
|
|
73
75
|
```ts
|
|
@@ -96,9 +98,11 @@ By default the plugin does not overwrite a variable your environment already def
|
|
|
96
98
|
|
|
97
99
|
`database.env` always describes the local database, whether or not those values were written to `process.env`. Spreading it keeps the migration local under either setting of [`overrideExistingEnv`](#conflicting-environment-variables), so it is the safe habit regardless of how you configure that.
|
|
98
100
|
|
|
99
|
-
#### The hook runs
|
|
101
|
+
#### The hook runs once per database
|
|
102
|
+
|
|
103
|
+
Not once per dev server. Two dev servers sharing one database in one process — see [Frameworks that build a child compiler](#frameworks-that-build-a-child-compiler) — run it once. A config restart that does not change the plugin's own options keeps the running database, so it does not re-run the hook either.
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
It does run when the plugin attached to a database that `prisma dev` was already running. Make it idempotent — `prisma migrate deploy` already is.
|
|
102
106
|
|
|
103
107
|
#### If the hook fails
|
|
104
108
|
|
|
@@ -141,6 +145,35 @@ npx prisma dev --name my-app
|
|
|
141
145
|
npx vite dev
|
|
142
146
|
```
|
|
143
147
|
|
|
148
|
+
### Frameworks that build a child compiler
|
|
149
|
+
|
|
150
|
+
Some frameworks compile part of your app with a second, internal Vite server built from the same config file. React Router does this, and so the plugin has to cope with being instantiated twice in one process.
|
|
151
|
+
|
|
152
|
+
The plugin does. Two acquisitions of one `name` converge on one database: the second joins the first rather than restarting it, the database stays up until the last of them lets go, and `onDatabaseReady` runs once. Nothing needs configuring for this.
|
|
153
|
+
|
|
154
|
+
Two consequences are worth knowing:
|
|
155
|
+
|
|
156
|
+
- **A child compiler runs without a database.** React Router builds its child compiler before any dev server is configured, and drops the hook the plugin uses. Nothing in a child compiler queries a database, but code that runs there cannot expect `DATABASE_URL` to be set.
|
|
157
|
+
- **Commands that only resolve the config start nothing.** `react-router typegen` and `react-router build` load `vite.config.ts` without serving anything, so no database starts and no migration runs. A typecheck is a typecheck.
|
|
158
|
+
|
|
159
|
+
### Reading a database's address from another process
|
|
160
|
+
|
|
161
|
+
`process.env` reaches the Vite process and its children. It does not reach a `psql` session, a migration you run by hand, or anything else started from a second terminal.
|
|
162
|
+
|
|
163
|
+
Look the server up by name instead:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
import { getPrismaDevServerConnection } from "@prisma/dev";
|
|
167
|
+
|
|
168
|
+
const connection = await getPrismaDevServerConnection({ name: "my-app" });
|
|
169
|
+
|
|
170
|
+
console.log(connection?.databaseUrl); // postgres://...
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
It resolves to `null` when no server of that name is running. Only `stateful` servers are visible — a `stateless` one writes no state and can only be addressed through the process that started it.
|
|
174
|
+
|
|
175
|
+
This is why hardcoding a connection string into an `.env` file is not necessary, and why pinning ports is not either. See [Ports and stable addresses](#ports-and-stable-addresses).
|
|
176
|
+
|
|
144
177
|
### Connection strings never reach the browser
|
|
145
178
|
|
|
146
179
|
The plugin writes to `process.env` and nothing else. It deliberately does not use Vite's `define` or `import.meta.env`.
|
|
@@ -155,7 +188,7 @@ The database runs inside the Vite process, so it cannot outlive it. There is no
|
|
|
155
188
|
|
|
156
189
|
Quitting Vite normally, or with `Ctrl-C`, shuts the database down cleanly. A `kill -9` takes the database down with the process; the next start recovers on its own, though it may pause briefly to do so.
|
|
157
190
|
|
|
158
|
-
Editing `vite.config.ts` or an `.env` file restarts the database
|
|
191
|
+
Editing `vite.config.ts` or an `.env` file restarts the Vite dev server. The database is only restarted along with it if the edit changed this plugin's own options, in which case the new options have to win. Otherwise the running database is carried over untouched. Either way your data is persisted, unless you opted into [a throwaway database](#throwaway-databases). Editing application code does not touch the database.
|
|
159
192
|
|
|
160
193
|
### When the plugin does nothing
|
|
161
194
|
|
|
@@ -164,15 +197,18 @@ No database is started when:
|
|
|
164
197
|
- the command is `vite build`
|
|
165
198
|
- the command is `vite preview`
|
|
166
199
|
- the config was loaded by Vitest, which reads the same `vite.config.ts`
|
|
200
|
+
- the config was only resolved, and no dev server was configured — see [Frameworks that build a child compiler](#frameworks-that-build-a-child-compiler)
|
|
167
201
|
|
|
168
202
|
Pass `enableInTest: true` to allow a database under Vitest.
|
|
169
203
|
|
|
170
204
|
### Conflicting environment variables
|
|
171
205
|
|
|
172
|
-
By default, if a variable the plugin wants to write already
|
|
206
|
+
By default, if a variable the plugin wants to write already points somewhere else, the existing value wins and the plugin logs a warning. An intentional `.env` entry or shell export is not silently replaced.
|
|
173
207
|
|
|
174
208
|
Pass `overrideExistingEnv: true` to let the local database win instead.
|
|
175
209
|
|
|
210
|
+
A variable that already holds exactly the value the plugin was going to write is neither written nor warned about. There is no conflict to report.
|
|
211
|
+
|
|
176
212
|
### Using the `prisma+postgres://` URL
|
|
177
213
|
|
|
178
214
|
Off by default, because it embeds an API key. Opt in by naming a variable:
|
|
@@ -202,7 +238,18 @@ prismaDev({
|
|
|
202
238
|
| `streamsPort` | `51216` | Colocated Prisma Streams server port |
|
|
203
239
|
| `debug` | `false` | Log the server's debug output |
|
|
204
240
|
|
|
205
|
-
|
|
241
|
+
### Ports and stable addresses
|
|
242
|
+
|
|
243
|
+
A named `stateful` server records the ports it settled on and reuses them the next time it starts. So `name` alone is enough for a stable address.
|
|
244
|
+
|
|
245
|
+
To find out which ports a server actually landed on, [look it up by name](#reading-a-databases-address-from-another-process). That is also the recommended way to reach the database from outside the Vite process.
|
|
246
|
+
|
|
247
|
+
Passing a port explicitly changes the failure mode, deliberately:
|
|
248
|
+
|
|
249
|
+
- **A default port that is taken moves.** The plugin falls back to another free port rather than refusing to start.
|
|
250
|
+
- **A port you named is bound or the start fails.** It is never silently moved. A caller who names a port has something outside this process depending on it, and pointing that something at a port nothing is listening on is worse than a clear error.
|
|
251
|
+
|
|
252
|
+
A `stateless` database records nothing, so it takes any free port on every start unless you name one.
|
|
206
253
|
|
|
207
254
|
## Programmatic server
|
|
208
255
|
|
|
@@ -244,8 +291,20 @@ const server = await startPrismaDevServer({ name: "my-app", persistenceMode: "st
|
|
|
244
291
|
|
|
245
292
|
Defaults are `51213` for HTTP, `51214` for the database, `51215` for the shadow database, and `51216` for the Prisma Streams server. Override any of them with `port`, `databasePort`, `shadowDatabasePort`, and `streamsPort`.
|
|
246
293
|
|
|
294
|
+
A default that is taken falls back to another free port. A port you pass explicitly is bound or the call rejects — with `PortNotAvailableError` when nothing can bind it, and `PortBelongsToAnotherServerError` when another Prisma Dev server already holds it.
|
|
295
|
+
|
|
247
296
|
Starting a second server under a `name` that is already running rejects with `ServerAlreadyRunningError`.
|
|
248
297
|
|
|
298
|
+
### Looking up a running server
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
import { getPrismaDevServerConnection } from "@prisma/dev";
|
|
302
|
+
|
|
303
|
+
const connection = await getPrismaDevServerConnection({ name: "my-app" });
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Resolves the `databaseUrl`, `shadowDatabaseUrl`, and `prismaPostgresUrl` of a running `stateful` server by name, or `null` when none is running. Use it from a process that did not start the database and therefore cannot read its `process.env`.
|
|
307
|
+
|
|
249
308
|
### Experimental
|
|
250
309
|
|
|
251
310
|
`server.experimental` exposes change-data-capture events, query insights, and the colocated Prisma Streams endpoint. These are experimental and may change without notice.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as q}from"./chunk-662IKR3V.js";import{a as W,b as _,f as x}from"./chunk-PP43TGA5.js";import{a as O,b as R,c as A,d as I,e as v,f as M,h as $,i as U}from"./chunk-HFONW2ZS.js";import{d as C,j as y}from"./chunk-DWY47FQV.js";import{b as N}from"./chunk-DOJAPHLY.js";import Z from"find-my-way";async function F(r,e){let{port:t}=e;if(e.dryRun)return{async close(){},port:t,url:`http://localhost:${t}`};let n=!!e.debug,[{registerAccelerateRoutes:s},{registerUtilityRoutes:i},{createHTTPServer:l}]=await Promise.all([import("./accelerate-TRR43YJ5.js"),import("./utility-YEFNU35E.js"),import("./server-QR7P25DP.js")]),a={databaseDumpPath:e.databaseDumpPath,db:r,debug:n,name:e.name,port:t,shadowDBPort:e.shadowDatabasePort},o=Z({defaultRoute(u,p){N(p,"Not Found",404)},ignoreTrailingSlash:!1});s(o,a,n),i(o,a,n);let c=await l({router:o}).listen(t);return e.port=c.port,a.port=c.port,{async close(){let{Engine:u}=await import("./engine-YTEOPVUP.js");await Promise.allSettled([c.close(),u.stopAll()])},port:c.port,url:c.url}}import{isDeepStrictEqual as j}from"util";var ee="application/json",E={connection:"close","content-type":ee},T={apiVersion:"durable.streams/schema-registry/v1",schema:{additionalProperties:!0,properties:{applicationName:{type:["string","null"]},durationMs:{type:"number"},groupKey:{type:["string","null"]},query:{type:"string"},queryId:{type:"string"},reads:{type:"number"},rowsReturned:{type:"number"},tables:{items:{type:"string"},type:"array"},timestamp:{format:"date-time",type:"string"}},required:["durationMs","query","queryId","reads","rowsReturned","tables","timestamp"],type:"object"},search:{aliases:{applicationName:"applicationName",groupKey:"groupKey",queryId:"queryId"},fields:{applicationName:{bindings:[{jsonPointer:"/applicationName",version:1}],exact:!0,exists:!0,kind:"keyword"},eventTime:{bindings:[{jsonPointer:"/timestamp",version:1}],column:!0,exact:!0,exists:!0,kind:"date",sortable:!0},groupKey:{bindings:[{jsonPointer:"/groupKey",version:1}],exact:!0,exists:!0,kind:"keyword"},queryId:{bindings:[{jsonPointer:"/queryId",version:1}],exact:!0,exists:!0,kind:"keyword"}},primaryTimestampField:"eventTime"}};function H(r){return{...r,snapshot:async e=>await re(r.url,e)}}async function K(r){let e={serverUrl:r.serverUrl,sqlitePath:r.sqlitePath,streamName:R,url:v(r.serverUrl,R)};await ne(e);let t=new k({debug:r.debug,streamUrl:e.url}),n=r.bridge.subscribe(s=>{t.enqueue(s)});return{close:async()=>{n(),await t.close()},experimental:e}}async function re(r,e){if(!r)return W();let t=await te(r);return _(t,e)}async function te(r){let e=await fetch(`${r}?offset=-1&format=json`,{headers:{connection:"close"}});if(!e.ok)throw new Error(`Failed to read ${r}: HTTP ${e.status}`);return await e.json()}var k=class{#t;#r;#e;constructor(e){this.#t=e.debug,this.#r=Promise.resolve(),this.#e=e.streamUrl}enqueue(e){e.length!==0&&(this.#r=this.#r.then(async()=>{await ie(this.#e,e),this.#t&&console.debug(`[streams] appended ${e.length} query insight record(s) to ${this.#e}`)}).catch(t=>{console.error("[streams] failed to ingest query insights into prisma-queries",t)}))}async close(){await this.#r}};async function ne(r){let e=await fetch(r.url,{headers:E,method:"PUT"});if(!e.ok)throw await P(e,`Failed to create ${r.streamName}`);let t=await ae(r);if(se(t,r.streamName))return;if(t.currentVersion>0)throw new Error(`Failed to install schema for ${r.streamName}: existing schema registry is incompatible and requires a lens migration`);let n=await fetch(`${r.url}/_schema`,{body:JSON.stringify(T),headers:E,method:"POST"});if(!n.ok)throw await P(n,`Failed to install schema for ${r.streamName}`)}function se(r,e){if(r.currentVersion<=0||r.schema!==e)return!1;let t=r.schemas[String(r.currentVersion)];return j(t,T.schema)&&j(r.search,T.search)}async function ae(r){let e=await fetch(`${r.url}/_schema`,{headers:E,method:"GET"});if(!e.ok)throw await P(e,`Failed to inspect schema for ${r.streamName}`);return await e.json()}async function ie(r,e){let t=await fetch(r,{body:JSON.stringify(e),headers:E,method:"POST"});if(!t.ok)throw await P(t,"Failed to append to prisma-queries")}async function P(r,e){let t=await r.text().catch(()=>"");return new Error(`${e}: HTTP ${r.status}${t?` ${t}`:""}`)}import{randomUUID as oe}from"crypto";import{setTimeout as L}from"timers/promises";import{isDeepStrictEqual as V}from"util";import{process as le}from"std-env";var ce="application/json",S={connection:"close","content-type":ce},ue={apiVersion:"durable.streams/profile/v1",profile:{kind:"state-protocol",touch:{enabled:!0,onMissingBefore:"coarse"}}},B={apiVersion:"durable.streams/schema-registry/v1",schema:{additionalProperties:!0,properties:{headers:{properties:{operation:{type:"string"},timestamp:{format:"date-time",type:"string"}},required:["timestamp","operation"],type:"object"},key:{type:"string"},type:{type:"string"}},required:["type","key","headers"],type:"object"},search:{aliases:{rowKey:"key",table:"type"},fields:{eventTime:{bindings:[{jsonPointer:"/headers/timestamp",version:1}],column:!0,exact:!0,exists:!0,kind:"date",sortable:!0},key:{bindings:[{jsonPointer:"/key",version:1}],exact:!0,exists:!0,kind:"keyword"},operation:{bindings:[{jsonPointer:"/headers/operation",version:1}],exact:!0,exists:!0,kind:"keyword"},type:{bindings:[{jsonPointer:"/type",version:1}],exact:!0,exists:!0,kind:"keyword"}},primaryTimestampField:"eventTime"}};async function G(r){let{dbServer:e,debug:t,name:n,persistenceMode:s,port:i,queryInsightsBridge:l,walBridge:a}=r,o=s==="stateless",c=o?Ee(n):n,u=I(c),p=!o&&await C(u);le.env.DS_LOCAL_DATA_ROOT=A(),o&&await y(u);let m=await de({debug:t,hadExistingStreamsData:p,name:c,port:i}),g={serverUrl:m.exports.http.url,sqlitePath:m.exports.sqlite.path,streamName:O,url:v(m.exports.http.url)};try{await he(g);let d=await K({bridge:l,debug:t,serverUrl:m.exports.http.url,sqlitePath:m.exports.sqlite.path}),h=new D({dbServer:e,debug:t,streamUrl:g.url}),z=a.subscribe(X=>{h.enqueue(X)});return{close:async()=>{z(),await h.close(),await d.close(),await m.close(),await L(100),o&&await y(u)},experimental:g,experimentalQueryInsights:d.experimental}}catch(d){throw await m.close().catch(()=>{}),await L(100),o&&await y(u).catch(()=>{}),d}}var me=["database disk image is malformed","duplicate column name:","file is not a database","malformed database schema","no such column:","no such table:","schema_version row missing after migration","unexpected schema version:"];async function de(r){let{debug:e,hadExistingStreamsData:t,name:n,port:s}=r,{startLocalDurableStreamsServer:i}=await import("@prisma/streams-local"),l=()=>i({hostname:"127.0.0.1",name:n,port:s});try{return await l()}catch(a){if(!t||!pe(a))throw a;return console.warn(`[streams] resetting incompatible durable streams data for "${n}"`),e&&console.debug(`[streams] original durable streams startup error for "${n}"`,a),await y(I(n)),await l()}}function pe(r){return ge(r).map(t=>t.toLowerCase()).some(t=>me.some(n=>t.includes(n)))}function ge(r){let e=[],t=[r],n=new Set;for(;t.length>0;){let s=t.shift();if(!(s==null||n.has(s))){if(n.add(s),typeof s=="string"){e.push(s);continue}if(s instanceof AggregateError)for(let i of s.errors)t.push(i);if(s instanceof Error){e.push(s.message);let i=s.cause;i!==void 0&&t.push(i)}}}return e}var D=class{#t;#r;#e;#n;#s;constructor(e){this.#t=e.dbServer,this.#r=e.debug,this.#e=Promise.resolve(),this.#n=e.streamUrl,this.#s=new Set}enqueue(e){e.length!==0&&(this.#e=this.#e.then(async()=>{let t=await this.#i(e);t.length!==0&&(await fe(this.#n,t),this.#r&&console.debug(`[streams] appended ${t.length} state-protocol record(s) to ${this.#n}`))}).catch(t=>{console.error("[streams] failed to ingest WAL events into prisma-wal",t)}))}async close(){await this.#e}async#i(e){let t=[],n=new Date().toISOString();for(let s of e)t.push(...await this.#o(s,n));return t}async#o(e,t){let n=`${e.schema}.${e.table}`,s=await this.#t.getPrimaryKeyColumns(e.schema,e.table),i=J(e.record),l=J(e.oldRecord),a=this.#a(n,s,l),o=this.#a(n,s,i),c=e.txid===""?void 0:e.txid;return e.type==="insert"?i&&o?[{headers:{operation:"insert",timestamp:t,txid:c},key:o,old_value:null,type:n,value:i}]:[]:e.type==="delete"?l&&a?[{headers:{operation:"delete",timestamp:t,txid:c},key:a,old_value:l,type:n,value:null}]:[]:!i||!l||!a||!o?[]:a!==o?[{headers:{operation:"delete",timestamp:t,txid:c},key:a,old_value:l,type:n,value:null},{headers:{operation:"insert",timestamp:t,txid:c},key:o,old_value:null,type:n,value:i}]:[{headers:{operation:"update",timestamp:t,txid:c},key:o,old_value:l,type:n,value:i}]}#a(e,t,n){if(!n)return null;let s=ve(n,t);return s||(this.#s.has(e)||(this.#s.add(e),console.warn(`[streams] falling back to full-row keys for ${e} because no primary key could be resolved`)),we(n))}};async function he(r){let e=await fetch(r.url,{headers:S,method:"PUT"});if(!e.ok)throw await f(e,`Failed to create ${r.streamName}`);let t=await fetch(`${r.url}/_profile`,{body:JSON.stringify(ue),headers:S,method:"POST"});if(!t.ok)throw await f(t,`Failed to configure ${r.streamName}`);let n=await ye(r);if(Se(n,r.streamName))return;if(n.currentVersion>0)throw new Error(`Failed to install schema for ${r.streamName}: existing schema registry is incompatible and requires a lens migration`);let s=await fetch(`${r.url}/_schema`,{body:JSON.stringify(B),headers:S,method:"POST"});if(!s.ok)throw await f(s,`Failed to install schema for ${r.streamName}`)}async function ye(r){let e=await fetch(`${r.url}/_schema`,{headers:S,method:"GET"});if(!e.ok)throw await f(e,`Failed to inspect schema for ${r.streamName}`);return await e.json()}function Se(r,e){if(r.currentVersion<=0||r.schema!==e)return!1;let t=r.schemas[String(r.currentVersion)];return V(t,B.schema)&&V(r.search,B.search)}async function fe(r,e){let t=await fetch(r,{body:JSON.stringify(e),headers:S,method:"POST"});if(!t.ok)throw await f(t,"Failed to append to prisma-wal")}async function f(r,e){let t=await r.text().catch(()=>"");return new Error(`${e}: HTTP ${r.status}${t?` ${t}`:""}`)}function ve(r,e){if(e.length===0)return null;let t=[];for(let n of e){if(!Object.prototype.hasOwnProperty.call(r,n))return null;let s=be(r[n]);if(s==null)return null;t.push(e.length===1?s:`${n}=${s}`)}return t.join("|")}function we(r){return JSON.stringify(Q(r))}function Q(r){return Array.isArray(r)?r.map(e=>Q(e)):r&&typeof r=="object"?Object.fromEntries(Object.entries(r).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,Q(t)])):r}function J(r){return r?structuredClone(r):null}function be(r){if(r===null)return"null";if(r===void 0)return"undefined";if(typeof r=="string")return r;if(typeof r=="number")return Number.isFinite(r)?String(r):null;if(typeof r=="bigint")return r.toString();if(typeof r=="boolean")return r?"true":"false";try{return JSON.stringify(r)}catch{return null}}function Ee(r){return`${r}.${oe().replaceAll("-","")}`}async function tr(r){let e=await M.createExclusively(r),t=null,n=null,s=null,i=null;try{[t,s]=await Promise.all([x("database",e),x("shadow_database",e)]);let l,a;e.dryRun?(l=Ie(),a=Te(),i=ke()):(l=await t.attachWalEventBridge(),a=await t.attachQueryInsightsBridge(),i=await G({dbServer:t,debug:e.debug,name:e.name,port:e.streamsPort,persistenceMode:e.persistenceMode,queryInsightsBridge:a,walBridge:l})),n=await F(t,e);let o=Pe(t,s,n,e);await e.writeServerDump(o,e.dryRun?{}:{queryInsights:i.experimentalQueryInsights,streams:i.experimental});let c=Re(l),u=H(i.experimentalQueryInsights),p=t,m=s,g=n,d=i,h=async()=>{c.close(),await Y(e,[g,d,p,m])};return{close:h,dbServer:t,httpServer:n,server:{...o,close:h,experimental:{queryInsights:u,streams:i.experimental,wal:c.api},name:e.name},serverState:e,shadowDbServer:s,streamsServer:i,queryInsightsBridge:a,walBridge:l}}catch(l){return await xe(e,[n,i,t,s],l)}}function Pe(r,e,t,n){let s=`prisma+postgres://localhost:${t.port}/?${new URLSearchParams({api_key:q({databaseUrl:r.prismaORMConnectionString,name:n.name,shadowDatabaseUrl:e.prismaORMConnectionString})}).toString()}`;return{database:{connectionString:r.connectionString,prismaORMConnectionString:r.prismaORMConnectionString,terminalCommand:r.terminalCommand},http:{url:t.url},ppg:{url:s},shadowDatabase:{connectionString:e.prismaORMConnectionString,prismaORMConnectionString:e.prismaORMConnectionString,terminalCommand:e.terminalCommand}}}async function Y(r,e){let t=[];for(let n of e)try{await n.close()}catch(s){t.push(s)}try{await r.close()}catch(n){t.push(n)}if(t.length>0)throw new AggregateError(t,"Failed to close some servers")}async function xe(r,e,t){try{await Y(r,e.filter(n=>n!==null))}catch(n){throw new AggregateError([t,n],"Failed to start Prisma Dev server cleanly")}throw t}function Re(r){let e=new Set;return{api:{stream:()=>{let t=()=>{},n=Be(r,()=>{e.delete(t)});return t=()=>n.close(),e.add(t),n.stream},subscribe:t=>r.subscribe(t)},close:()=>{for(let t of[...e])t();e.clear()}}}function Ie(){return{async close(){},async poll(){},subscribe(){return()=>{}}}}function Te(){return{async close(){},subscribe(){return()=>{}}}}function ke(){return{async close(){},experimental:{serverUrl:"",sqlitePath:"",streamName:"",url:""},experimentalQueryInsights:{serverUrl:"",sqlitePath:"",streamName:"",url:""}}}function Be(r,e){let t=[],n=!1,s=null,i=r.subscribe(a=>{if(!n){if(s){let o=s;s=null,o.resolve({done:!1,value:a});return}t.push(a)}}),l=()=>{if(!n&&(n=!0,i(),t.length=0,e(),s)){let a=s;s=null,a.resolve({done:!0,value:void 0})}};return{close:l,stream:{[Symbol.asyncIterator](){return this},next(){return t.length>0?Promise.resolve({done:!1,value:t.shift()}):n?Promise.resolve({done:!0,value:void 0}):new Promise((a,o)=>{s={reject:o,resolve:a}})},return(){return l(),Promise.resolve({done:!0,value:void 0})},throw(a){let o=s;return l(),o&&o.reject(a),Promise.reject(a instanceof Error?a:new Error(String(a)))}}}}var De="default";function Qe(r){return{databaseUrl:r.database.prismaORMConnectionString??r.database.connectionString,prismaPostgresUrl:r.ppg.url,shadowDatabaseUrl:r.shadowDatabase.prismaORMConnectionString??r.shadowDatabase.connectionString}}async function ir(r){let{debug:e,name:t=De}=r??{},n=await $(t,{debug:e});return!U(n)||!n.exports?null:{...Qe(n.exports),name:n.name}}export{tr as a,Qe as b,ir as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-J6FIMHSD.js";async function s(e){let{server:t}=await r(e);return t}async function A(e){return await s(e)}export{s as a,A as b};
|