@prisma/dev 0.7.1 → 0.9.0

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,202 +0,0 @@
1
- import { PGlite } from '@electric-sql/pglite';
2
- import * as valibot from 'valibot';
3
- import { InferOutput } from 'valibot';
4
-
5
- declare const DEFAULT_DATABASE_PORT = 51214;
6
- declare const DEFAULT_SERVER_PORT = 51213;
7
- declare const DEFAULT_SHADOW_DATABASE_PORT = 51215;
8
- type PortAssignableService = DBServerPurpose | "server";
9
- declare class PortNotAvailableError extends Error {
10
- port: number;
11
- service: PortAssignableService;
12
- name: string;
13
- constructor(port: number, service: PortAssignableService);
14
- }
15
-
16
- interface Server extends Exports {
17
- close(): Promise<void>;
18
- }
19
- declare function unstable_startServer(options?: ServerOptions): Promise<Server>;
20
-
21
- declare const exportsSchema: valibot.ObjectSchema<{
22
- readonly database: valibot.ObjectSchema<{
23
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
24
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
25
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
26
- }, undefined>;
27
- readonly http: valibot.ObjectSchema<{
28
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
29
- }, undefined>;
30
- readonly ppg: valibot.ObjectSchema<{
31
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
32
- }, undefined>;
33
- readonly shadowDatabase: valibot.ObjectSchema<{
34
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
35
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
36
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
37
- }, undefined>;
38
- }, undefined>;
39
- type Exports = InferOutput<typeof exportsSchema>;
40
- declare const serverDumpV1Schema: valibot.ObjectSchema<{
41
- readonly databasePort: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
42
- readonly exports: valibot.OptionalSchema<valibot.ObjectSchema<{
43
- readonly database: valibot.ObjectSchema<{
44
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
45
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
46
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
47
- }, undefined>;
48
- readonly http: valibot.ObjectSchema<{
49
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
50
- }, undefined>;
51
- readonly ppg: valibot.ObjectSchema<{
52
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
53
- }, undefined>;
54
- readonly shadowDatabase: valibot.ObjectSchema<{
55
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
56
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
57
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
58
- }, undefined>;
59
- }, undefined>, undefined>;
60
- readonly name: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.MinLengthAction<string, 1, undefined>]>;
61
- readonly pid: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 0, undefined>]>, undefined>;
62
- readonly port: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
63
- readonly shadowDatabasePort: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
64
- readonly version: valibot.LiteralSchema<"1", undefined>;
65
- }, undefined>;
66
- type ServerDumpV1 = InferOutput<typeof serverDumpV1Schema>;
67
- interface ServerOptions {
68
- /**
69
- * The port the database server will listen on.
70
- *
71
- * Defaults to `51214`.
72
- *
73
- * An error is thrown if the port is already in use.
74
- */
75
- databasePort?: number;
76
- /**
77
- * Whether to enable debug logging.
78
- *
79
- * Defaults to `false`.
80
- */
81
- debug?: boolean;
82
- /**
83
- * Whether to run the server in dry run mode.
84
- *
85
- * Defaults to `false`.
86
- */
87
- dryRun?: boolean;
88
- /**
89
- * The name of the server.
90
- *
91
- * Defaults to `default`.
92
- */
93
- name?: string;
94
- /**
95
- * The persistence mode of the server.
96
- *
97
- * Default is `stateless`.
98
- */
99
- persistenceMode?: PersistenceMode;
100
- /**
101
- * The port the server will listen on.
102
- *
103
- * Defaults to `51213`.
104
- *
105
- * An error is thrown if the port is already in use.
106
- */
107
- port?: number;
108
- /**
109
- * The port the shadow database server will listen on.
110
- *
111
- * Defaults to `51215`.
112
- *
113
- * An error is thrown if the port is already in use.
114
- */
115
- shadowDatabasePort?: number;
116
- }
117
- type ResolvedServerOptions = Required<ServerOptions>;
118
- type PersistenceMode = "stateless" | "stateful";
119
- interface ScanOptions {
120
- debug?: boolean;
121
- }
122
- declare const PRIVATE_INITIALIZE_SYMBOL: unique symbol;
123
- declare abstract class ServerState implements ResolvedServerOptions {
124
- readonly databasePort: number;
125
- readonly debug: boolean;
126
- readonly dryRun: boolean;
127
- readonly name: string;
128
- readonly persistenceMode: PersistenceMode;
129
- readonly pid: number | undefined;
130
- readonly port: number;
131
- readonly shadowDatabasePort: number;
132
- protected constructor(options: Omit<ServerOptions, "persistenceMode"> & {
133
- persistenceMode: PersistenceMode;
134
- pid: number | undefined;
135
- });
136
- static createExclusively(options: ServerOptions | undefined): Promise<ServerState>;
137
- static fromServerDump(options?: Pick<ServerOptions, "debug" | "name">): Promise<StatefulServerState | null>;
138
- static scan(options?: ScanOptions): Promise<ServerStatusV1[]>;
139
- abstract get databaseDumpPath(): string;
140
- abstract get pgliteDataDirPath(): string;
141
- abstract [PRIVATE_INITIALIZE_SYMBOL](): Promise<void>;
142
- abstract close(): Promise<void>;
143
- abstract writeServerDump(exports?: Omit<Server, "close">): Promise<void>;
144
- }
145
- declare class StatefulServerState extends ServerState {
146
- #private;
147
- constructor(options: Omit<ServerOptions, "persistenceMode"> & {
148
- pid: number | undefined;
149
- serverDump?: ServerDumpV1;
150
- });
151
- static getServerDumpPath(dataDirPath: string): string;
152
- get databaseDumpPath(): string;
153
- get exports(): Exports | undefined;
154
- get pgliteDataDirPath(): string;
155
- [PRIVATE_INITIALIZE_SYMBOL](): Promise<void>;
156
- close(): Promise<void>;
157
- writeServerDump(exports?: Exports): Promise<void>;
158
- }
159
- interface ServerStatusV1 extends ServerDumpV1 {
160
- status: "running" | "starting_up" | "not_running" | "no_such_server" | "unknown" | "error";
161
- }
162
- declare class ServerStateAlreadyExistsError extends Error {
163
- name: string;
164
- constructor(name: string);
165
- }
166
-
167
- interface DBServer {
168
- close(): Promise<void>;
169
- readonly connectionLimit: number;
170
- readonly connectionString: string;
171
- readonly connectTimeout: number;
172
- readonly database: string;
173
- dump(destinationPath: string): Promise<void>;
174
- readonly maxIdleConnectionLifetime: number;
175
- readonly password: string;
176
- readonly poolTimeout: number;
177
- readonly port: number;
178
- readonly prismaORMConnectionString: string;
179
- readonly socketTimeout: number;
180
- readonly sslMode: string;
181
- readonly terminalCommand: string;
182
- readonly username: string;
183
- }
184
- interface DBDump {
185
- dumpPath: string;
186
- }
187
- type DBServerPurpose = "database" | "shadow_database";
188
- declare function startDBServer(purpose: DBServerPurpose, serverState: ServerState): Promise<DBServer>;
189
- type DumpDBOptions<D extends string> = {
190
- dataDir: string;
191
- db?: never;
192
- debug?: boolean;
193
- destinationPath?: D;
194
- } | {
195
- dataDir?: never;
196
- db: PGlite;
197
- debug?: boolean;
198
- destinationPath?: D;
199
- };
200
- declare function dumpDB<D extends string = never>(options: DumpDBOptions<D>): Promise<[D] extends [never] ? string : void>;
201
-
202
- export { DEFAULT_DATABASE_PORT as D, type Exports as E, type PortAssignableService as P, type ResolvedServerOptions as R, type ServerOptions as S, type Server as a, DEFAULT_SERVER_PORT as b, DEFAULT_SHADOW_DATABASE_PORT as c, PortNotAvailableError as d, type ServerDumpV1 as e, type PersistenceMode as f, type ScanOptions as g, ServerState as h, type ServerStatusV1 as i, ServerStateAlreadyExistsError as j, type DBServer as k, type DBDump as l, type DBServerPurpose as m, type DumpDBOptions as n, dumpDB as o, startDBServer as s, unstable_startServer as u };
@@ -1,202 +0,0 @@
1
- import { PGlite } from '@electric-sql/pglite';
2
- import * as valibot from 'valibot';
3
- import { InferOutput } from 'valibot';
4
-
5
- declare const DEFAULT_DATABASE_PORT = 51214;
6
- declare const DEFAULT_SERVER_PORT = 51213;
7
- declare const DEFAULT_SHADOW_DATABASE_PORT = 51215;
8
- type PortAssignableService = DBServerPurpose | "server";
9
- declare class PortNotAvailableError extends Error {
10
- port: number;
11
- service: PortAssignableService;
12
- name: string;
13
- constructor(port: number, service: PortAssignableService);
14
- }
15
-
16
- interface Server extends Exports {
17
- close(): Promise<void>;
18
- }
19
- declare function unstable_startServer(options?: ServerOptions): Promise<Server>;
20
-
21
- declare const exportsSchema: valibot.ObjectSchema<{
22
- readonly database: valibot.ObjectSchema<{
23
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
24
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
25
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
26
- }, undefined>;
27
- readonly http: valibot.ObjectSchema<{
28
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
29
- }, undefined>;
30
- readonly ppg: valibot.ObjectSchema<{
31
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
32
- }, undefined>;
33
- readonly shadowDatabase: valibot.ObjectSchema<{
34
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
35
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
36
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
37
- }, undefined>;
38
- }, undefined>;
39
- type Exports = InferOutput<typeof exportsSchema>;
40
- declare const serverDumpV1Schema: valibot.ObjectSchema<{
41
- readonly databasePort: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
42
- readonly exports: valibot.OptionalSchema<valibot.ObjectSchema<{
43
- readonly database: valibot.ObjectSchema<{
44
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
45
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
46
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
47
- }, undefined>;
48
- readonly http: valibot.ObjectSchema<{
49
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
50
- }, undefined>;
51
- readonly ppg: valibot.ObjectSchema<{
52
- readonly url: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
53
- }, undefined>;
54
- readonly shadowDatabase: valibot.ObjectSchema<{
55
- readonly connectionString: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>;
56
- readonly prismaORMConnectionString: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.UrlAction<string, undefined>]>, undefined>;
57
- readonly terminalCommand: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
58
- }, undefined>;
59
- }, undefined>, undefined>;
60
- readonly name: valibot.SchemaWithPipe<readonly [valibot.StringSchema<undefined>, valibot.MinLengthAction<string, 1, undefined>]>;
61
- readonly pid: valibot.OptionalSchema<valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 0, undefined>]>, undefined>;
62
- readonly port: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
63
- readonly shadowDatabasePort: valibot.SchemaWithPipe<readonly [valibot.NumberSchema<undefined>, valibot.IntegerAction<number, undefined>, valibot.MinValueAction<number, 1, undefined>]>;
64
- readonly version: valibot.LiteralSchema<"1", undefined>;
65
- }, undefined>;
66
- type ServerDumpV1 = InferOutput<typeof serverDumpV1Schema>;
67
- interface ServerOptions {
68
- /**
69
- * The port the database server will listen on.
70
- *
71
- * Defaults to `51214`.
72
- *
73
- * An error is thrown if the port is already in use.
74
- */
75
- databasePort?: number;
76
- /**
77
- * Whether to enable debug logging.
78
- *
79
- * Defaults to `false`.
80
- */
81
- debug?: boolean;
82
- /**
83
- * Whether to run the server in dry run mode.
84
- *
85
- * Defaults to `false`.
86
- */
87
- dryRun?: boolean;
88
- /**
89
- * The name of the server.
90
- *
91
- * Defaults to `default`.
92
- */
93
- name?: string;
94
- /**
95
- * The persistence mode of the server.
96
- *
97
- * Default is `stateless`.
98
- */
99
- persistenceMode?: PersistenceMode;
100
- /**
101
- * The port the server will listen on.
102
- *
103
- * Defaults to `51213`.
104
- *
105
- * An error is thrown if the port is already in use.
106
- */
107
- port?: number;
108
- /**
109
- * The port the shadow database server will listen on.
110
- *
111
- * Defaults to `51215`.
112
- *
113
- * An error is thrown if the port is already in use.
114
- */
115
- shadowDatabasePort?: number;
116
- }
117
- type ResolvedServerOptions = Required<ServerOptions>;
118
- type PersistenceMode = "stateless" | "stateful";
119
- interface ScanOptions {
120
- debug?: boolean;
121
- }
122
- declare const PRIVATE_INITIALIZE_SYMBOL: unique symbol;
123
- declare abstract class ServerState implements ResolvedServerOptions {
124
- readonly databasePort: number;
125
- readonly debug: boolean;
126
- readonly dryRun: boolean;
127
- readonly name: string;
128
- readonly persistenceMode: PersistenceMode;
129
- readonly pid: number | undefined;
130
- readonly port: number;
131
- readonly shadowDatabasePort: number;
132
- protected constructor(options: Omit<ServerOptions, "persistenceMode"> & {
133
- persistenceMode: PersistenceMode;
134
- pid: number | undefined;
135
- });
136
- static createExclusively(options: ServerOptions | undefined): Promise<ServerState>;
137
- static fromServerDump(options?: Pick<ServerOptions, "debug" | "name">): Promise<StatefulServerState | null>;
138
- static scan(options?: ScanOptions): Promise<ServerStatusV1[]>;
139
- abstract get databaseDumpPath(): string;
140
- abstract get pgliteDataDirPath(): string;
141
- abstract [PRIVATE_INITIALIZE_SYMBOL](): Promise<void>;
142
- abstract close(): Promise<void>;
143
- abstract writeServerDump(exports?: Omit<Server, "close">): Promise<void>;
144
- }
145
- declare class StatefulServerState extends ServerState {
146
- #private;
147
- constructor(options: Omit<ServerOptions, "persistenceMode"> & {
148
- pid: number | undefined;
149
- serverDump?: ServerDumpV1;
150
- });
151
- static getServerDumpPath(dataDirPath: string): string;
152
- get databaseDumpPath(): string;
153
- get exports(): Exports | undefined;
154
- get pgliteDataDirPath(): string;
155
- [PRIVATE_INITIALIZE_SYMBOL](): Promise<void>;
156
- close(): Promise<void>;
157
- writeServerDump(exports?: Exports): Promise<void>;
158
- }
159
- interface ServerStatusV1 extends ServerDumpV1 {
160
- status: "running" | "starting_up" | "not_running" | "no_such_server" | "unknown" | "error";
161
- }
162
- declare class ServerStateAlreadyExistsError extends Error {
163
- name: string;
164
- constructor(name: string);
165
- }
166
-
167
- interface DBServer {
168
- close(): Promise<void>;
169
- readonly connectionLimit: number;
170
- readonly connectionString: string;
171
- readonly connectTimeout: number;
172
- readonly database: string;
173
- dump(destinationPath: string): Promise<void>;
174
- readonly maxIdleConnectionLifetime: number;
175
- readonly password: string;
176
- readonly poolTimeout: number;
177
- readonly port: number;
178
- readonly prismaORMConnectionString: string;
179
- readonly socketTimeout: number;
180
- readonly sslMode: string;
181
- readonly terminalCommand: string;
182
- readonly username: string;
183
- }
184
- interface DBDump {
185
- dumpPath: string;
186
- }
187
- type DBServerPurpose = "database" | "shadow_database";
188
- declare function startDBServer(purpose: DBServerPurpose, serverState: ServerState): Promise<DBServer>;
189
- type DumpDBOptions<D extends string> = {
190
- dataDir: string;
191
- db?: never;
192
- debug?: boolean;
193
- destinationPath?: D;
194
- } | {
195
- dataDir?: never;
196
- db: PGlite;
197
- debug?: boolean;
198
- destinationPath?: D;
199
- };
200
- declare function dumpDB<D extends string = never>(options: DumpDBOptions<D>): Promise<[D] extends [never] ? string : void>;
201
-
202
- export { DEFAULT_DATABASE_PORT as D, type Exports as E, type PortAssignableService as P, type ResolvedServerOptions as R, type ServerOptions as S, type Server as a, DEFAULT_SERVER_PORT as b, DEFAULT_SHADOW_DATABASE_PORT as c, PortNotAvailableError as d, type ServerDumpV1 as e, type PersistenceMode as f, type ScanOptions as g, ServerState as h, type ServerStatusV1 as i, ServerStateAlreadyExistsError as j, type DBServer as k, type DBDump as l, type DBServerPurpose as m, type DumpDBOptions as n, dumpDB as o, startDBServer as s, unstable_startServer as u };