@prisma/dev 0.0.0-dev.202512221609 → 0.0.0-dev.202512231615

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.
@@ -1 +1 @@
1
- import{a as d}from"./chunk-3BZW3EVN.js";import{a as w}from"./chunk-MO5SCYLN.js";import{f as u}from"./chunk-LMPFMHCB.js";import{a as v,c as f,d as g}from"./chunk-GZSROICS.js";import{createServer as A}from"http";import{promisify as R}from"util";import T from"@prisma/get-platform";async function P(o,e){let{port:r}=e;if(e.dryRun)return y(r,null);let t=await D(r,o,e),{promise:s,reject:S,resolve:c}=f(),{serve:i}=await import("@hono/node-server"),m=i({createServer:A,fetch:t.fetch,overrideGlobalObjects:!1,port:r},c);return m.on("error",n=>{if(typeof n=="object"&&"code"in n&&n.code==="EADDRINUSE")return S(new u(r));console.error("[Accelerate]",n)}),await s,y(r,m)}function y(o,e){return{async close(){e&&await Promise.allSettled([R(e.close.bind(e))(),g.stopAll()])},port:o,url:`http://localhost:${o}`}}async function D(o,e,r){let{debug:t}=r,[{Hono:s},{accelerateRoute:S},{utilityRoute:c}]=await Promise.all([import("hono/tiny"),import("./accelerate-ZET2GIPN.js"),import("./utility-YJ4TFSMW.js")]),i=new s,m=await T.getPlatformInfo();if(t&&console.debug("[Accelerate] platform info: %s",JSON.stringify(m)),t){let{logger:a}=await import("hono/logger");i.use("*",a((...p)=>console.log("[Accelerate]",...p)))}i.use("*",async(a,p)=>(a.set("db",e),a.set("debug",!!t),a.set("platform",m),a.set("port",o),a.set("protocol","http"),a.set("serverState",r),a.set("shadowDBPort",r.shadowDatabasePort),await p()));let n=new s;return n.route("/",S),n.route("/",c),i.route("/",n),i}async function O(o){let e=await w.createExclusively(o),[r,t]=await Promise.all([d("database",e),d("shadow_database",e)]),s=await P(r,e),S=`prisma+postgres://localhost:${s.port}/?${new URLSearchParams({api_key:v({databaseUrl:r.prismaORMConnectionString,name:e.name,shadowDatabaseUrl:t.prismaORMConnectionString})}).toString()}`,c={database:{connectionString:r.connectionString,prismaORMConnectionString:r.prismaORMConnectionString,terminalCommand:r.terminalCommand},http:{url:s.url},ppg:{url:S},shadowDatabase:{connectionString:t.prismaORMConnectionString,prismaORMConnectionString:t.prismaORMConnectionString,terminalCommand:t.terminalCommand}};return await e.writeServerDump(c),{...c,close:()=>i(e,[s,r,t]),name:e.name};async function i(m,n){let p=(await Promise.allSettled(n.map(l=>l.close()))).filter(l=>l.status==="rejected").map(l=>new Error(l.reason));try{await m.close()}catch(l){p.push(l)}if(p.length>0)throw new AggregateError(p,"Failed to close some servers")}}async function J(o){return await O(o)}export{O as a,J as b};
1
+ import{a as d}from"./chunk-3BZW3EVN.js";import{a as w}from"./chunk-MO5SCYLN.js";import{f as u}from"./chunk-LMPFMHCB.js";import{a as f,c as v,d as g}from"./chunk-GZSROICS.js";import{createServer as A}from"http";import{promisify as R}from"util";import T from"@prisma/get-platform";async function P(o,e){let{port:r}=e;if(e.dryRun)return y(r,null);let t=await D(r,o,e),{promise:s,reject:S,resolve:l}=v(),{serve:i}=await import("@hono/node-server"),m=i({createServer:A,fetch:t.fetch,overrideGlobalObjects:!1,port:r},l);return m.on("error",n=>{if(typeof n=="object"&&"code"in n&&n.code==="EADDRINUSE")return S(new u(r));console.error("[Accelerate]",n)}),await s,y(r,m)}function y(o,e){return{async close(){e&&await Promise.allSettled([R(e.close.bind(e))(),g.stopAll()])},port:o,url:`http://localhost:${o}`}}async function D(o,e,r){let{debug:t}=r,[{Hono:s},{accelerateRoute:S},{utilityRoute:l}]=await Promise.all([import("hono/tiny"),import("./accelerate-ZET2GIPN.js"),import("./utility-YJ4TFSMW.js")]),i=new s,m=await T.getPlatformInfo();if(t&&console.debug("[Accelerate] platform info: %s",JSON.stringify(m)),t){let{logger:a}=await import("hono/logger");i.use("*",a((...p)=>console.log("[Accelerate]",...p)))}i.use("*",async(a,p)=>(a.set("db",e),a.set("debug",!!t),a.set("platform",m),a.set("port",o),a.set("protocol","http"),a.set("serverState",r),a.set("shadowDBPort",r.shadowDatabasePort),await p()));let n=new s;return n.route("/",S),n.route("/",l),i.route("/",n),i}async function E(o){let e=await w.createExclusively(o),[r,t]=await Promise.all([d("database",e),d("shadow_database",e)]),s=await P(r,e),S=`prisma+postgres://localhost:${s.port}/?${new URLSearchParams({api_key:f({databaseUrl:r.prismaORMConnectionString,name:e.name,shadowDatabaseUrl:t.prismaORMConnectionString})}).toString()}`,l={database:{connectionString:r.connectionString,prismaORMConnectionString:r.prismaORMConnectionString,terminalCommand:r.terminalCommand},http:{url:s.url},ppg:{url:S},shadowDatabase:{connectionString:t.prismaORMConnectionString,prismaORMConnectionString:t.prismaORMConnectionString,terminalCommand:t.terminalCommand}};return await e.writeServerDump(l),{...l,close:()=>i(e,[s,r,t]),name:e.name};async function i(m,n){let p=(await Promise.allSettled(n.map(c=>c.close()))).filter(c=>c.status==="rejected").map(c=>new Error(c.reason));try{await m.close()}catch(c){p.push(c)}if(p.length>0)throw new AggregateError(p,"Failed to close some servers")}}async function J(o){return await E(o)}export{E as a,J as b};
package/dist/daemon.js CHANGED
@@ -1 +1 @@
1
- import{a as o}from"./chunk-UBEVLXWB.js";import"./chunk-3BZW3EVN.js";import"./chunk-MO5SCYLN.js";import"./chunk-LMPFMHCB.js";import"./chunk-GZSROICS.js";import"./chunk-ITQ6ILGR.js";import{setTimeout as n}from"timers/promises";var r;process.once("SIGTERM",()=>{console.log("SIGTERM received, shutting down..."),process.removeAllListeners("SIGINT"),process.exitCode=143,r?.close().finally(()=>process.exit())});process.once("SIGINT",()=>{console.log("SIGINT received, shutting down..."),process.removeAllListeners("SIGTERM"),process.exitCode=130,r?.close().finally(()=>process.exit())});async function a(){let[,,s]=process.argv;if(!s)return process.send?.({type:"error",error:'Missing "name" argument, server cannot be started'},void 0),process.exit(1);try{r=await o({debug:!0,persistenceMode:"stateful",name:s}),process.send?.({type:"started",server:r},void 0)}catch(e){console.error(e);let t=e instanceof Error?e.message:String(e);process.send?.({type:"error",error:t},void 0),await n(1e3),process.exit(1)}}a();
1
+ import{a as o}from"./chunk-OUMJ6Z34.js";import"./chunk-3BZW3EVN.js";import"./chunk-MO5SCYLN.js";import"./chunk-LMPFMHCB.js";import"./chunk-GZSROICS.js";import"./chunk-ITQ6ILGR.js";import{setTimeout as n}from"timers/promises";var r;process.once("SIGTERM",()=>{console.log("SIGTERM received, shutting down..."),process.removeAllListeners("SIGINT"),process.exitCode=143,r?.close().finally(()=>process.exit())});process.once("SIGINT",()=>{console.log("SIGINT received, shutting down..."),process.removeAllListeners("SIGTERM"),process.exitCode=130,r?.close().finally(()=>process.exit())});async function a(){let[,,s]=process.argv;if(!s)return process.send?.({type:"error",error:'Missing "name" argument, server cannot be started'},void 0),process.exit(1);try{r=await o({debug:!0,persistenceMode:"stateful",name:s}),process.send?.({type:"started",server:r},void 0)}catch(e){console.error(e);let t=e instanceof Error?e.message:String(e);process.send?.({type:"error",error:t},void 0),await n(1e3),process.exit(1)}}a();
package/dist/index.d.cts CHANGED
@@ -19,29 +19,6 @@ interface Server extends Exports {
19
19
  name: string;
20
20
  }
21
21
  type ReadonlyServer = Omit<Server, "close">;
22
- interface StartPrismaDevServerOptions extends ServerOptions {
23
- /**
24
- * Connection timeout in milliseconds for establishing new client connections.
25
- *
26
- * Default is 1 minute (60,000 milliseconds).
27
- *
28
- * Use it with caution, as it may lead to unexpected behavior. Best used with
29
- * a pool client that retries connections.
30
- */
31
- databaseConnectTimeoutMillis?: number;
32
- /**
33
- * Idle timeout in milliseconds for active client connections.
34
- *
35
- * Is not applied by default.
36
- *
37
- * Use it with caution, as it may lead to unexpected disconnections. Best used
38
- * with a pool client that can handle disconnections gracefully.
39
- *
40
- * Set it if you suffer from client hanging indefinitely as the active connection
41
- * remain open forever.
42
- */
43
- databaseIdleTimeoutMillis?: number;
44
- }
45
22
  /**
46
23
  * Starts a `prisma dev` server instance programmatically.
47
24
  *
@@ -53,4 +30,4 @@ declare function startPrismaDevServer(options?: ServerOptions): Promise<Server>;
53
30
  */
54
31
  declare function unstable_startServer(options?: ServerOptions): Promise<Server>;
55
32
 
56
- export { DEFAULT_DATABASE_PORT, DEFAULT_SERVER_PORT, DEFAULT_SHADOW_DATABASE_PORT, type PortAssignableService, PortNotAvailableError, type ReadonlyServer, type Server, ServerOptions, type StartPrismaDevServerOptions, startPrismaDevServer, unstable_startServer };
33
+ export { DEFAULT_DATABASE_PORT, DEFAULT_SERVER_PORT, DEFAULT_SHADOW_DATABASE_PORT, type PortAssignableService, PortNotAvailableError, type ReadonlyServer, type Server, ServerOptions, startPrismaDevServer, unstable_startServer };
package/dist/index.d.ts CHANGED
@@ -19,29 +19,6 @@ interface Server extends Exports {
19
19
  name: string;
20
20
  }
21
21
  type ReadonlyServer = Omit<Server, "close">;
22
- interface StartPrismaDevServerOptions extends ServerOptions {
23
- /**
24
- * Connection timeout in milliseconds for establishing new client connections.
25
- *
26
- * Default is 1 minute (60,000 milliseconds).
27
- *
28
- * Use it with caution, as it may lead to unexpected behavior. Best used with
29
- * a pool client that retries connections.
30
- */
31
- databaseConnectTimeoutMillis?: number;
32
- /**
33
- * Idle timeout in milliseconds for active client connections.
34
- *
35
- * Is not applied by default.
36
- *
37
- * Use it with caution, as it may lead to unexpected disconnections. Best used
38
- * with a pool client that can handle disconnections gracefully.
39
- *
40
- * Set it if you suffer from client hanging indefinitely as the active connection
41
- * remain open forever.
42
- */
43
- databaseIdleTimeoutMillis?: number;
44
- }
45
22
  /**
46
23
  * Starts a `prisma dev` server instance programmatically.
47
24
  *
@@ -53,4 +30,4 @@ declare function startPrismaDevServer(options?: ServerOptions): Promise<Server>;
53
30
  */
54
31
  declare function unstable_startServer(options?: ServerOptions): Promise<Server>;
55
32
 
56
- export { DEFAULT_DATABASE_PORT, DEFAULT_SERVER_PORT, DEFAULT_SHADOW_DATABASE_PORT, type PortAssignableService, PortNotAvailableError, type ReadonlyServer, type Server, ServerOptions, type StartPrismaDevServerOptions, startPrismaDevServer, unstable_startServer };
33
+ export { DEFAULT_DATABASE_PORT, DEFAULT_SERVER_PORT, DEFAULT_SHADOW_DATABASE_PORT, type PortAssignableService, PortNotAvailableError, type ReadonlyServer, type Server, ServerOptions, startPrismaDevServer, unstable_startServer };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as f,b as g}from"./chunk-UBEVLXWB.js";import"./chunk-3BZW3EVN.js";import{g as e}from"./chunk-MO5SCYLN.js";import{a,b,c,f as d}from"./chunk-LMPFMHCB.js";import"./chunk-GZSROICS.js";import"./chunk-ITQ6ILGR.js";export{a as DEFAULT_DATABASE_PORT,b as DEFAULT_SERVER_PORT,c as DEFAULT_SHADOW_DATABASE_PORT,d as PortNotAvailableError,e as ServerAlreadyRunningError,f as startPrismaDevServer,g as unstable_startServer};
1
+ import{a as f,b as g}from"./chunk-OUMJ6Z34.js";import"./chunk-3BZW3EVN.js";import{g as e}from"./chunk-MO5SCYLN.js";import{a,b,c,f as d}from"./chunk-LMPFMHCB.js";import"./chunk-GZSROICS.js";import"./chunk-ITQ6ILGR.js";export{a as DEFAULT_DATABASE_PORT,b as DEFAULT_SERVER_PORT,c as DEFAULT_SHADOW_DATABASE_PORT,d as PortNotAvailableError,e as ServerAlreadyRunningError,f as startPrismaDevServer,g as unstable_startServer};
package/dist/state.d.cts CHANGED
@@ -49,7 +49,10 @@ declare const serverDumpV1Schema: valibot.ObjectSchema<{
49
49
  type ServerDumpV1 = InferOutput<typeof serverDumpV1Schema>;
50
50
  interface ServerOptions {
51
51
  /**
52
- * Connection timeout in milliseconds for establishing new client connections.
52
+ * Connection timeout in milliseconds for pending database connections.
53
+ *
54
+ * Starts ticking for every new client that attempts to connect. When exceeded,
55
+ * the pending client connection is evicted and closed.
53
56
  *
54
57
  * Default is 1 minute (60,000 milliseconds).
55
58
  *
@@ -58,7 +61,11 @@ interface ServerOptions {
58
61
  */
59
62
  databaseConnectTimeoutMillis?: number;
60
63
  /**
61
- * Idle timeout in milliseconds for active client connections.
64
+ * Idle timeout in milliseconds for active database connections.
65
+ *
66
+ * Re-starts ticking after each message received on the active connection. When
67
+ * exceeded - meaning there hasn't been any activity for a while, the active
68
+ * client connection is closed, and a pending connection is promoted to active.
62
69
  *
63
70
  * Is not applied by default.
64
71
  *
@@ -110,24 +117,15 @@ interface ServerOptions {
110
117
  */
111
118
  port?: number;
112
119
  /**
113
- * Connection timeout in milliseconds for establishing new client connections.
114
- *
115
- * Default is 1 minute (60,000 milliseconds).
120
+ * Connection timeout in milliseconds for pending shadow database connections.
116
121
  *
117
- * Use it with caution, as it may lead to unexpected behavior. Best used with
118
- * a pool client that retries connections.
122
+ * Default is {@link databaseConnectTimeoutMillis}.
119
123
  */
120
124
  shadowDatabaseConnectTimeoutMillis?: number;
121
125
  /**
122
- * Idle timeout in milliseconds for active client connections.
126
+ * Idle timeout in milliseconds for active shadow database connections.
123
127
  *
124
- * Is not applied by default.
125
- *
126
- * Use it with caution, as it may lead to unexpected disconnections. Best used
127
- * with a pool client that can handle disconnections gracefully.
128
- *
129
- * Set it if you suffer from client hanging indefinitely as the active connection
130
- * remain open forever.
128
+ * Default is {@link databaseIdleTimeoutMillis}.
131
129
  */
132
130
  shadowDatabaseIdleTimeoutMillis?: number;
133
131
  /**
package/dist/state.d.ts CHANGED
@@ -49,7 +49,10 @@ declare const serverDumpV1Schema: valibot.ObjectSchema<{
49
49
  type ServerDumpV1 = InferOutput<typeof serverDumpV1Schema>;
50
50
  interface ServerOptions {
51
51
  /**
52
- * Connection timeout in milliseconds for establishing new client connections.
52
+ * Connection timeout in milliseconds for pending database connections.
53
+ *
54
+ * Starts ticking for every new client that attempts to connect. When exceeded,
55
+ * the pending client connection is evicted and closed.
53
56
  *
54
57
  * Default is 1 minute (60,000 milliseconds).
55
58
  *
@@ -58,7 +61,11 @@ interface ServerOptions {
58
61
  */
59
62
  databaseConnectTimeoutMillis?: number;
60
63
  /**
61
- * Idle timeout in milliseconds for active client connections.
64
+ * Idle timeout in milliseconds for active database connections.
65
+ *
66
+ * Re-starts ticking after each message received on the active connection. When
67
+ * exceeded - meaning there hasn't been any activity for a while, the active
68
+ * client connection is closed, and a pending connection is promoted to active.
62
69
  *
63
70
  * Is not applied by default.
64
71
  *
@@ -110,24 +117,15 @@ interface ServerOptions {
110
117
  */
111
118
  port?: number;
112
119
  /**
113
- * Connection timeout in milliseconds for establishing new client connections.
114
- *
115
- * Default is 1 minute (60,000 milliseconds).
120
+ * Connection timeout in milliseconds for pending shadow database connections.
116
121
  *
117
- * Use it with caution, as it may lead to unexpected behavior. Best used with
118
- * a pool client that retries connections.
122
+ * Default is {@link databaseConnectTimeoutMillis}.
119
123
  */
120
124
  shadowDatabaseConnectTimeoutMillis?: number;
121
125
  /**
122
- * Idle timeout in milliseconds for active client connections.
126
+ * Idle timeout in milliseconds for active shadow database connections.
123
127
  *
124
- * Is not applied by default.
125
- *
126
- * Use it with caution, as it may lead to unexpected disconnections. Best used
127
- * with a pool client that can handle disconnections gracefully.
128
- *
129
- * Set it if you suffer from client hanging indefinitely as the active connection
130
- * remain open forever.
128
+ * Default is {@link databaseIdleTimeoutMillis}.
131
129
  */
132
130
  shadowDatabaseIdleTimeoutMillis?: number;
133
131
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/dev",
3
- "version": "0.0.0-dev.202512221609",
3
+ "version": "0.0.0-dev.202512231615",
4
4
  "description": "A local Prisma Postgres server for development and testing",
5
5
  "type": "module",
6
6
  "author": "Igal Klebanov <igalklebanov@gmail.com> (https://github.com/igalklebanov)",