@prisma/cli-init 0.0.0-dev.202511190417 → 0.0.0-dev.202511211609
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/dist/{accelerate-YEFEYVGD.js → accelerate-SOBMYP3B.js} +1 -1
- package/dist/{chunk-YX4UTTNJ.js → chunk-NJX2BODH.js} +0 -5
- package/dist/index.js +739 -415
- package/dist/{utility-W6LOZZIT.js → utility-QJR3G2JJ.js} +1 -1
- package/package.json +6 -2
- package/dist/_-7PGEEJCL.js +0 -36
- package/dist/chunk-WHXUOHVE.js +0 -1486
package/dist/index.js
CHANGED
|
@@ -22,18 +22,11 @@ import {
|
|
|
22
22
|
withResolvers,
|
|
23
23
|
y
|
|
24
24
|
} from "./chunk-7C5I22R2.js";
|
|
25
|
-
import {
|
|
26
|
-
credentialsFile,
|
|
27
|
-
poll,
|
|
28
|
-
printPpgInitOutput,
|
|
29
|
-
requestOrThrow,
|
|
30
|
-
successMessage
|
|
31
|
-
} from "./chunk-WHXUOHVE.js";
|
|
32
25
|
import {
|
|
33
26
|
__commonJS,
|
|
34
27
|
__require,
|
|
35
28
|
__toESM
|
|
36
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NJX2BODH.js";
|
|
37
30
|
|
|
38
31
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
39
32
|
var require_polyfills = __commonJS({
|
|
@@ -63,56 +56,56 @@ var require_polyfills = __commonJS({
|
|
|
63
56
|
}
|
|
64
57
|
var chdir;
|
|
65
58
|
module.exports = patch;
|
|
66
|
-
function patch(
|
|
59
|
+
function patch(fs4) {
|
|
67
60
|
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
68
|
-
patchLchmod(
|
|
69
|
-
}
|
|
70
|
-
if (!
|
|
71
|
-
patchLutimes(
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
|
|
61
|
+
patchLchmod(fs4);
|
|
62
|
+
}
|
|
63
|
+
if (!fs4.lutimes) {
|
|
64
|
+
patchLutimes(fs4);
|
|
65
|
+
}
|
|
66
|
+
fs4.chown = chownFix(fs4.chown);
|
|
67
|
+
fs4.fchown = chownFix(fs4.fchown);
|
|
68
|
+
fs4.lchown = chownFix(fs4.lchown);
|
|
69
|
+
fs4.chmod = chmodFix(fs4.chmod);
|
|
70
|
+
fs4.fchmod = chmodFix(fs4.fchmod);
|
|
71
|
+
fs4.lchmod = chmodFix(fs4.lchmod);
|
|
72
|
+
fs4.chownSync = chownFixSync(fs4.chownSync);
|
|
73
|
+
fs4.fchownSync = chownFixSync(fs4.fchownSync);
|
|
74
|
+
fs4.lchownSync = chownFixSync(fs4.lchownSync);
|
|
75
|
+
fs4.chmodSync = chmodFixSync(fs4.chmodSync);
|
|
76
|
+
fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
|
|
77
|
+
fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
|
|
78
|
+
fs4.stat = statFix(fs4.stat);
|
|
79
|
+
fs4.fstat = statFix(fs4.fstat);
|
|
80
|
+
fs4.lstat = statFix(fs4.lstat);
|
|
81
|
+
fs4.statSync = statFixSync(fs4.statSync);
|
|
82
|
+
fs4.fstatSync = statFixSync(fs4.fstatSync);
|
|
83
|
+
fs4.lstatSync = statFixSync(fs4.lstatSync);
|
|
84
|
+
if (fs4.chmod && !fs4.lchmod) {
|
|
85
|
+
fs4.lchmod = function(path4, mode, cb) {
|
|
93
86
|
if (cb)
|
|
94
87
|
process.nextTick(cb);
|
|
95
88
|
};
|
|
96
|
-
|
|
89
|
+
fs4.lchmodSync = function() {
|
|
97
90
|
};
|
|
98
91
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
92
|
+
if (fs4.chown && !fs4.lchown) {
|
|
93
|
+
fs4.lchown = function(path4, uid, gid, cb) {
|
|
101
94
|
if (cb)
|
|
102
95
|
process.nextTick(cb);
|
|
103
96
|
};
|
|
104
|
-
|
|
97
|
+
fs4.lchownSync = function() {
|
|
105
98
|
};
|
|
106
99
|
}
|
|
107
100
|
if (platform === "win32") {
|
|
108
|
-
|
|
101
|
+
fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
|
|
109
102
|
function rename(from, to, cb) {
|
|
110
103
|
var start = Date.now();
|
|
111
104
|
var backoff = 0;
|
|
112
105
|
fs$rename(from, to, function CB(er) {
|
|
113
106
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
114
107
|
setTimeout(function() {
|
|
115
|
-
|
|
108
|
+
fs4.stat(to, function(stater, st) {
|
|
116
109
|
if (stater && stater.code === "ENOENT")
|
|
117
110
|
fs$rename(from, to, CB);
|
|
118
111
|
else
|
|
@@ -130,9 +123,9 @@ var require_polyfills = __commonJS({
|
|
|
130
123
|
if (Object.setPrototypeOf)
|
|
131
124
|
Object.setPrototypeOf(rename, fs$rename);
|
|
132
125
|
return rename;
|
|
133
|
-
}(
|
|
126
|
+
}(fs4.rename);
|
|
134
127
|
}
|
|
135
|
-
|
|
128
|
+
fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
|
|
136
129
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
137
130
|
var callback;
|
|
138
131
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -140,23 +133,23 @@ var require_polyfills = __commonJS({
|
|
|
140
133
|
callback = function(er, _, __) {
|
|
141
134
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
142
135
|
eagCounter++;
|
|
143
|
-
return fs$read.call(
|
|
136
|
+
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
|
|
144
137
|
}
|
|
145
138
|
callback_.apply(this, arguments);
|
|
146
139
|
};
|
|
147
140
|
}
|
|
148
|
-
return fs$read.call(
|
|
141
|
+
return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
|
|
149
142
|
}
|
|
150
143
|
if (Object.setPrototypeOf)
|
|
151
144
|
Object.setPrototypeOf(read, fs$read);
|
|
152
145
|
return read;
|
|
153
|
-
}(
|
|
154
|
-
|
|
146
|
+
}(fs4.read);
|
|
147
|
+
fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
|
|
155
148
|
return function(fd, buffer, offset, length, position) {
|
|
156
149
|
var eagCounter = 0;
|
|
157
150
|
while (true) {
|
|
158
151
|
try {
|
|
159
|
-
return fs$readSync.call(
|
|
152
|
+
return fs$readSync.call(fs4, fd, buffer, offset, length, position);
|
|
160
153
|
} catch (er) {
|
|
161
154
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
162
155
|
eagCounter++;
|
|
@@ -166,11 +159,11 @@ var require_polyfills = __commonJS({
|
|
|
166
159
|
}
|
|
167
160
|
}
|
|
168
161
|
};
|
|
169
|
-
}(
|
|
170
|
-
function patchLchmod(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
162
|
+
}(fs4.readSync);
|
|
163
|
+
function patchLchmod(fs5) {
|
|
164
|
+
fs5.lchmod = function(path4, mode, callback) {
|
|
165
|
+
fs5.open(
|
|
166
|
+
path4,
|
|
174
167
|
constants.O_WRONLY | constants.O_SYMLINK,
|
|
175
168
|
mode,
|
|
176
169
|
function(err, fd) {
|
|
@@ -179,8 +172,8 @@ var require_polyfills = __commonJS({
|
|
|
179
172
|
callback(err);
|
|
180
173
|
return;
|
|
181
174
|
}
|
|
182
|
-
|
|
183
|
-
|
|
175
|
+
fs5.fchmod(fd, mode, function(err2) {
|
|
176
|
+
fs5.close(fd, function(err22) {
|
|
184
177
|
if (callback)
|
|
185
178
|
callback(err2 || err22);
|
|
186
179
|
});
|
|
@@ -188,68 +181,68 @@ var require_polyfills = __commonJS({
|
|
|
188
181
|
}
|
|
189
182
|
);
|
|
190
183
|
};
|
|
191
|
-
|
|
192
|
-
var fd =
|
|
184
|
+
fs5.lchmodSync = function(path4, mode) {
|
|
185
|
+
var fd = fs5.openSync(path4, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
193
186
|
var threw = true;
|
|
194
187
|
var ret;
|
|
195
188
|
try {
|
|
196
|
-
ret =
|
|
189
|
+
ret = fs5.fchmodSync(fd, mode);
|
|
197
190
|
threw = false;
|
|
198
191
|
} finally {
|
|
199
192
|
if (threw) {
|
|
200
193
|
try {
|
|
201
|
-
|
|
194
|
+
fs5.closeSync(fd);
|
|
202
195
|
} catch (er) {
|
|
203
196
|
}
|
|
204
197
|
} else {
|
|
205
|
-
|
|
198
|
+
fs5.closeSync(fd);
|
|
206
199
|
}
|
|
207
200
|
}
|
|
208
201
|
return ret;
|
|
209
202
|
};
|
|
210
203
|
}
|
|
211
|
-
function patchLutimes(
|
|
212
|
-
if (constants.hasOwnProperty("O_SYMLINK") &&
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
function patchLutimes(fs5) {
|
|
205
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
|
|
206
|
+
fs5.lutimes = function(path4, at, mt, cb) {
|
|
207
|
+
fs5.open(path4, constants.O_SYMLINK, function(er, fd) {
|
|
215
208
|
if (er) {
|
|
216
209
|
if (cb)
|
|
217
210
|
cb(er);
|
|
218
211
|
return;
|
|
219
212
|
}
|
|
220
|
-
|
|
221
|
-
|
|
213
|
+
fs5.futimes(fd, at, mt, function(er2) {
|
|
214
|
+
fs5.close(fd, function(er22) {
|
|
222
215
|
if (cb)
|
|
223
216
|
cb(er2 || er22);
|
|
224
217
|
});
|
|
225
218
|
});
|
|
226
219
|
});
|
|
227
220
|
};
|
|
228
|
-
|
|
229
|
-
var fd =
|
|
221
|
+
fs5.lutimesSync = function(path4, at, mt) {
|
|
222
|
+
var fd = fs5.openSync(path4, constants.O_SYMLINK);
|
|
230
223
|
var ret;
|
|
231
224
|
var threw = true;
|
|
232
225
|
try {
|
|
233
|
-
ret =
|
|
226
|
+
ret = fs5.futimesSync(fd, at, mt);
|
|
234
227
|
threw = false;
|
|
235
228
|
} finally {
|
|
236
229
|
if (threw) {
|
|
237
230
|
try {
|
|
238
|
-
|
|
231
|
+
fs5.closeSync(fd);
|
|
239
232
|
} catch (er) {
|
|
240
233
|
}
|
|
241
234
|
} else {
|
|
242
|
-
|
|
235
|
+
fs5.closeSync(fd);
|
|
243
236
|
}
|
|
244
237
|
}
|
|
245
238
|
return ret;
|
|
246
239
|
};
|
|
247
|
-
} else if (
|
|
248
|
-
|
|
240
|
+
} else if (fs5.futimes) {
|
|
241
|
+
fs5.lutimes = function(_a, _b, _c, cb) {
|
|
249
242
|
if (cb)
|
|
250
243
|
process.nextTick(cb);
|
|
251
244
|
};
|
|
252
|
-
|
|
245
|
+
fs5.lutimesSync = function() {
|
|
253
246
|
};
|
|
254
247
|
}
|
|
255
248
|
}
|
|
@@ -257,7 +250,7 @@ var require_polyfills = __commonJS({
|
|
|
257
250
|
if (!orig)
|
|
258
251
|
return orig;
|
|
259
252
|
return function(target, mode, cb) {
|
|
260
|
-
return orig.call(
|
|
253
|
+
return orig.call(fs4, target, mode, function(er) {
|
|
261
254
|
if (chownErOk(er))
|
|
262
255
|
er = null;
|
|
263
256
|
if (cb)
|
|
@@ -270,7 +263,7 @@ var require_polyfills = __commonJS({
|
|
|
270
263
|
return orig;
|
|
271
264
|
return function(target, mode) {
|
|
272
265
|
try {
|
|
273
|
-
return orig.call(
|
|
266
|
+
return orig.call(fs4, target, mode);
|
|
274
267
|
} catch (er) {
|
|
275
268
|
if (!chownErOk(er))
|
|
276
269
|
throw er;
|
|
@@ -281,7 +274,7 @@ var require_polyfills = __commonJS({
|
|
|
281
274
|
if (!orig)
|
|
282
275
|
return orig;
|
|
283
276
|
return function(target, uid, gid, cb) {
|
|
284
|
-
return orig.call(
|
|
277
|
+
return orig.call(fs4, target, uid, gid, function(er) {
|
|
285
278
|
if (chownErOk(er))
|
|
286
279
|
er = null;
|
|
287
280
|
if (cb)
|
|
@@ -294,7 +287,7 @@ var require_polyfills = __commonJS({
|
|
|
294
287
|
return orig;
|
|
295
288
|
return function(target, uid, gid) {
|
|
296
289
|
try {
|
|
297
|
-
return orig.call(
|
|
290
|
+
return orig.call(fs4, target, uid, gid);
|
|
298
291
|
} catch (er) {
|
|
299
292
|
if (!chownErOk(er))
|
|
300
293
|
throw er;
|
|
@@ -319,14 +312,14 @@ var require_polyfills = __commonJS({
|
|
|
319
312
|
if (cb)
|
|
320
313
|
cb.apply(this, arguments);
|
|
321
314
|
}
|
|
322
|
-
return options ? orig.call(
|
|
315
|
+
return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
|
|
323
316
|
};
|
|
324
317
|
}
|
|
325
318
|
function statFixSync(orig) {
|
|
326
319
|
if (!orig)
|
|
327
320
|
return orig;
|
|
328
321
|
return function(target, options) {
|
|
329
|
-
var stats = options ? orig.call(
|
|
322
|
+
var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
|
|
330
323
|
if (stats) {
|
|
331
324
|
if (stats.uid < 0)
|
|
332
325
|
stats.uid += 4294967296;
|
|
@@ -358,17 +351,17 @@ var require_legacy_streams = __commonJS({
|
|
|
358
351
|
"use strict";
|
|
359
352
|
var Stream = __require("stream").Stream;
|
|
360
353
|
module.exports = legacy;
|
|
361
|
-
function legacy(
|
|
354
|
+
function legacy(fs4) {
|
|
362
355
|
return {
|
|
363
356
|
ReadStream,
|
|
364
357
|
WriteStream
|
|
365
358
|
};
|
|
366
|
-
function ReadStream(
|
|
359
|
+
function ReadStream(path4, options) {
|
|
367
360
|
if (!(this instanceof ReadStream))
|
|
368
|
-
return new ReadStream(
|
|
361
|
+
return new ReadStream(path4, options);
|
|
369
362
|
Stream.call(this);
|
|
370
363
|
var self = this;
|
|
371
|
-
this.path =
|
|
364
|
+
this.path = path4;
|
|
372
365
|
this.fd = null;
|
|
373
366
|
this.readable = true;
|
|
374
367
|
this.paused = false;
|
|
@@ -403,7 +396,7 @@ var require_legacy_streams = __commonJS({
|
|
|
403
396
|
});
|
|
404
397
|
return;
|
|
405
398
|
}
|
|
406
|
-
|
|
399
|
+
fs4.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
407
400
|
if (err) {
|
|
408
401
|
self.emit("error", err);
|
|
409
402
|
self.readable = false;
|
|
@@ -414,11 +407,11 @@ var require_legacy_streams = __commonJS({
|
|
|
414
407
|
self._read();
|
|
415
408
|
});
|
|
416
409
|
}
|
|
417
|
-
function WriteStream(
|
|
410
|
+
function WriteStream(path4, options) {
|
|
418
411
|
if (!(this instanceof WriteStream))
|
|
419
|
-
return new WriteStream(
|
|
412
|
+
return new WriteStream(path4, options);
|
|
420
413
|
Stream.call(this);
|
|
421
|
-
this.path =
|
|
414
|
+
this.path = path4;
|
|
422
415
|
this.fd = null;
|
|
423
416
|
this.writable = true;
|
|
424
417
|
this.flags = "w";
|
|
@@ -443,7 +436,7 @@ var require_legacy_streams = __commonJS({
|
|
|
443
436
|
this.busy = false;
|
|
444
437
|
this._queue = [];
|
|
445
438
|
if (this.fd === null) {
|
|
446
|
-
this._open =
|
|
439
|
+
this._open = fs4.open;
|
|
447
440
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
448
441
|
this.flush();
|
|
449
442
|
}
|
|
@@ -479,7 +472,7 @@ var require_clone = __commonJS({
|
|
|
479
472
|
var require_graceful_fs = __commonJS({
|
|
480
473
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
481
474
|
"use strict";
|
|
482
|
-
var
|
|
475
|
+
var fs4 = __require("fs");
|
|
483
476
|
var polyfills = require_polyfills();
|
|
484
477
|
var legacy = require_legacy_streams();
|
|
485
478
|
var clone = require_clone();
|
|
@@ -502,21 +495,21 @@ var require_graceful_fs = __commonJS({
|
|
|
502
495
|
}
|
|
503
496
|
});
|
|
504
497
|
}
|
|
505
|
-
var
|
|
498
|
+
var debug3 = noop;
|
|
506
499
|
if (util.debuglog)
|
|
507
|
-
|
|
500
|
+
debug3 = util.debuglog("gfs4");
|
|
508
501
|
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
509
|
-
|
|
502
|
+
debug3 = function() {
|
|
510
503
|
var m = util.format.apply(util, arguments);
|
|
511
504
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
512
505
|
console.error(m);
|
|
513
506
|
};
|
|
514
|
-
if (!
|
|
507
|
+
if (!fs4[gracefulQueue]) {
|
|
515
508
|
queue = global[gracefulQueue] || [];
|
|
516
|
-
publishQueue(
|
|
517
|
-
|
|
509
|
+
publishQueue(fs4, queue);
|
|
510
|
+
fs4.close = function(fs$close) {
|
|
518
511
|
function close(fd, cb) {
|
|
519
|
-
return fs$close.call(
|
|
512
|
+
return fs$close.call(fs4, fd, function(err) {
|
|
520
513
|
if (!err) {
|
|
521
514
|
resetQueue();
|
|
522
515
|
}
|
|
@@ -528,48 +521,48 @@ var require_graceful_fs = __commonJS({
|
|
|
528
521
|
value: fs$close
|
|
529
522
|
});
|
|
530
523
|
return close;
|
|
531
|
-
}(
|
|
532
|
-
|
|
524
|
+
}(fs4.close);
|
|
525
|
+
fs4.closeSync = function(fs$closeSync) {
|
|
533
526
|
function closeSync(fd) {
|
|
534
|
-
fs$closeSync.apply(
|
|
527
|
+
fs$closeSync.apply(fs4, arguments);
|
|
535
528
|
resetQueue();
|
|
536
529
|
}
|
|
537
530
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
538
531
|
value: fs$closeSync
|
|
539
532
|
});
|
|
540
533
|
return closeSync;
|
|
541
|
-
}(
|
|
534
|
+
}(fs4.closeSync);
|
|
542
535
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
543
536
|
process.on("exit", function() {
|
|
544
|
-
|
|
545
|
-
__require("assert").equal(
|
|
537
|
+
debug3(fs4[gracefulQueue]);
|
|
538
|
+
__require("assert").equal(fs4[gracefulQueue].length, 0);
|
|
546
539
|
});
|
|
547
540
|
}
|
|
548
541
|
}
|
|
549
542
|
var queue;
|
|
550
543
|
if (!global[gracefulQueue]) {
|
|
551
|
-
publishQueue(global,
|
|
552
|
-
}
|
|
553
|
-
module.exports = patch(clone(
|
|
554
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
555
|
-
module.exports = patch(
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
function patch(
|
|
559
|
-
polyfills(
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
var fs$readFile =
|
|
564
|
-
|
|
565
|
-
function readFile(
|
|
544
|
+
publishQueue(global, fs4[gracefulQueue]);
|
|
545
|
+
}
|
|
546
|
+
module.exports = patch(clone(fs4));
|
|
547
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
|
|
548
|
+
module.exports = patch(fs4);
|
|
549
|
+
fs4.__patched = true;
|
|
550
|
+
}
|
|
551
|
+
function patch(fs5) {
|
|
552
|
+
polyfills(fs5);
|
|
553
|
+
fs5.gracefulify = patch;
|
|
554
|
+
fs5.createReadStream = createReadStream;
|
|
555
|
+
fs5.createWriteStream = createWriteStream;
|
|
556
|
+
var fs$readFile = fs5.readFile;
|
|
557
|
+
fs5.readFile = readFile;
|
|
558
|
+
function readFile(path4, options, cb) {
|
|
566
559
|
if (typeof options === "function")
|
|
567
560
|
cb = options, options = null;
|
|
568
|
-
return go$readFile(
|
|
569
|
-
function go$readFile(
|
|
570
|
-
return fs$readFile(
|
|
561
|
+
return go$readFile(path4, options, cb);
|
|
562
|
+
function go$readFile(path5, options2, cb2, startTime) {
|
|
563
|
+
return fs$readFile(path5, options2, function(err) {
|
|
571
564
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
572
|
-
enqueue([go$readFile, [
|
|
565
|
+
enqueue([go$readFile, [path5, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
573
566
|
else {
|
|
574
567
|
if (typeof cb2 === "function")
|
|
575
568
|
cb2.apply(this, arguments);
|
|
@@ -577,16 +570,16 @@ var require_graceful_fs = __commonJS({
|
|
|
577
570
|
});
|
|
578
571
|
}
|
|
579
572
|
}
|
|
580
|
-
var fs$writeFile =
|
|
581
|
-
|
|
582
|
-
function writeFile2(
|
|
573
|
+
var fs$writeFile = fs5.writeFile;
|
|
574
|
+
fs5.writeFile = writeFile2;
|
|
575
|
+
function writeFile2(path4, data, options, cb) {
|
|
583
576
|
if (typeof options === "function")
|
|
584
577
|
cb = options, options = null;
|
|
585
|
-
return go$writeFile(
|
|
586
|
-
function go$writeFile(
|
|
587
|
-
return fs$writeFile(
|
|
578
|
+
return go$writeFile(path4, data, options, cb);
|
|
579
|
+
function go$writeFile(path5, data2, options2, cb2, startTime) {
|
|
580
|
+
return fs$writeFile(path5, data2, options2, function(err) {
|
|
588
581
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
589
|
-
enqueue([go$writeFile, [
|
|
582
|
+
enqueue([go$writeFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
590
583
|
else {
|
|
591
584
|
if (typeof cb2 === "function")
|
|
592
585
|
cb2.apply(this, arguments);
|
|
@@ -594,17 +587,17 @@ var require_graceful_fs = __commonJS({
|
|
|
594
587
|
});
|
|
595
588
|
}
|
|
596
589
|
}
|
|
597
|
-
var fs$appendFile =
|
|
590
|
+
var fs$appendFile = fs5.appendFile;
|
|
598
591
|
if (fs$appendFile)
|
|
599
|
-
|
|
600
|
-
function appendFile(
|
|
592
|
+
fs5.appendFile = appendFile;
|
|
593
|
+
function appendFile(path4, data, options, cb) {
|
|
601
594
|
if (typeof options === "function")
|
|
602
595
|
cb = options, options = null;
|
|
603
|
-
return go$appendFile(
|
|
604
|
-
function go$appendFile(
|
|
605
|
-
return fs$appendFile(
|
|
596
|
+
return go$appendFile(path4, data, options, cb);
|
|
597
|
+
function go$appendFile(path5, data2, options2, cb2, startTime) {
|
|
598
|
+
return fs$appendFile(path5, data2, options2, function(err) {
|
|
606
599
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
607
|
-
enqueue([go$appendFile, [
|
|
600
|
+
enqueue([go$appendFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
608
601
|
else {
|
|
609
602
|
if (typeof cb2 === "function")
|
|
610
603
|
cb2.apply(this, arguments);
|
|
@@ -612,9 +605,9 @@ var require_graceful_fs = __commonJS({
|
|
|
612
605
|
});
|
|
613
606
|
}
|
|
614
607
|
}
|
|
615
|
-
var fs$copyFile =
|
|
608
|
+
var fs$copyFile = fs5.copyFile;
|
|
616
609
|
if (fs$copyFile)
|
|
617
|
-
|
|
610
|
+
fs5.copyFile = copyFile;
|
|
618
611
|
function copyFile(src, dest, flags, cb) {
|
|
619
612
|
if (typeof flags === "function") {
|
|
620
613
|
cb = flags;
|
|
@@ -632,34 +625,34 @@ var require_graceful_fs = __commonJS({
|
|
|
632
625
|
});
|
|
633
626
|
}
|
|
634
627
|
}
|
|
635
|
-
var fs$readdir =
|
|
636
|
-
|
|
628
|
+
var fs$readdir = fs5.readdir;
|
|
629
|
+
fs5.readdir = readdir;
|
|
637
630
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
638
|
-
function readdir(
|
|
631
|
+
function readdir(path4, options, cb) {
|
|
639
632
|
if (typeof options === "function")
|
|
640
633
|
cb = options, options = null;
|
|
641
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
642
|
-
return fs$readdir(
|
|
643
|
-
|
|
634
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path5, options2, cb2, startTime) {
|
|
635
|
+
return fs$readdir(path5, fs$readdirCallback(
|
|
636
|
+
path5,
|
|
644
637
|
options2,
|
|
645
638
|
cb2,
|
|
646
639
|
startTime
|
|
647
640
|
));
|
|
648
|
-
} : function go$readdir2(
|
|
649
|
-
return fs$readdir(
|
|
650
|
-
|
|
641
|
+
} : function go$readdir2(path5, options2, cb2, startTime) {
|
|
642
|
+
return fs$readdir(path5, options2, fs$readdirCallback(
|
|
643
|
+
path5,
|
|
651
644
|
options2,
|
|
652
645
|
cb2,
|
|
653
646
|
startTime
|
|
654
647
|
));
|
|
655
648
|
};
|
|
656
|
-
return go$readdir(
|
|
657
|
-
function fs$readdirCallback(
|
|
649
|
+
return go$readdir(path4, options, cb);
|
|
650
|
+
function fs$readdirCallback(path5, options2, cb2, startTime) {
|
|
658
651
|
return function(err, files) {
|
|
659
652
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
660
653
|
enqueue([
|
|
661
654
|
go$readdir,
|
|
662
|
-
[
|
|
655
|
+
[path5, options2, cb2],
|
|
663
656
|
err,
|
|
664
657
|
startTime || Date.now(),
|
|
665
658
|
Date.now()
|
|
@@ -674,21 +667,21 @@ var require_graceful_fs = __commonJS({
|
|
|
674
667
|
}
|
|
675
668
|
}
|
|
676
669
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
677
|
-
var legStreams = legacy(
|
|
670
|
+
var legStreams = legacy(fs5);
|
|
678
671
|
ReadStream = legStreams.ReadStream;
|
|
679
672
|
WriteStream = legStreams.WriteStream;
|
|
680
673
|
}
|
|
681
|
-
var fs$ReadStream =
|
|
674
|
+
var fs$ReadStream = fs5.ReadStream;
|
|
682
675
|
if (fs$ReadStream) {
|
|
683
676
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
684
677
|
ReadStream.prototype.open = ReadStream$open;
|
|
685
678
|
}
|
|
686
|
-
var fs$WriteStream =
|
|
679
|
+
var fs$WriteStream = fs5.WriteStream;
|
|
687
680
|
if (fs$WriteStream) {
|
|
688
681
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
689
682
|
WriteStream.prototype.open = WriteStream$open;
|
|
690
683
|
}
|
|
691
|
-
Object.defineProperty(
|
|
684
|
+
Object.defineProperty(fs5, "ReadStream", {
|
|
692
685
|
get: function() {
|
|
693
686
|
return ReadStream;
|
|
694
687
|
},
|
|
@@ -698,7 +691,7 @@ var require_graceful_fs = __commonJS({
|
|
|
698
691
|
enumerable: true,
|
|
699
692
|
configurable: true
|
|
700
693
|
});
|
|
701
|
-
Object.defineProperty(
|
|
694
|
+
Object.defineProperty(fs5, "WriteStream", {
|
|
702
695
|
get: function() {
|
|
703
696
|
return WriteStream;
|
|
704
697
|
},
|
|
@@ -709,7 +702,7 @@ var require_graceful_fs = __commonJS({
|
|
|
709
702
|
configurable: true
|
|
710
703
|
});
|
|
711
704
|
var FileReadStream = ReadStream;
|
|
712
|
-
Object.defineProperty(
|
|
705
|
+
Object.defineProperty(fs5, "FileReadStream", {
|
|
713
706
|
get: function() {
|
|
714
707
|
return FileReadStream;
|
|
715
708
|
},
|
|
@@ -720,7 +713,7 @@ var require_graceful_fs = __commonJS({
|
|
|
720
713
|
configurable: true
|
|
721
714
|
});
|
|
722
715
|
var FileWriteStream = WriteStream;
|
|
723
|
-
Object.defineProperty(
|
|
716
|
+
Object.defineProperty(fs5, "FileWriteStream", {
|
|
724
717
|
get: function() {
|
|
725
718
|
return FileWriteStream;
|
|
726
719
|
},
|
|
@@ -730,7 +723,7 @@ var require_graceful_fs = __commonJS({
|
|
|
730
723
|
enumerable: true,
|
|
731
724
|
configurable: true
|
|
732
725
|
});
|
|
733
|
-
function ReadStream(
|
|
726
|
+
function ReadStream(path4, options) {
|
|
734
727
|
if (this instanceof ReadStream)
|
|
735
728
|
return fs$ReadStream.apply(this, arguments), this;
|
|
736
729
|
else
|
|
@@ -738,7 +731,7 @@ var require_graceful_fs = __commonJS({
|
|
|
738
731
|
}
|
|
739
732
|
function ReadStream$open() {
|
|
740
733
|
var that = this;
|
|
741
|
-
|
|
734
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
742
735
|
if (err) {
|
|
743
736
|
if (that.autoClose)
|
|
744
737
|
that.destroy();
|
|
@@ -750,7 +743,7 @@ var require_graceful_fs = __commonJS({
|
|
|
750
743
|
}
|
|
751
744
|
});
|
|
752
745
|
}
|
|
753
|
-
function WriteStream(
|
|
746
|
+
function WriteStream(path4, options) {
|
|
754
747
|
if (this instanceof WriteStream)
|
|
755
748
|
return fs$WriteStream.apply(this, arguments), this;
|
|
756
749
|
else
|
|
@@ -758,7 +751,7 @@ var require_graceful_fs = __commonJS({
|
|
|
758
751
|
}
|
|
759
752
|
function WriteStream$open() {
|
|
760
753
|
var that = this;
|
|
761
|
-
|
|
754
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
762
755
|
if (err) {
|
|
763
756
|
that.destroy();
|
|
764
757
|
that.emit("error", err);
|
|
@@ -768,22 +761,22 @@ var require_graceful_fs = __commonJS({
|
|
|
768
761
|
}
|
|
769
762
|
});
|
|
770
763
|
}
|
|
771
|
-
function createReadStream(
|
|
772
|
-
return new
|
|
764
|
+
function createReadStream(path4, options) {
|
|
765
|
+
return new fs5.ReadStream(path4, options);
|
|
773
766
|
}
|
|
774
|
-
function createWriteStream(
|
|
775
|
-
return new
|
|
767
|
+
function createWriteStream(path4, options) {
|
|
768
|
+
return new fs5.WriteStream(path4, options);
|
|
776
769
|
}
|
|
777
|
-
var fs$open =
|
|
778
|
-
|
|
779
|
-
function
|
|
770
|
+
var fs$open = fs5.open;
|
|
771
|
+
fs5.open = open2;
|
|
772
|
+
function open2(path4, flags, mode, cb) {
|
|
780
773
|
if (typeof mode === "function")
|
|
781
774
|
cb = mode, mode = null;
|
|
782
|
-
return go$open(
|
|
783
|
-
function go$open(
|
|
784
|
-
return fs$open(
|
|
775
|
+
return go$open(path4, flags, mode, cb);
|
|
776
|
+
function go$open(path5, flags2, mode2, cb2, startTime) {
|
|
777
|
+
return fs$open(path5, flags2, mode2, function(err, fd) {
|
|
785
778
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
786
|
-
enqueue([go$open, [
|
|
779
|
+
enqueue([go$open, [path5, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
787
780
|
else {
|
|
788
781
|
if (typeof cb2 === "function")
|
|
789
782
|
cb2.apply(this, arguments);
|
|
@@ -791,20 +784,20 @@ var require_graceful_fs = __commonJS({
|
|
|
791
784
|
});
|
|
792
785
|
}
|
|
793
786
|
}
|
|
794
|
-
return
|
|
787
|
+
return fs5;
|
|
795
788
|
}
|
|
796
789
|
function enqueue(elem) {
|
|
797
|
-
|
|
798
|
-
|
|
790
|
+
debug3("ENQUEUE", elem[0].name, elem[1]);
|
|
791
|
+
fs4[gracefulQueue].push(elem);
|
|
799
792
|
retry();
|
|
800
793
|
}
|
|
801
794
|
var retryTimer;
|
|
802
795
|
function resetQueue() {
|
|
803
796
|
var now = Date.now();
|
|
804
|
-
for (var i = 0; i <
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
|
|
797
|
+
for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
|
|
798
|
+
if (fs4[gracefulQueue][i].length > 2) {
|
|
799
|
+
fs4[gracefulQueue][i][3] = now;
|
|
800
|
+
fs4[gracefulQueue][i][4] = now;
|
|
808
801
|
}
|
|
809
802
|
}
|
|
810
803
|
retry();
|
|
@@ -812,19 +805,19 @@ var require_graceful_fs = __commonJS({
|
|
|
812
805
|
function retry() {
|
|
813
806
|
clearTimeout(retryTimer);
|
|
814
807
|
retryTimer = void 0;
|
|
815
|
-
if (
|
|
808
|
+
if (fs4[gracefulQueue].length === 0)
|
|
816
809
|
return;
|
|
817
|
-
var elem =
|
|
810
|
+
var elem = fs4[gracefulQueue].shift();
|
|
818
811
|
var fn = elem[0];
|
|
819
812
|
var args = elem[1];
|
|
820
813
|
var err = elem[2];
|
|
821
814
|
var startTime = elem[3];
|
|
822
815
|
var lastTime = elem[4];
|
|
823
816
|
if (startTime === void 0) {
|
|
824
|
-
|
|
817
|
+
debug3("RETRY", fn.name, args);
|
|
825
818
|
fn.apply(null, args);
|
|
826
819
|
} else if (Date.now() - startTime >= 6e4) {
|
|
827
|
-
|
|
820
|
+
debug3("TIMEOUT", fn.name, args);
|
|
828
821
|
var cb = args.pop();
|
|
829
822
|
if (typeof cb === "function")
|
|
830
823
|
cb.call(null, err);
|
|
@@ -833,10 +826,10 @@ var require_graceful_fs = __commonJS({
|
|
|
833
826
|
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
834
827
|
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
835
828
|
if (sinceAttempt >= desiredDelay) {
|
|
836
|
-
|
|
829
|
+
debug3("RETRY", fn.name, args);
|
|
837
830
|
fn.apply(null, args.concat([startTime]));
|
|
838
831
|
} else {
|
|
839
|
-
|
|
832
|
+
fs4[gracefulQueue].push(elem);
|
|
840
833
|
}
|
|
841
834
|
}
|
|
842
835
|
if (retryTimer === void 0) {
|
|
@@ -1276,10 +1269,10 @@ var require_mtime_precision = __commonJS({
|
|
|
1276
1269
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
1277
1270
|
"use strict";
|
|
1278
1271
|
var cacheSymbol = Symbol();
|
|
1279
|
-
function probe(file,
|
|
1280
|
-
const cachedPrecision =
|
|
1272
|
+
function probe(file, fs4, callback) {
|
|
1273
|
+
const cachedPrecision = fs4[cacheSymbol];
|
|
1281
1274
|
if (cachedPrecision) {
|
|
1282
|
-
return
|
|
1275
|
+
return fs4.stat(file, (err, stat) => {
|
|
1283
1276
|
if (err) {
|
|
1284
1277
|
return callback(err);
|
|
1285
1278
|
}
|
|
@@ -1287,16 +1280,16 @@ var require_mtime_precision = __commonJS({
|
|
|
1287
1280
|
});
|
|
1288
1281
|
}
|
|
1289
1282
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
1290
|
-
|
|
1283
|
+
fs4.utimes(file, mtime, mtime, (err) => {
|
|
1291
1284
|
if (err) {
|
|
1292
1285
|
return callback(err);
|
|
1293
1286
|
}
|
|
1294
|
-
|
|
1287
|
+
fs4.stat(file, (err2, stat) => {
|
|
1295
1288
|
if (err2) {
|
|
1296
1289
|
return callback(err2);
|
|
1297
1290
|
}
|
|
1298
1291
|
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1299
|
-
Object.defineProperty(
|
|
1292
|
+
Object.defineProperty(fs4, cacheSymbol, { value: precision });
|
|
1300
1293
|
callback(null, stat.mtime, precision);
|
|
1301
1294
|
});
|
|
1302
1295
|
});
|
|
@@ -1317,8 +1310,8 @@ var require_mtime_precision = __commonJS({
|
|
|
1317
1310
|
var require_lockfile = __commonJS({
|
|
1318
1311
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1319
1312
|
"use strict";
|
|
1320
|
-
var
|
|
1321
|
-
var
|
|
1313
|
+
var path4 = __require("path");
|
|
1314
|
+
var fs4 = require_graceful_fs();
|
|
1322
1315
|
var retry = require_retry2();
|
|
1323
1316
|
var onExit = require_signal_exit();
|
|
1324
1317
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -1328,7 +1321,7 @@ var require_lockfile = __commonJS({
|
|
|
1328
1321
|
}
|
|
1329
1322
|
function resolveCanonicalPath(file, options, callback) {
|
|
1330
1323
|
if (!options.realpath) {
|
|
1331
|
-
return callback(null,
|
|
1324
|
+
return callback(null, path4.resolve(file));
|
|
1332
1325
|
}
|
|
1333
1326
|
options.fs.realpath(file, callback);
|
|
1334
1327
|
}
|
|
@@ -1449,7 +1442,7 @@ var require_lockfile = __commonJS({
|
|
|
1449
1442
|
update: null,
|
|
1450
1443
|
realpath: true,
|
|
1451
1444
|
retries: 0,
|
|
1452
|
-
fs:
|
|
1445
|
+
fs: fs4,
|
|
1453
1446
|
onCompromised: (err) => {
|
|
1454
1447
|
throw err;
|
|
1455
1448
|
},
|
|
@@ -1493,7 +1486,7 @@ var require_lockfile = __commonJS({
|
|
|
1493
1486
|
}
|
|
1494
1487
|
function unlock2(file, options, callback) {
|
|
1495
1488
|
options = {
|
|
1496
|
-
fs:
|
|
1489
|
+
fs: fs4,
|
|
1497
1490
|
realpath: true,
|
|
1498
1491
|
...options
|
|
1499
1492
|
};
|
|
@@ -1515,7 +1508,7 @@ var require_lockfile = __commonJS({
|
|
|
1515
1508
|
options = {
|
|
1516
1509
|
stale: 1e4,
|
|
1517
1510
|
realpath: true,
|
|
1518
|
-
fs:
|
|
1511
|
+
fs: fs4,
|
|
1519
1512
|
...options
|
|
1520
1513
|
};
|
|
1521
1514
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -1554,16 +1547,16 @@ var require_lockfile = __commonJS({
|
|
|
1554
1547
|
var require_adapter = __commonJS({
|
|
1555
1548
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
1556
1549
|
"use strict";
|
|
1557
|
-
var
|
|
1558
|
-
function createSyncFs(
|
|
1550
|
+
var fs4 = require_graceful_fs();
|
|
1551
|
+
function createSyncFs(fs5) {
|
|
1559
1552
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1560
|
-
const newFs = { ...
|
|
1553
|
+
const newFs = { ...fs5 };
|
|
1561
1554
|
methods.forEach((method) => {
|
|
1562
1555
|
newFs[method] = (...args) => {
|
|
1563
1556
|
const callback = args.pop();
|
|
1564
1557
|
let ret;
|
|
1565
1558
|
try {
|
|
1566
|
-
ret =
|
|
1559
|
+
ret = fs5[`${method}Sync`](...args);
|
|
1567
1560
|
} catch (err) {
|
|
1568
1561
|
return callback(err);
|
|
1569
1562
|
}
|
|
@@ -1601,7 +1594,7 @@ var require_adapter = __commonJS({
|
|
|
1601
1594
|
}
|
|
1602
1595
|
function toSyncOptions(options) {
|
|
1603
1596
|
options = { ...options };
|
|
1604
|
-
options.fs = createSyncFs(options.fs ||
|
|
1597
|
+
options.fs = createSyncFs(options.fs || fs4);
|
|
1605
1598
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
1606
1599
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
1607
1600
|
}
|
|
@@ -1665,65 +1658,65 @@ function normalizeWindowsPath(input2 = "") {
|
|
|
1665
1658
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
1666
1659
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
1667
1660
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
1668
|
-
var normalize = function(
|
|
1669
|
-
if (
|
|
1661
|
+
var normalize = function(path4) {
|
|
1662
|
+
if (path4.length === 0) {
|
|
1670
1663
|
return ".";
|
|
1671
1664
|
}
|
|
1672
|
-
|
|
1673
|
-
const isUNCPath =
|
|
1674
|
-
const isPathAbsolute = isAbsolute(
|
|
1675
|
-
const trailingSeparator =
|
|
1676
|
-
|
|
1677
|
-
if (
|
|
1665
|
+
path4 = normalizeWindowsPath(path4);
|
|
1666
|
+
const isUNCPath = path4.match(_UNC_REGEX);
|
|
1667
|
+
const isPathAbsolute = isAbsolute(path4);
|
|
1668
|
+
const trailingSeparator = path4[path4.length - 1] === "/";
|
|
1669
|
+
path4 = normalizeString(path4, !isPathAbsolute);
|
|
1670
|
+
if (path4.length === 0) {
|
|
1678
1671
|
if (isPathAbsolute) {
|
|
1679
1672
|
return "/";
|
|
1680
1673
|
}
|
|
1681
1674
|
return trailingSeparator ? "./" : ".";
|
|
1682
1675
|
}
|
|
1683
1676
|
if (trailingSeparator) {
|
|
1684
|
-
|
|
1677
|
+
path4 += "/";
|
|
1685
1678
|
}
|
|
1686
|
-
if (_DRIVE_LETTER_RE.test(
|
|
1687
|
-
|
|
1679
|
+
if (_DRIVE_LETTER_RE.test(path4)) {
|
|
1680
|
+
path4 += "/";
|
|
1688
1681
|
}
|
|
1689
1682
|
if (isUNCPath) {
|
|
1690
1683
|
if (!isPathAbsolute) {
|
|
1691
|
-
return `//./${
|
|
1684
|
+
return `//./${path4}`;
|
|
1692
1685
|
}
|
|
1693
|
-
return `//${
|
|
1686
|
+
return `//${path4}`;
|
|
1694
1687
|
}
|
|
1695
|
-
return isPathAbsolute && !isAbsolute(
|
|
1688
|
+
return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
|
|
1696
1689
|
};
|
|
1697
1690
|
var join = function(...segments) {
|
|
1698
|
-
let
|
|
1691
|
+
let path4 = "";
|
|
1699
1692
|
for (const seg of segments) {
|
|
1700
1693
|
if (!seg) {
|
|
1701
1694
|
continue;
|
|
1702
1695
|
}
|
|
1703
|
-
if (
|
|
1704
|
-
const pathTrailing =
|
|
1696
|
+
if (path4.length > 0) {
|
|
1697
|
+
const pathTrailing = path4[path4.length - 1] === "/";
|
|
1705
1698
|
const segLeading = seg[0] === "/";
|
|
1706
1699
|
const both = pathTrailing && segLeading;
|
|
1707
1700
|
if (both) {
|
|
1708
|
-
|
|
1701
|
+
path4 += seg.slice(1);
|
|
1709
1702
|
} else {
|
|
1710
|
-
|
|
1703
|
+
path4 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
1711
1704
|
}
|
|
1712
1705
|
} else {
|
|
1713
|
-
|
|
1706
|
+
path4 += seg;
|
|
1714
1707
|
}
|
|
1715
1708
|
}
|
|
1716
|
-
return normalize(
|
|
1709
|
+
return normalize(path4);
|
|
1717
1710
|
};
|
|
1718
|
-
function normalizeString(
|
|
1711
|
+
function normalizeString(path4, allowAboveRoot) {
|
|
1719
1712
|
let res = "";
|
|
1720
1713
|
let lastSegmentLength = 0;
|
|
1721
1714
|
let lastSlash = -1;
|
|
1722
1715
|
let dots = 0;
|
|
1723
1716
|
let char = null;
|
|
1724
|
-
for (let index = 0; index <=
|
|
1725
|
-
if (index <
|
|
1726
|
-
char =
|
|
1717
|
+
for (let index = 0; index <= path4.length; ++index) {
|
|
1718
|
+
if (index < path4.length) {
|
|
1719
|
+
char = path4[index];
|
|
1727
1720
|
} else if (char === "/") {
|
|
1728
1721
|
break;
|
|
1729
1722
|
} else {
|
|
@@ -1760,9 +1753,9 @@ function normalizeString(path3, allowAboveRoot) {
|
|
|
1760
1753
|
}
|
|
1761
1754
|
} else {
|
|
1762
1755
|
if (res.length > 0) {
|
|
1763
|
-
res += `/${
|
|
1756
|
+
res += `/${path4.slice(lastSlash + 1, index)}`;
|
|
1764
1757
|
} else {
|
|
1765
|
-
res =
|
|
1758
|
+
res = path4.slice(lastSlash + 1, index);
|
|
1766
1759
|
}
|
|
1767
1760
|
lastSegmentLength = index - lastSlash - 1;
|
|
1768
1761
|
}
|
|
@@ -1783,8 +1776,8 @@ var isAbsolute = function(p) {
|
|
|
1783
1776
|
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/utils.mjs
|
|
1784
1777
|
var normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
|
|
1785
1778
|
var SLASH_RE = /[/\\]/;
|
|
1786
|
-
function filename(
|
|
1787
|
-
const base =
|
|
1779
|
+
function filename(path4) {
|
|
1780
|
+
const base = path4.split(SLASH_RE).pop();
|
|
1788
1781
|
if (!base) {
|
|
1789
1782
|
return void 0;
|
|
1790
1783
|
}
|
|
@@ -2279,9 +2272,9 @@ var DEFAULT_SHADOW_DATABASE_PORT = 51215;
|
|
|
2279
2272
|
var MAX_PORT = 65535;
|
|
2280
2273
|
var NO_PORT = -Infinity;
|
|
2281
2274
|
async function pickPorts(options) {
|
|
2282
|
-
const { debug, name, requestedPorts, servers } = options;
|
|
2275
|
+
const { debug: debug3, name, requestedPorts, servers } = options;
|
|
2283
2276
|
const { portsUsedByOtherServers, portsUsedByThisServerLastTime } = extractUsedPorts(name, servers);
|
|
2284
|
-
if (
|
|
2277
|
+
if (debug3) {
|
|
2285
2278
|
console.debug(`ports used by other servers: ${Object.keys(portsUsedByOtherServers).join(", ")}`);
|
|
2286
2279
|
console.debug(`ports used by "${name}" server last time: ${JSON.stringify(portsUsedByThisServerLastTime)}`);
|
|
2287
2280
|
}
|
|
@@ -2289,39 +2282,39 @@ async function pickPorts(options) {
|
|
|
2289
2282
|
const portKeys = ["port", "databasePort", "shadowDatabasePort"];
|
|
2290
2283
|
for (const portKey of portKeys) {
|
|
2291
2284
|
const port = await trySpecificPorts({
|
|
2292
|
-
debug,
|
|
2285
|
+
debug: debug3,
|
|
2293
2286
|
portKey,
|
|
2294
2287
|
portsUsedByOtherServers,
|
|
2295
2288
|
portsUsedByThisServerLastTime,
|
|
2296
2289
|
requestedPorts
|
|
2297
|
-
}) ?? await tryAnyPort({ debug, pickedPorts, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime });
|
|
2298
|
-
if (
|
|
2290
|
+
}) ?? await tryAnyPort({ debug: debug3, pickedPorts, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime });
|
|
2291
|
+
if (debug3) {
|
|
2299
2292
|
console.debug(`Got port for "${portKey}": ${port}`);
|
|
2300
2293
|
}
|
|
2301
2294
|
pickedPorts[portKey] = port;
|
|
2302
2295
|
}
|
|
2303
|
-
if (
|
|
2296
|
+
if (debug3) {
|
|
2304
2297
|
console.debug(`Picked ports: ${JSON.stringify(pickedPorts)}`);
|
|
2305
2298
|
}
|
|
2306
2299
|
return pickedPorts;
|
|
2307
2300
|
}
|
|
2308
2301
|
async function trySpecificPorts(options) {
|
|
2309
|
-
const { debug, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime, requestedPorts } = options;
|
|
2302
|
+
const { debug: debug3, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime, requestedPorts } = options;
|
|
2310
2303
|
const { [portKey]: requestedPort, ...otherRequestedPorts } = requestedPorts;
|
|
2311
2304
|
if (isPortSpecified(requestedPort)) {
|
|
2312
|
-
await assertPickablePort({ debug, otherRequestedPorts, portKey, portsUsedByOtherServers, requestedPort });
|
|
2305
|
+
await assertPickablePort({ debug: debug3, otherRequestedPorts, portKey, portsUsedByOtherServers, requestedPort });
|
|
2313
2306
|
return requestedPort;
|
|
2314
2307
|
}
|
|
2315
2308
|
const portUsedLastTime = portsUsedByThisServerLastTime?.[portKey] ?? NO_PORT;
|
|
2316
2309
|
if (!isPortSpecified(portUsedLastTime)) {
|
|
2317
|
-
if (
|
|
2310
|
+
if (debug3) {
|
|
2318
2311
|
console.debug(`No port specified for "${portKey}". Trying to pick a new port.`);
|
|
2319
2312
|
}
|
|
2320
2313
|
return null;
|
|
2321
2314
|
}
|
|
2322
2315
|
const isPortUsedByOtherServers = portUsedLastTime in portsUsedByOtherServers;
|
|
2323
2316
|
if (isPortUsedByOtherServers || Object.values(otherRequestedPorts).includes(portUsedLastTime)) {
|
|
2324
|
-
if (
|
|
2317
|
+
if (debug3) {
|
|
2325
2318
|
console.debug(
|
|
2326
2319
|
`Port ${portUsedLastTime} that was used last time for this server, ${isPortUsedByOtherServers ? "is also used by another server" : "has been requested for another service"}. Trying to pick a new port.`
|
|
2327
2320
|
);
|
|
@@ -2329,20 +2322,20 @@ async function trySpecificPorts(options) {
|
|
|
2329
2322
|
return null;
|
|
2330
2323
|
}
|
|
2331
2324
|
if (await checkPort(portUsedLastTime) === false) {
|
|
2332
|
-
if (
|
|
2325
|
+
if (debug3) {
|
|
2333
2326
|
console.debug(
|
|
2334
2327
|
`Port ${portUsedLastTime}, that was used last time for this server, is not available. Trying to pick a new port.`
|
|
2335
2328
|
);
|
|
2336
2329
|
}
|
|
2337
2330
|
return null;
|
|
2338
2331
|
}
|
|
2339
|
-
if (
|
|
2332
|
+
if (debug3) {
|
|
2340
2333
|
console.debug(`Using port ${portUsedLastTime} for "${portKey}" as it was used last time and is available.`);
|
|
2341
2334
|
}
|
|
2342
2335
|
return portUsedLastTime;
|
|
2343
2336
|
}
|
|
2344
2337
|
async function tryAnyPort(options) {
|
|
2345
|
-
const { debug, pickedPorts, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime } = options;
|
|
2338
|
+
const { debug: debug3, pickedPorts, portKey, portsUsedByOtherServers, portsUsedByThisServerLastTime } = options;
|
|
2346
2339
|
const minimumPort = Math.max(DEFAULT_DATABASE_PORT, DEFAULT_SERVER_PORT, DEFAULT_SHADOW_DATABASE_PORT) + 1;
|
|
2347
2340
|
const excludedPorts = [
|
|
2348
2341
|
...Object.values(pickedPorts),
|
|
@@ -2363,7 +2356,7 @@ async function tryAnyPort(options) {
|
|
|
2363
2356
|
});
|
|
2364
2357
|
} catch (error) {
|
|
2365
2358
|
if (error instanceof Error && error.name === "GetPortError" && maximumSpecificPort + 1 <= MAX_PORT) {
|
|
2366
|
-
if (
|
|
2359
|
+
if (debug3) {
|
|
2367
2360
|
console.debug(`Expanding port lookup to range [${maximumSpecificPort + 1}, ${MAX_PORT}].`);
|
|
2368
2361
|
}
|
|
2369
2362
|
return await getPort({ portRange: [maximumSpecificPort + 1, MAX_PORT] });
|
|
@@ -2390,27 +2383,27 @@ function extractUsedPorts(name, servers) {
|
|
|
2390
2383
|
return { portsUsedByOtherServers, portsUsedByThisServerLastTime };
|
|
2391
2384
|
}
|
|
2392
2385
|
async function assertPickablePort(options) {
|
|
2393
|
-
const { debug, otherRequestedPorts, portKey, portsUsedByOtherServers, requestedPort } = options;
|
|
2386
|
+
const { debug: debug3, otherRequestedPorts, portKey, portsUsedByOtherServers, requestedPort } = options;
|
|
2394
2387
|
if (requestedPort in portsUsedByOtherServers) {
|
|
2395
|
-
if (
|
|
2388
|
+
if (debug3) {
|
|
2396
2389
|
console.error(`Port ${requestedPort} was requested for "${portKey}", but is already used by another server.`);
|
|
2397
2390
|
}
|
|
2398
2391
|
throw new PortBelongsToAnotherServerError(requestedPort);
|
|
2399
2392
|
}
|
|
2400
2393
|
if (Object.values(otherRequestedPorts).includes(requestedPort)) {
|
|
2401
|
-
if (
|
|
2394
|
+
if (debug3) {
|
|
2402
2395
|
console.error(`Port ${requestedPort} was requested for "${portKey}", but also for another key.`);
|
|
2403
2396
|
}
|
|
2404
2397
|
throw new PortRequestedTwiceError(requestedPort);
|
|
2405
2398
|
}
|
|
2406
2399
|
if (isUnsafePort(requestedPort)) {
|
|
2407
|
-
if (
|
|
2400
|
+
if (debug3) {
|
|
2408
2401
|
console.error(`Port ${requestedPort} was requested for "${portKey}", but is unsafe.`);
|
|
2409
2402
|
}
|
|
2410
2403
|
throw new PortNotAvailableError(requestedPort);
|
|
2411
2404
|
}
|
|
2412
2405
|
if (await checkPort(requestedPort) === false) {
|
|
2413
|
-
if (
|
|
2406
|
+
if (debug3) {
|
|
2414
2407
|
console.error(`Port ${requestedPort} was requested for "${portKey}", but is not available.`);
|
|
2415
2408
|
}
|
|
2416
2409
|
throw new PortNotAvailableError(requestedPort);
|
|
@@ -2466,17 +2459,17 @@ async function startDBServer(purpose, serverState) {
|
|
|
2466
2459
|
if (serverState.dryRun) {
|
|
2467
2460
|
return getStartDBServerResult(purpose, serverState, { db: null, port, server: null });
|
|
2468
2461
|
}
|
|
2469
|
-
const { debug } = serverState;
|
|
2462
|
+
const { debug: debug3 } = serverState;
|
|
2470
2463
|
const getDBFn = purpose === "shadow_database" ? getShadowDB : getDB;
|
|
2471
|
-
const db = await getDBFn(serverState.pgliteDataDirPath,
|
|
2472
|
-
if (
|
|
2464
|
+
const db = await getDBFn(serverState.pgliteDataDirPath, debug3);
|
|
2465
|
+
if (debug3) {
|
|
2473
2466
|
db.onNotification((channel, payload) => {
|
|
2474
2467
|
console.debug(`[${purpose}][${channel}] ${payload}`);
|
|
2475
2468
|
});
|
|
2476
2469
|
}
|
|
2477
2470
|
const { PGLiteSocketServer } = await import("@electric-sql/pglite-socket");
|
|
2478
|
-
const server = new PGLiteSocketServer({ db, debug, inspect:
|
|
2479
|
-
if (
|
|
2471
|
+
const server = new PGLiteSocketServer({ db, debug: debug3, inspect: debug3, port });
|
|
2472
|
+
if (debug3) {
|
|
2480
2473
|
server.addEventListener("listening", (event) => {
|
|
2481
2474
|
const { detail } = event;
|
|
2482
2475
|
console.debug(`[${purpose}] server listening on ${JSON.stringify(detail)}`);
|
|
@@ -2501,9 +2494,9 @@ async function startDBServer(purpose, serverState) {
|
|
|
2501
2494
|
return getStartDBServerResult(purpose, serverState, { db, port, server });
|
|
2502
2495
|
}
|
|
2503
2496
|
function getStartDBServerResult(purpose, serverState, options) {
|
|
2504
|
-
const { debug } = serverState;
|
|
2497
|
+
const { debug: debug3 } = serverState;
|
|
2505
2498
|
const { db, port, server } = options || {};
|
|
2506
|
-
if (
|
|
2499
|
+
if (debug3) {
|
|
2507
2500
|
console.debug(`[${purpose}] server started on port ${port}`);
|
|
2508
2501
|
}
|
|
2509
2502
|
return {
|
|
@@ -2512,7 +2505,7 @@ function getStartDBServerResult(purpose, serverState, options) {
|
|
|
2512
2505
|
const errors = [];
|
|
2513
2506
|
try {
|
|
2514
2507
|
await server?.stop();
|
|
2515
|
-
if (
|
|
2508
|
+
if (debug3) {
|
|
2516
2509
|
console.debug(`[${purpose}] server stopped on port ${port}`);
|
|
2517
2510
|
}
|
|
2518
2511
|
} catch (error) {
|
|
@@ -2522,7 +2515,7 @@ function getStartDBServerResult(purpose, serverState, options) {
|
|
|
2522
2515
|
if (purpose === "database") {
|
|
2523
2516
|
try {
|
|
2524
2517
|
await db?.syncToFs();
|
|
2525
|
-
if (
|
|
2518
|
+
if (debug3) {
|
|
2526
2519
|
console.debug(`[${purpose}] synced to filesystem`);
|
|
2527
2520
|
}
|
|
2528
2521
|
} catch (error) {
|
|
@@ -2532,7 +2525,7 @@ function getStartDBServerResult(purpose, serverState, options) {
|
|
|
2532
2525
|
}
|
|
2533
2526
|
try {
|
|
2534
2527
|
await db?.close();
|
|
2535
|
-
if (
|
|
2528
|
+
if (debug3) {
|
|
2536
2529
|
console.debug(`[${purpose}] closed`);
|
|
2537
2530
|
}
|
|
2538
2531
|
} catch (error) {
|
|
@@ -2548,7 +2541,7 @@ function getStartDBServerResult(purpose, serverState, options) {
|
|
|
2548
2541
|
if (purpose === "shadow_database" || !db) {
|
|
2549
2542
|
return;
|
|
2550
2543
|
}
|
|
2551
|
-
await dumpDB({ db, debug, destinationPath });
|
|
2544
|
+
await dumpDB({ db, debug: debug3, destinationPath });
|
|
2552
2545
|
},
|
|
2553
2546
|
port,
|
|
2554
2547
|
prismaORMConnectionString: getConnectionString(port, PRISMA_ORM_CONNECTION_STRING_QUERY_PARAMS),
|
|
@@ -2558,29 +2551,29 @@ function getStartDBServerResult(purpose, serverState, options) {
|
|
|
2558
2551
|
function getConnectionString(port, queryParams) {
|
|
2559
2552
|
return `${BASE_DB_URL}:${port}/${BASE_PGLITE_OPTIONS.database}?${queryParams.toString()}`;
|
|
2560
2553
|
}
|
|
2561
|
-
async function getDB(dataDir,
|
|
2554
|
+
async function getDB(dataDir, debug3) {
|
|
2562
2555
|
const { PGlite } = await import("@electric-sql/pglite");
|
|
2563
2556
|
return await PGlite.create({
|
|
2564
2557
|
database: BASE_PGLITE_OPTIONS.database,
|
|
2565
2558
|
dataDir,
|
|
2566
|
-
debug:
|
|
2559
|
+
debug: debug3 ? 5 : void 0,
|
|
2567
2560
|
relaxedDurability: false,
|
|
2568
2561
|
username: BASE_PGLITE_OPTIONS.username
|
|
2569
2562
|
});
|
|
2570
2563
|
}
|
|
2571
|
-
async function getShadowDB(_dataDir,
|
|
2564
|
+
async function getShadowDB(_dataDir, debug3) {
|
|
2572
2565
|
const { PGlite } = await import("@electric-sql/pglite");
|
|
2573
2566
|
return await PGlite.create({
|
|
2574
2567
|
database: BASE_PGLITE_OPTIONS.database,
|
|
2575
2568
|
dataDir: "memory://",
|
|
2576
|
-
debug:
|
|
2569
|
+
debug: debug3 ? 5 : void 0,
|
|
2577
2570
|
relaxedDurability: false,
|
|
2578
2571
|
username: BASE_PGLITE_OPTIONS.username
|
|
2579
2572
|
});
|
|
2580
2573
|
}
|
|
2581
2574
|
async function dumpDB(options) {
|
|
2582
|
-
const { dataDir, db, debug, destinationPath } = options;
|
|
2583
|
-
const pg = db || await getDB(dataDir,
|
|
2575
|
+
const { dataDir, db, debug: debug3, destinationPath } = options;
|
|
2576
|
+
const pg = db || await getDB(dataDir, debug3);
|
|
2584
2577
|
const { pgDump } = await import("@electric-sql/pglite-tools/pg_dump");
|
|
2585
2578
|
const dumpFile = await pgDump({
|
|
2586
2579
|
args: [
|
|
@@ -2596,12 +2589,12 @@ async function dumpDB(options) {
|
|
|
2596
2589
|
pg: await pg.clone()
|
|
2597
2590
|
});
|
|
2598
2591
|
if (destinationPath) {
|
|
2599
|
-
if (
|
|
2592
|
+
if (debug3) {
|
|
2600
2593
|
console.debug(`[DB] Dumping database to ${destinationPath}`);
|
|
2601
2594
|
}
|
|
2602
2595
|
return await streamAsTextTo(dumpFile, destinationPath);
|
|
2603
2596
|
}
|
|
2604
|
-
if (
|
|
2597
|
+
if (debug3) {
|
|
2605
2598
|
console.debug(`[DB] Dumping database to memory`);
|
|
2606
2599
|
}
|
|
2607
2600
|
return await dumpFile.text();
|
|
@@ -2642,18 +2635,18 @@ function getStartHTTPServerResult(port, server) {
|
|
|
2642
2635
|
};
|
|
2643
2636
|
}
|
|
2644
2637
|
async function getApp(port, dbServer, serverState) {
|
|
2645
|
-
const { debug } = serverState;
|
|
2638
|
+
const { debug: debug3 } = serverState;
|
|
2646
2639
|
const [{ Hono }, { accelerateRoute }, { utilityRoute }] = await Promise.all([
|
|
2647
2640
|
import("hono/tiny"),
|
|
2648
|
-
import("./accelerate-
|
|
2649
|
-
import("./utility-
|
|
2641
|
+
import("./accelerate-SOBMYP3B.js"),
|
|
2642
|
+
import("./utility-QJR3G2JJ.js")
|
|
2650
2643
|
]);
|
|
2651
2644
|
const app = new Hono();
|
|
2652
2645
|
const platform = await getPlatformModule.getPlatformInfo();
|
|
2653
|
-
if (
|
|
2646
|
+
if (debug3) {
|
|
2654
2647
|
console.debug("[Accelerate] platform info: %s", JSON.stringify(platform));
|
|
2655
2648
|
}
|
|
2656
|
-
if (
|
|
2649
|
+
if (debug3) {
|
|
2657
2650
|
const { logger } = await import("hono/logger");
|
|
2658
2651
|
app.use(
|
|
2659
2652
|
"*",
|
|
@@ -2662,7 +2655,7 @@ async function getApp(port, dbServer, serverState) {
|
|
|
2662
2655
|
}
|
|
2663
2656
|
app.use("*", async (ctx, next) => {
|
|
2664
2657
|
ctx.set("db", dbServer);
|
|
2665
|
-
ctx.set("debug", Boolean(
|
|
2658
|
+
ctx.set("debug", Boolean(debug3));
|
|
2666
2659
|
ctx.set("platform", platform);
|
|
2667
2660
|
ctx.set("port", port);
|
|
2668
2661
|
ctx.set("protocol", "http");
|
|
@@ -2682,14 +2675,14 @@ import { writeFile } from "fs/promises";
|
|
|
2682
2675
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
2683
2676
|
|
|
2684
2677
|
// ../../dev/server/src/kernel.ts
|
|
2685
|
-
function checkProcessExists(pid,
|
|
2678
|
+
function checkProcessExists(pid, debug3) {
|
|
2686
2679
|
if (pid == null) {
|
|
2687
2680
|
return false;
|
|
2688
2681
|
}
|
|
2689
2682
|
try {
|
|
2690
2683
|
return y.kill?.(pid, 0) ?? true;
|
|
2691
2684
|
} catch (error) {
|
|
2692
|
-
if (
|
|
2685
|
+
if (debug3) {
|
|
2693
2686
|
console.error(`Error checking if process with PID ${pid} exists:`, error);
|
|
2694
2687
|
}
|
|
2695
2688
|
return false;
|
|
@@ -2749,17 +2742,17 @@ var ServerState = class {
|
|
|
2749
2742
|
return serverState;
|
|
2750
2743
|
}
|
|
2751
2744
|
static async fromServerDump(options) {
|
|
2752
|
-
const { debug, name = DEFAULT_NAME } = options ?? {};
|
|
2745
|
+
const { debug: debug3, name = DEFAULT_NAME } = options ?? {};
|
|
2753
2746
|
const dataDirPath = getDataDirPath(name);
|
|
2754
2747
|
const serverDumpPath = StatefulServerState.getServerDumpPath(dataDirPath);
|
|
2755
2748
|
const serverDumpFileContent = await readFileAsText(serverDumpPath);
|
|
2756
2749
|
if (serverDumpFileContent == null) {
|
|
2757
|
-
if (
|
|
2750
|
+
if (debug3) {
|
|
2758
2751
|
console.debug(`[State] No server dump file found at: ${serverDumpPath}`);
|
|
2759
2752
|
}
|
|
2760
2753
|
return null;
|
|
2761
2754
|
}
|
|
2762
|
-
if (
|
|
2755
|
+
if (debug3) {
|
|
2763
2756
|
console.debug(`[State] server dump file found at "${serverDumpPath}":`);
|
|
2764
2757
|
console.debug(serverDumpFileContent);
|
|
2765
2758
|
}
|
|
@@ -2769,7 +2762,7 @@ var ServerState = class {
|
|
|
2769
2762
|
success
|
|
2770
2763
|
} = safeParse(pipe(string(), parseJson(), serverDumpV1Schema), serverDumpFileContent);
|
|
2771
2764
|
if (!success) {
|
|
2772
|
-
if (
|
|
2765
|
+
if (debug3) {
|
|
2773
2766
|
console.debug(`[State] Invalid server dump file at "${serverDumpPath}":
|
|
2774
2767
|
${JSON.stringify(issues, null, 2)}`);
|
|
2775
2768
|
}
|
|
@@ -2777,7 +2770,7 @@ ${JSON.stringify(issues, null, 2)}`);
|
|
|
2777
2770
|
}
|
|
2778
2771
|
return new StatefulServerState({
|
|
2779
2772
|
databasePort: serverDump.databasePort,
|
|
2780
|
-
debug,
|
|
2773
|
+
debug: debug3,
|
|
2781
2774
|
dryRun: false,
|
|
2782
2775
|
name,
|
|
2783
2776
|
pid: serverDump.pid,
|
|
@@ -2787,13 +2780,13 @@ ${JSON.stringify(issues, null, 2)}`);
|
|
|
2787
2780
|
});
|
|
2788
2781
|
}
|
|
2789
2782
|
static async scan(options) {
|
|
2790
|
-
const { debug, globs } = options ?? {};
|
|
2783
|
+
const { debug: debug3, globs } = options ?? {};
|
|
2791
2784
|
const dataDirsPath = join(getDataDirPath(DEFAULT_NAME), "..");
|
|
2792
|
-
if (
|
|
2785
|
+
if (debug3) {
|
|
2793
2786
|
console.debug(`[State] scanning for server states in: ${dataDirsPath}`);
|
|
2794
2787
|
}
|
|
2795
2788
|
const names = await readDirectoryNames(dataDirsPath, globs);
|
|
2796
|
-
if (
|
|
2789
|
+
if (debug3) {
|
|
2797
2790
|
console.debug(`[State] found server names: ${JSON.stringify(names)}`);
|
|
2798
2791
|
}
|
|
2799
2792
|
return await Promise.all(names.map((name) => getServerStatus(name, options)));
|
|
@@ -2925,7 +2918,7 @@ var StatefulServerState = class _StatefulServerState extends ServerState {
|
|
|
2925
2918
|
}
|
|
2926
2919
|
};
|
|
2927
2920
|
async function getServerStatus(nameOrState, options) {
|
|
2928
|
-
const { debug, onlyMetadata } = options || {};
|
|
2921
|
+
const { debug: debug3, onlyMetadata } = options || {};
|
|
2929
2922
|
const name = typeof nameOrState === "string" ? nameOrState : nameOrState.name;
|
|
2930
2923
|
const givenState = typeof nameOrState !== "string" ? nameOrState : void 0;
|
|
2931
2924
|
const baseResult = {
|
|
@@ -2938,9 +2931,9 @@ async function getServerStatus(nameOrState, options) {
|
|
|
2938
2931
|
version: "1"
|
|
2939
2932
|
};
|
|
2940
2933
|
try {
|
|
2941
|
-
const serverState = givenState || await ServerState.fromServerDump({ debug, name });
|
|
2934
|
+
const serverState = givenState || await ServerState.fromServerDump({ debug: debug3, name });
|
|
2942
2935
|
if (!serverState) {
|
|
2943
|
-
if (
|
|
2936
|
+
if (debug3) {
|
|
2944
2937
|
console.debug(`[State] no server state found for name: ${name}`);
|
|
2945
2938
|
}
|
|
2946
2939
|
return { ...baseResult, status: "no_such_server" };
|
|
@@ -2954,8 +2947,8 @@ async function getServerStatus(nameOrState, options) {
|
|
|
2954
2947
|
if (onlyMetadata) {
|
|
2955
2948
|
return { ...baseResult, status: "unknown" };
|
|
2956
2949
|
}
|
|
2957
|
-
if (!checkProcessExists(pid,
|
|
2958
|
-
if (
|
|
2950
|
+
if (!checkProcessExists(pid, debug3)) {
|
|
2951
|
+
if (debug3) {
|
|
2959
2952
|
console.debug(`[State] server state for "${name}" has no running process with PID: ${pid}`);
|
|
2960
2953
|
}
|
|
2961
2954
|
return { ...baseResult, status: "not_running" };
|
|
@@ -2963,41 +2956,41 @@ async function getServerStatus(nameOrState, options) {
|
|
|
2963
2956
|
const dataDirPath = getDataDirPath(name);
|
|
2964
2957
|
try {
|
|
2965
2958
|
if (!await (0, import_proper_lockfile.check)(dataDirPath, { lockfilePath: join(dataDirPath, ".lock") })) {
|
|
2966
|
-
if (
|
|
2959
|
+
if (debug3) {
|
|
2967
2960
|
console.debug(`[State] server state for "${name}" is not locked, indicating it is not running.`);
|
|
2968
2961
|
}
|
|
2969
2962
|
return { ...baseResult, status: "starting_up" };
|
|
2970
2963
|
}
|
|
2971
2964
|
} catch (error) {
|
|
2972
|
-
if (
|
|
2965
|
+
if (debug3) {
|
|
2973
2966
|
console.error(`[State] server state for "${name}" failed to check lock:`, error);
|
|
2974
2967
|
}
|
|
2975
2968
|
}
|
|
2976
2969
|
if (!exports) {
|
|
2977
2970
|
return { ...baseResult, status: "starting_up" };
|
|
2978
2971
|
}
|
|
2979
|
-
const { http } = exports;
|
|
2972
|
+
const { http: http2 } = exports;
|
|
2980
2973
|
const { hc } = await import("hono/client");
|
|
2981
|
-
const healthResponse = await hc(
|
|
2974
|
+
const healthResponse = await hc(http2.url).health.$get();
|
|
2982
2975
|
if (!healthResponse.ok) {
|
|
2983
|
-
if (
|
|
2976
|
+
if (debug3) {
|
|
2984
2977
|
console.debug(`[State] server state for "${name}" is not live: ${JSON.stringify(healthResponse)}`);
|
|
2985
2978
|
}
|
|
2986
2979
|
return { ...baseResult, status: "not_running" };
|
|
2987
2980
|
}
|
|
2988
2981
|
const health = await healthResponse.json();
|
|
2989
2982
|
if (health.name !== nameOrState) {
|
|
2990
|
-
if (
|
|
2983
|
+
if (debug3) {
|
|
2991
2984
|
console.debug(`[State] server state for "${name}" has mismatched health response: ${JSON.stringify(health)}`);
|
|
2992
2985
|
}
|
|
2993
2986
|
return { ...baseResult, status: "unknown" };
|
|
2994
2987
|
}
|
|
2995
|
-
if (
|
|
2988
|
+
if (debug3) {
|
|
2996
2989
|
console.debug(`[State] server state for "${nameOrState}" is live: ${JSON.stringify(health)}`);
|
|
2997
2990
|
}
|
|
2998
2991
|
return { ...baseResult, status: "running" };
|
|
2999
2992
|
} catch (error) {
|
|
3000
|
-
if (
|
|
2993
|
+
if (debug3) {
|
|
3001
2994
|
console.error(`[State] failed to get server status for "${name}":`, error);
|
|
3002
2995
|
}
|
|
3003
2996
|
return { ...baseResult, status: "error" };
|
|
@@ -3074,10 +3067,10 @@ async function unstable_startServer(options) {
|
|
|
3074
3067
|
import internals from "@prisma/internals";
|
|
3075
3068
|
import dotenv from "dotenv";
|
|
3076
3069
|
import { Schema as Shape } from "effect";
|
|
3077
|
-
import
|
|
3078
|
-
import { bold as bold2, dim, green, red as red2, yellow } from "kleur/colors";
|
|
3070
|
+
import fs3 from "fs";
|
|
3071
|
+
import { bold as bold2, dim, green as green2, red as red2, yellow } from "kleur/colors";
|
|
3079
3072
|
import ora from "ora";
|
|
3080
|
-
import
|
|
3073
|
+
import path3 from "path";
|
|
3081
3074
|
import { match, P } from "ts-pattern";
|
|
3082
3075
|
|
|
3083
3076
|
// src/utils/client-output-path.ts
|
|
@@ -3113,44 +3106,309 @@ function getSourceDirFromTypeScriptConfig() {
|
|
|
3113
3106
|
return config.compilerOptions?.rootDir ?? config.compilerOptions?.baseUrl ?? config.compilerOptions?.rootDirs?.[0];
|
|
3114
3107
|
}
|
|
3115
3108
|
|
|
3116
|
-
// src/
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3109
|
+
// src/utils/print.ts
|
|
3110
|
+
import { bgRed, bold, green, red } from "kleur/colors";
|
|
3111
|
+
function printError(text) {
|
|
3112
|
+
return bold(bgRed(" ERROR ")) + " " + red(text);
|
|
3113
|
+
}
|
|
3114
|
+
function successMessage(message) {
|
|
3115
|
+
return `${green("Success!")} ${message}`;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
// src/management-api/auth.ts
|
|
3119
|
+
import crypto from "crypto";
|
|
3120
|
+
import events from "events";
|
|
3121
|
+
import http from "http";
|
|
3122
|
+
import open from "open";
|
|
3123
|
+
import z from "zod";
|
|
3124
|
+
var CLIENT_ID = "cmi4ttoor03pv2wco4526rnin";
|
|
3125
|
+
var LOGIN_URL = "https://auth.prisma.io/authorize";
|
|
3126
|
+
var TOKEN_URL = "https://auth.prisma.io/token";
|
|
3127
|
+
var AuthError = class extends Error {
|
|
3128
|
+
constructor(message) {
|
|
3129
|
+
super(message);
|
|
3130
|
+
this.name = "AuthError";
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
async function login() {
|
|
3134
|
+
const server = http.createServer();
|
|
3135
|
+
server.listen({ host: "localhost", port: 0 });
|
|
3136
|
+
const addressInfo = await events.once(server, "listening").then(() => server.address());
|
|
3137
|
+
const state = new LoginState("localhost", addressInfo.port);
|
|
3138
|
+
const authResult = new Promise((resolve2) => {
|
|
3139
|
+
server.on("request", async (req, res) => {
|
|
3140
|
+
const url2 = new URL(`http://${state.host}${req.url}`);
|
|
3141
|
+
const result = await state.handleCallback(url2);
|
|
3142
|
+
if (result === null) {
|
|
3143
|
+
res.statusCode = 404;
|
|
3144
|
+
res.end();
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
res.setHeader("Content-Type", "text/html");
|
|
3148
|
+
res.end(`
|
|
3149
|
+
<html>
|
|
3150
|
+
<head>
|
|
3151
|
+
<title>Login</title>
|
|
3152
|
+
</head>
|
|
3153
|
+
<body>
|
|
3154
|
+
<p>Success!</p>
|
|
3155
|
+
<p>You may now close this page.</p>
|
|
3156
|
+
</body>
|
|
3157
|
+
</html>
|
|
3158
|
+
`);
|
|
3159
|
+
setImmediate(() => {
|
|
3160
|
+
server.close();
|
|
3161
|
+
});
|
|
3162
|
+
resolve2(result);
|
|
3163
|
+
});
|
|
3139
3164
|
});
|
|
3140
|
-
|
|
3165
|
+
await state.login();
|
|
3166
|
+
return await authResult;
|
|
3167
|
+
}
|
|
3168
|
+
var LoginState = class {
|
|
3169
|
+
constructor(hostname, port) {
|
|
3170
|
+
this.hostname = hostname;
|
|
3171
|
+
this.port = port;
|
|
3172
|
+
}
|
|
3173
|
+
latestVerifier;
|
|
3174
|
+
latestState;
|
|
3175
|
+
async login() {
|
|
3176
|
+
this.latestState = this.generateState();
|
|
3177
|
+
this.latestVerifier = this.generateVerifier();
|
|
3178
|
+
const challenge = this.generateChallenge(this.latestVerifier);
|
|
3179
|
+
const authUrl = new URL(LOGIN_URL);
|
|
3180
|
+
authUrl.searchParams.set("response_type", "code");
|
|
3181
|
+
authUrl.searchParams.set("client_id", CLIENT_ID);
|
|
3182
|
+
authUrl.searchParams.set("redirect_uri", this.redirectUri);
|
|
3183
|
+
authUrl.searchParams.set("scope", "workspace:admin offline_access");
|
|
3184
|
+
authUrl.searchParams.set("state", this.latestState);
|
|
3185
|
+
authUrl.searchParams.set("code_challenge", challenge);
|
|
3186
|
+
authUrl.searchParams.set("code_challenge_method", "S256");
|
|
3187
|
+
authUrl.searchParams.set("utm_source", "orm");
|
|
3188
|
+
authUrl.searchParams.set("utm_medium", "cli");
|
|
3189
|
+
authUrl.searchParams.set("utm_campaign", "oauth");
|
|
3190
|
+
await open(authUrl.href);
|
|
3191
|
+
}
|
|
3192
|
+
async handleCallback(url2) {
|
|
3193
|
+
if (url2.pathname !== "/auth/callback")
|
|
3194
|
+
return null;
|
|
3195
|
+
const params = url2.searchParams;
|
|
3196
|
+
const error = params.get("error");
|
|
3197
|
+
if (error)
|
|
3198
|
+
throw new AuthError(error);
|
|
3199
|
+
const code = params.get("code");
|
|
3200
|
+
const state = params.get("state");
|
|
3201
|
+
if (!code)
|
|
3202
|
+
throw new AuthError("No code found in callback");
|
|
3203
|
+
if (!this.latestVerifier)
|
|
3204
|
+
throw new AuthError("No verifier found");
|
|
3205
|
+
if (state !== this.latestState)
|
|
3206
|
+
throw new AuthError("Invalid state");
|
|
3207
|
+
const body = new URLSearchParams({
|
|
3208
|
+
grant_type: "authorization_code",
|
|
3209
|
+
code,
|
|
3210
|
+
redirect_uri: this.redirectUri,
|
|
3211
|
+
client_id: CLIENT_ID,
|
|
3212
|
+
code_verifier: this.latestVerifier
|
|
3213
|
+
});
|
|
3214
|
+
const response = await fetch(TOKEN_URL, {
|
|
3215
|
+
method: "POST",
|
|
3216
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
3217
|
+
body
|
|
3218
|
+
});
|
|
3219
|
+
return parseTokenResponse(response);
|
|
3220
|
+
}
|
|
3221
|
+
get host() {
|
|
3222
|
+
return `${this.hostname}:${this.port}`;
|
|
3223
|
+
}
|
|
3224
|
+
get redirectUri() {
|
|
3225
|
+
return `http://${this.host}/auth/callback`;
|
|
3226
|
+
}
|
|
3227
|
+
base64urlEncode(buffer) {
|
|
3228
|
+
return buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3229
|
+
}
|
|
3230
|
+
generateState() {
|
|
3231
|
+
return crypto.randomBytes(16).toString("hex");
|
|
3232
|
+
}
|
|
3233
|
+
generateVerifier() {
|
|
3234
|
+
return this.base64urlEncode(crypto.randomBytes(32));
|
|
3235
|
+
}
|
|
3236
|
+
generateChallenge(verifier) {
|
|
3237
|
+
const hash = crypto.createHash("sha256").update(verifier).digest();
|
|
3238
|
+
return this.base64urlEncode(hash);
|
|
3239
|
+
}
|
|
3141
3240
|
};
|
|
3142
|
-
|
|
3143
|
-
const
|
|
3144
|
-
|
|
3145
|
-
|
|
3241
|
+
async function refreshToken(refreshToken2) {
|
|
3242
|
+
const body = new URLSearchParams({
|
|
3243
|
+
grant_type: "refresh_token",
|
|
3244
|
+
refresh_token: refreshToken2,
|
|
3245
|
+
client_id: CLIENT_ID
|
|
3246
|
+
});
|
|
3247
|
+
const response = await fetch(TOKEN_URL, {
|
|
3248
|
+
method: "POST",
|
|
3249
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
3250
|
+
body
|
|
3251
|
+
});
|
|
3252
|
+
const result = await parseTokenResponse(response);
|
|
3253
|
+
return result;
|
|
3254
|
+
}
|
|
3255
|
+
async function parseTokenResponse(response) {
|
|
3256
|
+
const data = await response.json();
|
|
3257
|
+
if (!response.ok) {
|
|
3258
|
+
throw new AuthError(`Failed to get token. Status code ${response.status}, response: ${JSON.stringify(data)}.`);
|
|
3259
|
+
}
|
|
3260
|
+
const parsed = z.object({
|
|
3261
|
+
access_token: z.string(),
|
|
3262
|
+
refresh_token: z.string()
|
|
3263
|
+
}).parse(data);
|
|
3264
|
+
return { token: parsed.access_token, refreshToken: parsed.refresh_token };
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
// src/management-api/client.ts
|
|
3268
|
+
import { Debug } from "@prisma/debug";
|
|
3269
|
+
import createClient from "openapi-fetch";
|
|
3270
|
+
var debug = Debug("prisma:cli:management-api");
|
|
3271
|
+
var FetchError = class extends Error {
|
|
3272
|
+
constructor() {
|
|
3273
|
+
super("Connection to API failed.");
|
|
3274
|
+
}
|
|
3146
3275
|
};
|
|
3276
|
+
function createTokenRefreshingFetch(initialToken, tokenRefreshHandler) {
|
|
3277
|
+
let currentToken = initialToken;
|
|
3278
|
+
let refreshPromise = null;
|
|
3279
|
+
let subscribers = [];
|
|
3280
|
+
const isRefreshing = () => refreshPromise !== null;
|
|
3281
|
+
const refreshAccessToken = async () => {
|
|
3282
|
+
if (isRefreshing()) {
|
|
3283
|
+
debug("token refresh already in progress, waiting for it to complete...");
|
|
3284
|
+
return new Promise((resolve2) => subscribers.push(resolve2));
|
|
3285
|
+
}
|
|
3286
|
+
refreshPromise = tokenRefreshHandler().finally(() => {
|
|
3287
|
+
refreshPromise = null;
|
|
3288
|
+
});
|
|
3289
|
+
const { token } = await refreshPromise;
|
|
3290
|
+
debug("refreshed token!");
|
|
3291
|
+
currentToken = token;
|
|
3292
|
+
subscribers.forEach((cb) => cb(token));
|
|
3293
|
+
subscribers = [];
|
|
3294
|
+
return token;
|
|
3295
|
+
};
|
|
3296
|
+
return async function tokenRefreshingFetch(request) {
|
|
3297
|
+
const requestCloneForRetry = request.clone();
|
|
3298
|
+
request.headers.set("Authorization", `Bearer ${currentToken}`);
|
|
3299
|
+
let response = await fetch(request);
|
|
3300
|
+
if (response.status === 401) {
|
|
3301
|
+
debug("detected expired token, refreshing...");
|
|
3302
|
+
await refreshAccessToken();
|
|
3303
|
+
requestCloneForRetry.headers.set("Authorization", `Bearer ${currentToken}`);
|
|
3304
|
+
response = await fetch(requestCloneForRetry);
|
|
3305
|
+
}
|
|
3306
|
+
return response;
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
function createManagementApiClient(token, tokenRefreshHandler) {
|
|
3310
|
+
const client = createClient({
|
|
3311
|
+
baseUrl: "https://api.prisma.io",
|
|
3312
|
+
fetch: createTokenRefreshingFetch(token, tokenRefreshHandler)
|
|
3313
|
+
});
|
|
3314
|
+
client.use({
|
|
3315
|
+
onRequest({ request }) {
|
|
3316
|
+
debug("onRequest", {
|
|
3317
|
+
method: request.method,
|
|
3318
|
+
url: request.url,
|
|
3319
|
+
body: request.body
|
|
3320
|
+
});
|
|
3321
|
+
return request;
|
|
3322
|
+
},
|
|
3323
|
+
onResponse({ response }) {
|
|
3324
|
+
debug("onResponse", {
|
|
3325
|
+
status: response.status,
|
|
3326
|
+
statusText: response.statusText,
|
|
3327
|
+
url: response.url
|
|
3328
|
+
});
|
|
3329
|
+
return response;
|
|
3330
|
+
},
|
|
3331
|
+
onError({ error }) {
|
|
3332
|
+
debug("Fetch error", error);
|
|
3333
|
+
return new FetchError();
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
return client;
|
|
3337
|
+
}
|
|
3147
3338
|
|
|
3148
|
-
// src/
|
|
3149
|
-
import
|
|
3150
|
-
|
|
3151
|
-
|
|
3339
|
+
// src/management-api/credentials.ts
|
|
3340
|
+
import fs2 from "fs/promises";
|
|
3341
|
+
import path2 from "path";
|
|
3342
|
+
import { Debug as Debug2 } from "@prisma/debug";
|
|
3343
|
+
import XdgAppPaths from "xdg-app-paths";
|
|
3344
|
+
import { z as z2 } from "zod";
|
|
3345
|
+
var debug2 = Debug2("prisma:cli:management-api:credentials");
|
|
3346
|
+
var credentialsSchema = z2.object({
|
|
3347
|
+
token: z2.string(),
|
|
3348
|
+
refreshToken: z2.string()
|
|
3349
|
+
});
|
|
3350
|
+
var credentialsFileDirectoryPath = new XdgAppPaths("prisma-cli").config();
|
|
3351
|
+
var credentialsFilePath = path2.join(credentialsFileDirectoryPath, "auth.json");
|
|
3352
|
+
async function loadCredentials() {
|
|
3353
|
+
try {
|
|
3354
|
+
const fileContent = await fs2.readFile(credentialsFilePath, "utf8");
|
|
3355
|
+
return credentialsSchema.parse(JSON.parse(fileContent));
|
|
3356
|
+
} catch (error) {
|
|
3357
|
+
debug2(error);
|
|
3358
|
+
return void 0;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
async function saveCredentials(credentials) {
|
|
3362
|
+
await fs2.mkdir(credentialsFileDirectoryPath, { recursive: true });
|
|
3363
|
+
await fs2.writeFile(credentialsFilePath, JSON.stringify(credentials, null, 2));
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
// src/management-api/auth-client.ts
|
|
3367
|
+
async function createAuthenticatedManagementApiClient() {
|
|
3368
|
+
let authResult = await loadCredentials() ?? await login();
|
|
3369
|
+
const tokenRefreshHandler = async () => {
|
|
3370
|
+
authResult = await refreshToken(authResult.refreshToken);
|
|
3371
|
+
await saveCredentials(authResult);
|
|
3372
|
+
return { token: authResult.token };
|
|
3373
|
+
};
|
|
3374
|
+
return createManagementApiClient(authResult.token, tokenRefreshHandler);
|
|
3152
3375
|
}
|
|
3153
3376
|
|
|
3377
|
+
// src/management-api/api.ts
|
|
3378
|
+
var ManagementApiError = class extends Error {
|
|
3379
|
+
code;
|
|
3380
|
+
constructor({ code, message }) {
|
|
3381
|
+
super(message);
|
|
3382
|
+
this.code = code;
|
|
3383
|
+
}
|
|
3384
|
+
};
|
|
3385
|
+
var ManagementApi = class {
|
|
3386
|
+
#client;
|
|
3387
|
+
constructor(client) {
|
|
3388
|
+
this.#client = client;
|
|
3389
|
+
}
|
|
3390
|
+
async getRegions() {
|
|
3391
|
+
const { data, error } = await this.#client.GET("/v1/regions/postgres");
|
|
3392
|
+
if (error) {
|
|
3393
|
+
throw new ManagementApiError(error.error);
|
|
3394
|
+
}
|
|
3395
|
+
return data.data;
|
|
3396
|
+
}
|
|
3397
|
+
async createProjectWithDatabase(name, region) {
|
|
3398
|
+
const { data, error } = await this.#client.POST("/v1/projects", {
|
|
3399
|
+
body: {
|
|
3400
|
+
createDatabase: true,
|
|
3401
|
+
name,
|
|
3402
|
+
region
|
|
3403
|
+
}
|
|
3404
|
+
});
|
|
3405
|
+
if (error) {
|
|
3406
|
+
throw new ManagementApiError(error.error);
|
|
3407
|
+
}
|
|
3408
|
+
return data.data;
|
|
3409
|
+
}
|
|
3410
|
+
};
|
|
3411
|
+
|
|
3154
3412
|
// src/Init.ts
|
|
3155
3413
|
var isBun = (
|
|
3156
3414
|
// @ts-ignore
|
|
@@ -3214,10 +3472,10 @@ model User {
|
|
|
3214
3472
|
}
|
|
3215
3473
|
return schema;
|
|
3216
3474
|
};
|
|
3217
|
-
var defaultEnv = async (url2,
|
|
3475
|
+
var defaultEnv = async (url2, debug3 = false, comments = true) => {
|
|
3218
3476
|
if (url2 === void 0) {
|
|
3219
3477
|
let created = false;
|
|
3220
|
-
const state = await ServerState.fromServerDump({ debug }) || (created = true, await ServerState.createExclusively({ persistenceMode: "stateful", debug }));
|
|
3478
|
+
const state = await ServerState.fromServerDump({ debug: debug3 }) || (created = true, await ServerState.createExclusively({ persistenceMode: "stateful", debug: debug3 }));
|
|
3221
3479
|
if (created) {
|
|
3222
3480
|
await state.close();
|
|
3223
3481
|
}
|
|
@@ -3226,7 +3484,7 @@ var defaultEnv = async (url2, debug = false, comments = true) => {
|
|
|
3226
3484
|
dryRun: true,
|
|
3227
3485
|
port: state.port,
|
|
3228
3486
|
shadowDatabasePort: state.shadowDatabasePort,
|
|
3229
|
-
debug
|
|
3487
|
+
debug: debug3
|
|
3230
3488
|
});
|
|
3231
3489
|
url2 = server.ppg.url;
|
|
3232
3490
|
}
|
|
@@ -3289,12 +3547,12 @@ var defaultGitIgnore = () => {
|
|
|
3289
3547
|
var defaultGeneratorProvider = "prisma-client";
|
|
3290
3548
|
var defaultPreviewFeatures = [];
|
|
3291
3549
|
function normalizePath(configPath) {
|
|
3292
|
-
return JSON.stringify(configPath.replaceAll(
|
|
3550
|
+
return JSON.stringify(configPath.replaceAll(path3.sep, "/"));
|
|
3293
3551
|
}
|
|
3294
3552
|
var defaultConfig = (props) => {
|
|
3295
3553
|
const { prismaFolder } = props;
|
|
3296
|
-
const schemaPath =
|
|
3297
|
-
const migrationsPath =
|
|
3554
|
+
const schemaPath = path3.relative(process.cwd(), path3.join(prismaFolder, "schema.prisma"));
|
|
3555
|
+
const migrationsPath = path3.relative(process.cwd(), path3.join(prismaFolder, "migrations"));
|
|
3298
3556
|
return `import { defineConfig, env } from "prisma/config";
|
|
3299
3557
|
|
|
3300
3558
|
export default defineConfig({
|
|
@@ -3309,6 +3567,85 @@ export default defineConfig({
|
|
|
3309
3567
|
});
|
|
3310
3568
|
`;
|
|
3311
3569
|
};
|
|
3570
|
+
var printPpgInitOutput = ({
|
|
3571
|
+
databaseUrl,
|
|
3572
|
+
workspaceId,
|
|
3573
|
+
projectId,
|
|
3574
|
+
environmentId,
|
|
3575
|
+
isExistingPrismaProject = false
|
|
3576
|
+
}) => {
|
|
3577
|
+
const newPrismaProjectOutput = `
|
|
3578
|
+
We created an initial ${green2("schema.prisma")} file and a ${green2(".env")} file with your ${green2(
|
|
3579
|
+
"DATABASE_URL"
|
|
3580
|
+
)} environment variable already set.
|
|
3581
|
+
|
|
3582
|
+
${bold2("--- Next steps ---")}
|
|
3583
|
+
|
|
3584
|
+
Go to ${internals.link("https://pris.ly/ppg-init")} for detailed instructions.
|
|
3585
|
+
|
|
3586
|
+
${bold2("1. Define your database schema")}
|
|
3587
|
+
Open the ${green2("schema.prisma")} file and define your first models. Check the docs if you need inspiration: ${internals.link(
|
|
3588
|
+
"https://pris.ly/ppg-init"
|
|
3589
|
+
)}.
|
|
3590
|
+
|
|
3591
|
+
${bold2("2. Apply migrations")}
|
|
3592
|
+
Run the following command to create and apply a migration:
|
|
3593
|
+
${green2("npx prisma migrate dev --name init")}
|
|
3594
|
+
|
|
3595
|
+
${bold2("3. Manage your data")}
|
|
3596
|
+
View and edit your data locally by running this command:
|
|
3597
|
+
${green2("npx prisma studio")}
|
|
3598
|
+
${environmentId !== void 0 ? `...or online in Console:
|
|
3599
|
+
${internals.link(`https://console.prisma.io/${workspaceId}/${projectId}/${environmentId}/studio`)}
|
|
3600
|
+
` : ""}
|
|
3601
|
+
${bold2(`4. Send queries from your app`)}
|
|
3602
|
+
To access your database from a JavaScript/TypeScript app, you need to use Prisma ORM. Go here for step-by-step instructions: ${internals.link(
|
|
3603
|
+
"https://pris.ly/ppg-init"
|
|
3604
|
+
)}
|
|
3605
|
+
`;
|
|
3606
|
+
const existingPrismaProjectOutput = `
|
|
3607
|
+
We found an existing ${green2("schema.prisma")} file in your current project directory.
|
|
3608
|
+
|
|
3609
|
+
${bold2("--- Database URL ---")}
|
|
3610
|
+
|
|
3611
|
+
Connect Prisma ORM to your Prisma Postgres database with this URL:
|
|
3612
|
+
|
|
3613
|
+
${green2(databaseUrl)}
|
|
3614
|
+
|
|
3615
|
+
${bold2("--- Next steps ---")}
|
|
3616
|
+
|
|
3617
|
+
Go to ${internals.link("https://pris.ly/ppg-init")} for detailed instructions.
|
|
3618
|
+
|
|
3619
|
+
${bold2("1. Install the Postgres adapter")}
|
|
3620
|
+
${green2("npm install @prisma/adapter-pg")}
|
|
3621
|
+
|
|
3622
|
+
...and add it to your Prisma Client instance:
|
|
3623
|
+
${green2('import { PrismaPg } from "@prisma/adapter-pg";')}
|
|
3624
|
+
${green2('import { PrismaClient } from "./generated/prisma/client";')}
|
|
3625
|
+
|
|
3626
|
+
${green2("const connectionString = `${process.env.DATABASE_URL}`;")}
|
|
3627
|
+
|
|
3628
|
+
${green2("const adapter = new PrismaPg({ connectionString });")}
|
|
3629
|
+
${green2("const prisma = new PrismaClient({ adapter });")}
|
|
3630
|
+
|
|
3631
|
+
${bold2("2. Apply migrations")}
|
|
3632
|
+
Run the following command to create and apply a migration:
|
|
3633
|
+
${green2("npx prisma migrate dev")}
|
|
3634
|
+
|
|
3635
|
+
${bold2(`3. Manage your data`)}
|
|
3636
|
+
View and edit your data locally by running this command:
|
|
3637
|
+
${green2("npx prisma studio")}
|
|
3638
|
+
${environmentId !== void 0 ? `...or online in Console:
|
|
3639
|
+
${internals.link(`https://console.prisma.io/${workspaceId}/${projectId}/${environmentId}/studio`)}
|
|
3640
|
+
` : ""}
|
|
3641
|
+
${bold2(`4. Send queries from your app`)}
|
|
3642
|
+
If you already have an existing app with Prisma ORM, you can now run it and it will send queries against your newly created Prisma Postgres instance.
|
|
3643
|
+
|
|
3644
|
+
${bold2(`5. Learn more`)}
|
|
3645
|
+
For more info, visit the Prisma Postgres docs: ${internals.link("https://pris.ly/ppg-docs")}
|
|
3646
|
+
`;
|
|
3647
|
+
return isExistingPrismaProject ? existingPrismaProjectOutput : newPrismaProjectOutput;
|
|
3648
|
+
};
|
|
3312
3649
|
var Init = class _Init {
|
|
3313
3650
|
static new() {
|
|
3314
3651
|
return new _Init();
|
|
@@ -3429,18 +3766,15 @@ var Init = class _Init {
|
|
|
3429
3766
|
console.log(`[isBun]`, isBun);
|
|
3430
3767
|
}
|
|
3431
3768
|
let prismaPostgresDatabaseUrl;
|
|
3432
|
-
let workspaceId
|
|
3433
|
-
let projectId
|
|
3434
|
-
let environmentId
|
|
3769
|
+
let workspaceId;
|
|
3770
|
+
let projectId;
|
|
3771
|
+
let environmentId;
|
|
3435
3772
|
const outputDir = process.cwd();
|
|
3436
|
-
const prismaFolder =
|
|
3773
|
+
const prismaFolder = path3.join(outputDir, "prisma");
|
|
3437
3774
|
let generatedSchema;
|
|
3438
3775
|
let generatedName;
|
|
3439
3776
|
if (isPpgCommand) {
|
|
3440
|
-
const
|
|
3441
|
-
const credentials = await credentialsFile.load();
|
|
3442
|
-
if (internals.isError(credentials))
|
|
3443
|
-
throw credentials;
|
|
3777
|
+
const credentials = await loadCredentials();
|
|
3444
3778
|
if (!credentials) {
|
|
3445
3779
|
if (args["--non-interactive"]) {
|
|
3446
3780
|
return "Please authenticate before creating a Prisma Postgres project.";
|
|
@@ -3452,8 +3786,7 @@ var Init = class _Init {
|
|
|
3452
3786
|
if (!authAnswer) {
|
|
3453
3787
|
return "Project creation aborted. You need to authenticate to use Prisma Postgres";
|
|
3454
3788
|
}
|
|
3455
|
-
|
|
3456
|
-
console.log(`Successfully authenticated as ${bold2(authenticationResult.email)}.`);
|
|
3789
|
+
await saveCredentials(await login());
|
|
3457
3790
|
}
|
|
3458
3791
|
if (args["--prompt"] || args["--vibe"]) {
|
|
3459
3792
|
const prompt = args["--prompt"] || args["--vibe"] || "";
|
|
@@ -3481,16 +3814,16 @@ var Init = class _Init {
|
|
|
3481
3814
|
spinner2.succeed("Schema is ready");
|
|
3482
3815
|
}
|
|
3483
3816
|
console.log("Let's set up your Prisma Postgres database!");
|
|
3484
|
-
const
|
|
3485
|
-
const
|
|
3486
|
-
const regions = await
|
|
3817
|
+
const client = await createAuthenticatedManagementApiClient();
|
|
3818
|
+
const api = new ManagementApi(client);
|
|
3819
|
+
const regions = await api.getRegions();
|
|
3487
3820
|
const ppgRegionSelection = args["--region"] || await select({
|
|
3488
3821
|
message: "Select your region:",
|
|
3489
3822
|
default: "us-east-1",
|
|
3490
3823
|
choices: regions.map((region) => ({
|
|
3491
|
-
name: `${region.id} - ${region.
|
|
3824
|
+
name: `${region.id} - ${region.name}`,
|
|
3492
3825
|
value: region.id,
|
|
3493
|
-
disabled: region.
|
|
3826
|
+
disabled: region.status !== "available"
|
|
3494
3827
|
})),
|
|
3495
3828
|
loop: true
|
|
3496
3829
|
});
|
|
@@ -3502,41 +3835,25 @@ var Init = class _Init {
|
|
|
3502
3835
|
`Creating project ${bold2(projectDisplayNameAnswer)} (this may take a few seconds)...`
|
|
3503
3836
|
).start();
|
|
3504
3837
|
try {
|
|
3505
|
-
const project = await
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
}
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
() => PlatformCommands.Environment.getEnvironmentOrThrow({
|
|
3518
|
-
environmentId: project.defaultEnvironment.id,
|
|
3519
|
-
token: platformToken
|
|
3520
|
-
}),
|
|
3521
|
-
(environment) => environment.ppg.status === "healthy" && environment.accelerate.status.enabled,
|
|
3522
|
-
5e3,
|
|
3523
|
-
// Poll every 5 seconds
|
|
3524
|
-
12e4
|
|
3525
|
-
// if it takes more than two minutes, bail with an error
|
|
3526
|
-
);
|
|
3527
|
-
const serviceToken = await PlatformCommands.ServiceToken.createOrThrow({
|
|
3528
|
-
token: platformToken,
|
|
3529
|
-
environmentId: project.defaultEnvironment.id,
|
|
3530
|
-
displayName: `database-setup-prismaPostgres-api-key`
|
|
3531
|
-
});
|
|
3532
|
-
prismaPostgresDatabaseUrl = `${internals.PRISMA_POSTGRES_PROTOCOL}//accelerate.prisma-data.net/?api_key=${serviceToken.value}`;
|
|
3838
|
+
const project = await api.createProjectWithDatabase(projectDisplayNameAnswer, ppgRegionSelection);
|
|
3839
|
+
if (!project.database) {
|
|
3840
|
+
throw new Error("Missing database info in response");
|
|
3841
|
+
}
|
|
3842
|
+
if (!project.database.directConnection) {
|
|
3843
|
+
throw new Error("Missing connection string in response");
|
|
3844
|
+
}
|
|
3845
|
+
const { host, user, pass } = project.database.directConnection;
|
|
3846
|
+
prismaPostgresDatabaseUrl = `postgres://${user}:${pass}@${host}/postgres?sslmode=require`;
|
|
3847
|
+
workspaceId = project.workspace.id.replace(/^wksp_/, "");
|
|
3848
|
+
projectId = project.id.replace(/^proj_/, "");
|
|
3849
|
+
environmentId = project.database.id.replace(/^db_/, "");
|
|
3533
3850
|
spinner.succeed(successMessage("Your Prisma Postgres database is ready \u2705"));
|
|
3534
3851
|
} catch (error) {
|
|
3535
3852
|
spinner.fail(error instanceof Error ? error.message : "Something went wrong");
|
|
3536
3853
|
throw error;
|
|
3537
3854
|
}
|
|
3538
3855
|
}
|
|
3539
|
-
if (
|
|
3856
|
+
if (fs3.existsSync(path3.join(outputDir, "schema.prisma")) || fs3.existsSync(prismaFolder) || fs3.existsSync(path3.join(prismaFolder, "schema.prisma"))) {
|
|
3540
3857
|
if (isPpgCommand) {
|
|
3541
3858
|
return printPpgInitOutput({
|
|
3542
3859
|
databaseUrl: prismaPostgresDatabaseUrl,
|
|
@@ -3547,7 +3864,7 @@ var Init = class _Init {
|
|
|
3547
3864
|
});
|
|
3548
3865
|
}
|
|
3549
3866
|
}
|
|
3550
|
-
if (
|
|
3867
|
+
if (fs3.existsSync(path3.join(outputDir, "schema.prisma"))) {
|
|
3551
3868
|
console.log(
|
|
3552
3869
|
printError(`File ${bold2("schema.prisma")} already exists in your project.
|
|
3553
3870
|
Please try again in a project that is not yet using Prisma.
|
|
@@ -3555,7 +3872,7 @@ var Init = class _Init {
|
|
|
3555
3872
|
);
|
|
3556
3873
|
process.exit(1);
|
|
3557
3874
|
}
|
|
3558
|
-
if (
|
|
3875
|
+
if (fs3.existsSync(prismaFolder)) {
|
|
3559
3876
|
console.log(
|
|
3560
3877
|
printError(`A folder called ${bold2("prisma")} already exists in your project.
|
|
3561
3878
|
Please try again in a project that is not yet using Prisma.
|
|
@@ -3563,7 +3880,7 @@ var Init = class _Init {
|
|
|
3563
3880
|
);
|
|
3564
3881
|
process.exit(1);
|
|
3565
3882
|
}
|
|
3566
|
-
if (
|
|
3883
|
+
if (fs3.existsSync(path3.join(prismaFolder, "schema.prisma"))) {
|
|
3567
3884
|
console.log(
|
|
3568
3885
|
printError(`File ${bold2("prisma/schema.prisma")} already exists in your project.
|
|
3569
3886
|
Please try again in a project that is not yet using Prisma.
|
|
@@ -3571,15 +3888,15 @@ var Init = class _Init {
|
|
|
3571
3888
|
);
|
|
3572
3889
|
process.exit(1);
|
|
3573
3890
|
}
|
|
3574
|
-
if (!
|
|
3575
|
-
|
|
3891
|
+
if (!fs3.existsSync(outputDir)) {
|
|
3892
|
+
fs3.mkdirSync(outputDir);
|
|
3576
3893
|
}
|
|
3577
|
-
if (!
|
|
3578
|
-
|
|
3894
|
+
if (!fs3.existsSync(prismaFolder)) {
|
|
3895
|
+
fs3.mkdirSync(prismaFolder);
|
|
3579
3896
|
}
|
|
3580
3897
|
const clientOutput = output ?? determineClientOutputPath(prismaFolder);
|
|
3581
|
-
|
|
3582
|
-
|
|
3898
|
+
fs3.writeFileSync(
|
|
3899
|
+
path3.join(prismaFolder, "schema.prisma"),
|
|
3583
3900
|
generatedSchema || defaultSchema({
|
|
3584
3901
|
datasourceProvider,
|
|
3585
3902
|
generatorProvider,
|
|
@@ -3590,26 +3907,26 @@ var Init = class _Init {
|
|
|
3590
3907
|
);
|
|
3591
3908
|
const databaseUrl = prismaPostgresDatabaseUrl || url2;
|
|
3592
3909
|
const warnings = [];
|
|
3593
|
-
|
|
3594
|
-
|
|
3910
|
+
fs3.writeFileSync(
|
|
3911
|
+
path3.join(outputDir, "prisma.config.ts"),
|
|
3595
3912
|
defaultConfig({
|
|
3596
3913
|
prismaFolder
|
|
3597
3914
|
})
|
|
3598
3915
|
);
|
|
3599
|
-
const envPath =
|
|
3600
|
-
if (!
|
|
3601
|
-
|
|
3916
|
+
const envPath = path3.join(outputDir, ".env");
|
|
3917
|
+
if (!fs3.existsSync(envPath)) {
|
|
3918
|
+
fs3.writeFileSync(envPath, await defaultEnv(databaseUrl, args["--debug"]));
|
|
3602
3919
|
} else {
|
|
3603
|
-
const envFile =
|
|
3920
|
+
const envFile = fs3.readFileSync(envPath, { encoding: "utf8" });
|
|
3604
3921
|
const config = dotenv.parse(envFile);
|
|
3605
3922
|
if (Object.keys(config).includes("DATABASE_URL")) {
|
|
3606
3923
|
warnings.push(
|
|
3607
3924
|
`${yellow("warn")} Prisma would have added DATABASE_URL but it already exists in ${bold2(
|
|
3608
|
-
|
|
3925
|
+
path3.relative(outputDir, envPath)
|
|
3609
3926
|
)}`
|
|
3610
3927
|
);
|
|
3611
3928
|
} else {
|
|
3612
|
-
|
|
3929
|
+
fs3.appendFileSync(
|
|
3613
3930
|
envPath,
|
|
3614
3931
|
`
|
|
3615
3932
|
|
|
@@ -3618,9 +3935,9 @@ var Init = class _Init {
|
|
|
3618
3935
|
);
|
|
3619
3936
|
}
|
|
3620
3937
|
}
|
|
3621
|
-
const gitignorePath =
|
|
3938
|
+
const gitignorePath = path3.join(outputDir, ".gitignore");
|
|
3622
3939
|
try {
|
|
3623
|
-
|
|
3940
|
+
fs3.writeFileSync(gitignorePath, defaultGitIgnore(), { flag: "wx" });
|
|
3624
3941
|
} catch (e) {
|
|
3625
3942
|
if (e.code === "EEXIST") {
|
|
3626
3943
|
warnings.push(
|
|
@@ -3632,50 +3949,52 @@ var Init = class _Init {
|
|
|
3632
3949
|
console.error("Failed to write .gitignore file, reason: ", e);
|
|
3633
3950
|
}
|
|
3634
3951
|
}
|
|
3635
|
-
const clientPathRelativeToOutputDir =
|
|
3952
|
+
const clientPathRelativeToOutputDir = path3.relative(outputDir, path3.resolve(prismaFolder, clientOutput));
|
|
3636
3953
|
try {
|
|
3637
|
-
|
|
3638
|
-
/${clientPathRelativeToOutputDir.replaceAll(
|
|
3954
|
+
fs3.appendFileSync(gitignorePath, `
|
|
3955
|
+
/${clientPathRelativeToOutputDir.replaceAll(path3.sep, "/")}
|
|
3639
3956
|
`);
|
|
3640
3957
|
} catch (e) {
|
|
3641
3958
|
console.error("Failed to append client path to .gitignore file, reason: ", e);
|
|
3642
3959
|
}
|
|
3643
3960
|
const steps = [];
|
|
3644
3961
|
if (!isBun) {
|
|
3645
|
-
steps.push(
|
|
3962
|
+
steps.push(
|
|
3963
|
+
`Install \`dotenv\`, and add \`import "dotenv/config";\` to your \`prisma.config.ts\` file to load environment variables from \`.env\`.`
|
|
3964
|
+
);
|
|
3646
3965
|
}
|
|
3647
3966
|
const isPrismaDev = !args["--url"] && (datasourceProvider === "postgres" || datasourceProvider === "postgresql");
|
|
3648
3967
|
if (isPrismaDev) {
|
|
3649
3968
|
steps.push(
|
|
3650
|
-
`Run ${
|
|
3969
|
+
`Run ${green2(internals.getCommandWithExecutor("prisma dev"))} to start a local Prisma Postgres server.`
|
|
3651
3970
|
);
|
|
3652
3971
|
} else if (!args["--url"]) {
|
|
3653
3972
|
steps.push(
|
|
3654
|
-
`Set the ${
|
|
3973
|
+
`Set the ${green2("DATABASE_URL")} in the ${green2(
|
|
3655
3974
|
".env"
|
|
3656
3975
|
)} file to point to your existing database. If your database has no ${datasourceProvider === "mongodb" ? "collections" : "tables"} yet, read https://pris.ly/d/getting-started`
|
|
3657
3976
|
);
|
|
3658
3977
|
}
|
|
3659
3978
|
if (isPrismaDev || datasourceProvider === "mongodb") {
|
|
3660
|
-
steps.push(`Define models in the ${
|
|
3979
|
+
steps.push(`Define models in the ${green2("schema.prisma")} file.`);
|
|
3661
3980
|
} else {
|
|
3662
3981
|
steps.push(
|
|
3663
|
-
`Run ${
|
|
3982
|
+
`Run ${green2(internals.getCommandWithExecutor("prisma db pull"))} to turn your database schema into a Prisma schema.`
|
|
3664
3983
|
);
|
|
3665
3984
|
}
|
|
3666
3985
|
if (isPrismaDev) {
|
|
3667
3986
|
steps.push(
|
|
3668
|
-
`Run ${
|
|
3987
|
+
`Run ${green2(internals.getCommandWithExecutor("prisma migrate dev"))} to migrate your local Prisma Postgres database.`
|
|
3669
3988
|
);
|
|
3670
3989
|
} else {
|
|
3671
3990
|
steps.push(
|
|
3672
|
-
`Run ${
|
|
3991
|
+
`Run ${green2(
|
|
3673
3992
|
internals.getCommandWithExecutor("prisma generate")
|
|
3674
3993
|
)} to generate the Prisma Client. You can then start querying your database.`
|
|
3675
3994
|
);
|
|
3676
3995
|
}
|
|
3677
3996
|
steps.push(
|
|
3678
|
-
`Tip: Explore how you can extend the ${
|
|
3997
|
+
`Tip: Explore how you can extend the ${green2(
|
|
3679
3998
|
"ORM"
|
|
3680
3999
|
)} with scalable connection pooling, global caching, and a managed serverless Postgres database. Read: https://pris.ly/cli/beyond-orm`
|
|
3681
4000
|
);
|
|
@@ -3684,8 +4003,8 @@ var Init = class _Init {
|
|
|
3684
4003
|
See: https://pris.ly/prisma-config-env-vars.`);
|
|
3685
4004
|
}
|
|
3686
4005
|
const defaultOutput = `
|
|
3687
|
-
\u2714 Your Prisma schema was created at ${
|
|
3688
|
-
\u2714 Your Prisma config was created at ${
|
|
4006
|
+
\u2714 Your Prisma schema was created at ${green2("prisma/schema.prisma")}
|
|
4007
|
+
\u2714 Your Prisma config was created at ${green2("prisma.config.ts")}
|
|
3689
4008
|
You can now open them in your favorite editor.
|
|
3690
4009
|
${warnings.length > 0 && internals.logger.should.warn() ? `
|
|
3691
4010
|
${warnings.join("\n")}
|
|
@@ -3696,7 +4015,12 @@ ${steps.map((s2, i) => `${i + 1}. ${s2}`).join("\n")}
|
|
|
3696
4015
|
More information in our documentation:
|
|
3697
4016
|
${internals.link("https://pris.ly/d/getting-started")}
|
|
3698
4017
|
`;
|
|
3699
|
-
return isPpgCommand ? printPpgInitOutput({
|
|
4018
|
+
return isPpgCommand ? printPpgInitOutput({
|
|
4019
|
+
databaseUrl: prismaPostgresDatabaseUrl,
|
|
4020
|
+
workspaceId,
|
|
4021
|
+
projectId,
|
|
4022
|
+
environmentId
|
|
4023
|
+
}) : defaultOutput;
|
|
3700
4024
|
}
|
|
3701
4025
|
// help message
|
|
3702
4026
|
help(error) {
|