drizzle-kit 0.22.0-3b0ba5f → 0.22.0-5b09380
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +16869 -10261
- package/index.d.mts +9 -1
- package/index.d.ts +9 -1
- package/package.json +2 -1
- package/payload.js +182 -97
- package/payload.mjs +167 -82
- package/utils-studio.js +591 -12
- package/utils-studio.mjs +591 -12
- package/utils.js +29 -1
- package/utils.mjs +28 -1
package/utils-studio.mjs
CHANGED
@@ -34,6 +34,516 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
34
34
|
mod
|
35
35
|
));
|
36
36
|
|
37
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
38
|
+
function assembleStyles() {
|
39
|
+
const codes = /* @__PURE__ */ new Map();
|
40
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
41
|
+
for (const [styleName, style] of Object.entries(group)) {
|
42
|
+
styles[styleName] = {
|
43
|
+
open: `\x1B[${style[0]}m`,
|
44
|
+
close: `\x1B[${style[1]}m`
|
45
|
+
};
|
46
|
+
group[styleName] = styles[styleName];
|
47
|
+
codes.set(style[0], style[1]);
|
48
|
+
}
|
49
|
+
Object.defineProperty(styles, groupName, {
|
50
|
+
value: group,
|
51
|
+
enumerable: false
|
52
|
+
});
|
53
|
+
}
|
54
|
+
Object.defineProperty(styles, "codes", {
|
55
|
+
value: codes,
|
56
|
+
enumerable: false
|
57
|
+
});
|
58
|
+
styles.color.close = "\x1B[39m";
|
59
|
+
styles.bgColor.close = "\x1B[49m";
|
60
|
+
styles.color.ansi = wrapAnsi16();
|
61
|
+
styles.color.ansi256 = wrapAnsi256();
|
62
|
+
styles.color.ansi16m = wrapAnsi16m();
|
63
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
64
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
65
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
66
|
+
Object.defineProperties(styles, {
|
67
|
+
rgbToAnsi256: {
|
68
|
+
value(red, green, blue) {
|
69
|
+
if (red === green && green === blue) {
|
70
|
+
if (red < 8) {
|
71
|
+
return 16;
|
72
|
+
}
|
73
|
+
if (red > 248) {
|
74
|
+
return 231;
|
75
|
+
}
|
76
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
77
|
+
}
|
78
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
79
|
+
},
|
80
|
+
enumerable: false
|
81
|
+
},
|
82
|
+
hexToRgb: {
|
83
|
+
value(hex) {
|
84
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
85
|
+
if (!matches) {
|
86
|
+
return [0, 0, 0];
|
87
|
+
}
|
88
|
+
let [colorString] = matches;
|
89
|
+
if (colorString.length === 3) {
|
90
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
91
|
+
}
|
92
|
+
const integer = Number.parseInt(colorString, 16);
|
93
|
+
return [
|
94
|
+
/* eslint-disable no-bitwise */
|
95
|
+
integer >> 16 & 255,
|
96
|
+
integer >> 8 & 255,
|
97
|
+
integer & 255
|
98
|
+
/* eslint-enable no-bitwise */
|
99
|
+
];
|
100
|
+
},
|
101
|
+
enumerable: false
|
102
|
+
},
|
103
|
+
hexToAnsi256: {
|
104
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
105
|
+
enumerable: false
|
106
|
+
},
|
107
|
+
ansi256ToAnsi: {
|
108
|
+
value(code) {
|
109
|
+
if (code < 8) {
|
110
|
+
return 30 + code;
|
111
|
+
}
|
112
|
+
if (code < 16) {
|
113
|
+
return 90 + (code - 8);
|
114
|
+
}
|
115
|
+
let red;
|
116
|
+
let green;
|
117
|
+
let blue;
|
118
|
+
if (code >= 232) {
|
119
|
+
red = ((code - 232) * 10 + 8) / 255;
|
120
|
+
green = red;
|
121
|
+
blue = red;
|
122
|
+
} else {
|
123
|
+
code -= 16;
|
124
|
+
const remainder = code % 36;
|
125
|
+
red = Math.floor(code / 36) / 5;
|
126
|
+
green = Math.floor(remainder / 6) / 5;
|
127
|
+
blue = remainder % 6 / 5;
|
128
|
+
}
|
129
|
+
const value = Math.max(red, green, blue) * 2;
|
130
|
+
if (value === 0) {
|
131
|
+
return 30;
|
132
|
+
}
|
133
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
134
|
+
if (value === 2) {
|
135
|
+
result += 60;
|
136
|
+
}
|
137
|
+
return result;
|
138
|
+
},
|
139
|
+
enumerable: false
|
140
|
+
},
|
141
|
+
rgbToAnsi: {
|
142
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
143
|
+
enumerable: false
|
144
|
+
},
|
145
|
+
hexToAnsi: {
|
146
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
147
|
+
enumerable: false
|
148
|
+
}
|
149
|
+
});
|
150
|
+
return styles;
|
151
|
+
}
|
152
|
+
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
153
|
+
var init_ansi_styles = __esm({
|
154
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
155
|
+
ANSI_BACKGROUND_OFFSET = 10;
|
156
|
+
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
157
|
+
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
158
|
+
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
159
|
+
styles = {
|
160
|
+
modifier: {
|
161
|
+
reset: [0, 0],
|
162
|
+
// 21 isn't widely supported and 22 does the same thing
|
163
|
+
bold: [1, 22],
|
164
|
+
dim: [2, 22],
|
165
|
+
italic: [3, 23],
|
166
|
+
underline: [4, 24],
|
167
|
+
overline: [53, 55],
|
168
|
+
inverse: [7, 27],
|
169
|
+
hidden: [8, 28],
|
170
|
+
strikethrough: [9, 29]
|
171
|
+
},
|
172
|
+
color: {
|
173
|
+
black: [30, 39],
|
174
|
+
red: [31, 39],
|
175
|
+
green: [32, 39],
|
176
|
+
yellow: [33, 39],
|
177
|
+
blue: [34, 39],
|
178
|
+
magenta: [35, 39],
|
179
|
+
cyan: [36, 39],
|
180
|
+
white: [37, 39],
|
181
|
+
// Bright color
|
182
|
+
blackBright: [90, 39],
|
183
|
+
gray: [90, 39],
|
184
|
+
// Alias of `blackBright`
|
185
|
+
grey: [90, 39],
|
186
|
+
// Alias of `blackBright`
|
187
|
+
redBright: [91, 39],
|
188
|
+
greenBright: [92, 39],
|
189
|
+
yellowBright: [93, 39],
|
190
|
+
blueBright: [94, 39],
|
191
|
+
magentaBright: [95, 39],
|
192
|
+
cyanBright: [96, 39],
|
193
|
+
whiteBright: [97, 39]
|
194
|
+
},
|
195
|
+
bgColor: {
|
196
|
+
bgBlack: [40, 49],
|
197
|
+
bgRed: [41, 49],
|
198
|
+
bgGreen: [42, 49],
|
199
|
+
bgYellow: [43, 49],
|
200
|
+
bgBlue: [44, 49],
|
201
|
+
bgMagenta: [45, 49],
|
202
|
+
bgCyan: [46, 49],
|
203
|
+
bgWhite: [47, 49],
|
204
|
+
// Bright color
|
205
|
+
bgBlackBright: [100, 49],
|
206
|
+
bgGray: [100, 49],
|
207
|
+
// Alias of `bgBlackBright`
|
208
|
+
bgGrey: [100, 49],
|
209
|
+
// Alias of `bgBlackBright`
|
210
|
+
bgRedBright: [101, 49],
|
211
|
+
bgGreenBright: [102, 49],
|
212
|
+
bgYellowBright: [103, 49],
|
213
|
+
bgBlueBright: [104, 49],
|
214
|
+
bgMagentaBright: [105, 49],
|
215
|
+
bgCyanBright: [106, 49],
|
216
|
+
bgWhiteBright: [107, 49]
|
217
|
+
}
|
218
|
+
};
|
219
|
+
modifierNames = Object.keys(styles.modifier);
|
220
|
+
foregroundColorNames = Object.keys(styles.color);
|
221
|
+
backgroundColorNames = Object.keys(styles.bgColor);
|
222
|
+
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
223
|
+
ansiStyles = assembleStyles();
|
224
|
+
ansi_styles_default = ansiStyles;
|
225
|
+
}
|
226
|
+
});
|
227
|
+
|
228
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
229
|
+
import process2 from "node:process";
|
230
|
+
import os from "node:os";
|
231
|
+
import tty from "node:tty";
|
232
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
233
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
234
|
+
const position = argv.indexOf(prefix + flag);
|
235
|
+
const terminatorPosition = argv.indexOf("--");
|
236
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
237
|
+
}
|
238
|
+
function envForceColor() {
|
239
|
+
if ("FORCE_COLOR" in env) {
|
240
|
+
if (env.FORCE_COLOR === "true") {
|
241
|
+
return 1;
|
242
|
+
}
|
243
|
+
if (env.FORCE_COLOR === "false") {
|
244
|
+
return 0;
|
245
|
+
}
|
246
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
function translateLevel(level) {
|
250
|
+
if (level === 0) {
|
251
|
+
return false;
|
252
|
+
}
|
253
|
+
return {
|
254
|
+
level,
|
255
|
+
hasBasic: true,
|
256
|
+
has256: level >= 2,
|
257
|
+
has16m: level >= 3
|
258
|
+
};
|
259
|
+
}
|
260
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
261
|
+
const noFlagForceColor = envForceColor();
|
262
|
+
if (noFlagForceColor !== void 0) {
|
263
|
+
flagForceColor = noFlagForceColor;
|
264
|
+
}
|
265
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
266
|
+
if (forceColor === 0) {
|
267
|
+
return 0;
|
268
|
+
}
|
269
|
+
if (sniffFlags) {
|
270
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
271
|
+
return 3;
|
272
|
+
}
|
273
|
+
if (hasFlag("color=256")) {
|
274
|
+
return 2;
|
275
|
+
}
|
276
|
+
}
|
277
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
278
|
+
return 1;
|
279
|
+
}
|
280
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
281
|
+
return 0;
|
282
|
+
}
|
283
|
+
const min = forceColor || 0;
|
284
|
+
if (env.TERM === "dumb") {
|
285
|
+
return min;
|
286
|
+
}
|
287
|
+
if (process2.platform === "win32") {
|
288
|
+
const osRelease = os.release().split(".");
|
289
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
290
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
291
|
+
}
|
292
|
+
return 1;
|
293
|
+
}
|
294
|
+
if ("CI" in env) {
|
295
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
296
|
+
return 3;
|
297
|
+
}
|
298
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
299
|
+
return 1;
|
300
|
+
}
|
301
|
+
return min;
|
302
|
+
}
|
303
|
+
if ("TEAMCITY_VERSION" in env) {
|
304
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
305
|
+
}
|
306
|
+
if (env.COLORTERM === "truecolor") {
|
307
|
+
return 3;
|
308
|
+
}
|
309
|
+
if (env.TERM === "xterm-kitty") {
|
310
|
+
return 3;
|
311
|
+
}
|
312
|
+
if ("TERM_PROGRAM" in env) {
|
313
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
314
|
+
switch (env.TERM_PROGRAM) {
|
315
|
+
case "iTerm.app": {
|
316
|
+
return version >= 3 ? 3 : 2;
|
317
|
+
}
|
318
|
+
case "Apple_Terminal": {
|
319
|
+
return 2;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
324
|
+
return 2;
|
325
|
+
}
|
326
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
327
|
+
return 1;
|
328
|
+
}
|
329
|
+
if ("COLORTERM" in env) {
|
330
|
+
return 1;
|
331
|
+
}
|
332
|
+
return min;
|
333
|
+
}
|
334
|
+
function createSupportsColor(stream, options = {}) {
|
335
|
+
const level = _supportsColor(stream, {
|
336
|
+
streamIsTTY: stream && stream.isTTY,
|
337
|
+
...options
|
338
|
+
});
|
339
|
+
return translateLevel(level);
|
340
|
+
}
|
341
|
+
var env, flagForceColor, supportsColor, supports_color_default;
|
342
|
+
var init_supports_color = __esm({
|
343
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
344
|
+
({ env } = process2);
|
345
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
346
|
+
flagForceColor = 0;
|
347
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
348
|
+
flagForceColor = 1;
|
349
|
+
}
|
350
|
+
supportsColor = {
|
351
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
352
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
353
|
+
};
|
354
|
+
supports_color_default = supportsColor;
|
355
|
+
}
|
356
|
+
});
|
357
|
+
|
358
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
359
|
+
function stringReplaceAll(string, substring, replacer) {
|
360
|
+
let index4 = string.indexOf(substring);
|
361
|
+
if (index4 === -1) {
|
362
|
+
return string;
|
363
|
+
}
|
364
|
+
const substringLength = substring.length;
|
365
|
+
let endIndex = 0;
|
366
|
+
let returnValue = "";
|
367
|
+
do {
|
368
|
+
returnValue += string.slice(endIndex, index4) + substring + replacer;
|
369
|
+
endIndex = index4 + substringLength;
|
370
|
+
index4 = string.indexOf(substring, endIndex);
|
371
|
+
} while (index4 !== -1);
|
372
|
+
returnValue += string.slice(endIndex);
|
373
|
+
return returnValue;
|
374
|
+
}
|
375
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
|
376
|
+
let endIndex = 0;
|
377
|
+
let returnValue = "";
|
378
|
+
do {
|
379
|
+
const gotCR = string[index4 - 1] === "\r";
|
380
|
+
returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
381
|
+
endIndex = index4 + 1;
|
382
|
+
index4 = string.indexOf("\n", endIndex);
|
383
|
+
} while (index4 !== -1);
|
384
|
+
returnValue += string.slice(endIndex);
|
385
|
+
return returnValue;
|
386
|
+
}
|
387
|
+
var init_utilities = __esm({
|
388
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|
392
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
393
|
+
function createChalk(options) {
|
394
|
+
return chalkFactory(options);
|
395
|
+
}
|
396
|
+
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
397
|
+
var init_source = __esm({
|
398
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
399
|
+
init_ansi_styles();
|
400
|
+
init_supports_color();
|
401
|
+
init_utilities();
|
402
|
+
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
403
|
+
GENERATOR = Symbol("GENERATOR");
|
404
|
+
STYLER = Symbol("STYLER");
|
405
|
+
IS_EMPTY = Symbol("IS_EMPTY");
|
406
|
+
levelMapping = [
|
407
|
+
"ansi",
|
408
|
+
"ansi",
|
409
|
+
"ansi256",
|
410
|
+
"ansi16m"
|
411
|
+
];
|
412
|
+
styles2 = /* @__PURE__ */ Object.create(null);
|
413
|
+
applyOptions = (object, options = {}) => {
|
414
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
415
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
416
|
+
}
|
417
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
418
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
419
|
+
};
|
420
|
+
chalkFactory = (options) => {
|
421
|
+
const chalk2 = (...strings) => strings.join(" ");
|
422
|
+
applyOptions(chalk2, options);
|
423
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
424
|
+
return chalk2;
|
425
|
+
};
|
426
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
427
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
428
|
+
styles2[styleName] = {
|
429
|
+
get() {
|
430
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
431
|
+
Object.defineProperty(this, styleName, { value: builder });
|
432
|
+
return builder;
|
433
|
+
}
|
434
|
+
};
|
435
|
+
}
|
436
|
+
styles2.visible = {
|
437
|
+
get() {
|
438
|
+
const builder = createBuilder(this, this[STYLER], true);
|
439
|
+
Object.defineProperty(this, "visible", { value: builder });
|
440
|
+
return builder;
|
441
|
+
}
|
442
|
+
};
|
443
|
+
getModelAnsi = (model, level, type, ...arguments_) => {
|
444
|
+
if (model === "rgb") {
|
445
|
+
if (level === "ansi16m") {
|
446
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
447
|
+
}
|
448
|
+
if (level === "ansi256") {
|
449
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
450
|
+
}
|
451
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
452
|
+
}
|
453
|
+
if (model === "hex") {
|
454
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
455
|
+
}
|
456
|
+
return ansi_styles_default[type][model](...arguments_);
|
457
|
+
};
|
458
|
+
usedModels = ["rgb", "hex", "ansi256"];
|
459
|
+
for (const model of usedModels) {
|
460
|
+
styles2[model] = {
|
461
|
+
get() {
|
462
|
+
const { level } = this;
|
463
|
+
return function(...arguments_) {
|
464
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
465
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
466
|
+
};
|
467
|
+
}
|
468
|
+
};
|
469
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
470
|
+
styles2[bgModel] = {
|
471
|
+
get() {
|
472
|
+
const { level } = this;
|
473
|
+
return function(...arguments_) {
|
474
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
475
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
476
|
+
};
|
477
|
+
}
|
478
|
+
};
|
479
|
+
}
|
480
|
+
proto = Object.defineProperties(() => {
|
481
|
+
}, {
|
482
|
+
...styles2,
|
483
|
+
level: {
|
484
|
+
enumerable: true,
|
485
|
+
get() {
|
486
|
+
return this[GENERATOR].level;
|
487
|
+
},
|
488
|
+
set(level) {
|
489
|
+
this[GENERATOR].level = level;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
});
|
493
|
+
createStyler = (open, close, parent) => {
|
494
|
+
let openAll;
|
495
|
+
let closeAll;
|
496
|
+
if (parent === void 0) {
|
497
|
+
openAll = open;
|
498
|
+
closeAll = close;
|
499
|
+
} else {
|
500
|
+
openAll = parent.openAll + open;
|
501
|
+
closeAll = close + parent.closeAll;
|
502
|
+
}
|
503
|
+
return {
|
504
|
+
open,
|
505
|
+
close,
|
506
|
+
openAll,
|
507
|
+
closeAll,
|
508
|
+
parent
|
509
|
+
};
|
510
|
+
};
|
511
|
+
createBuilder = (self2, _styler, _isEmpty) => {
|
512
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
513
|
+
Object.setPrototypeOf(builder, proto);
|
514
|
+
builder[GENERATOR] = self2;
|
515
|
+
builder[STYLER] = _styler;
|
516
|
+
builder[IS_EMPTY] = _isEmpty;
|
517
|
+
return builder;
|
518
|
+
};
|
519
|
+
applyStyle = (self2, string) => {
|
520
|
+
if (self2.level <= 0 || !string) {
|
521
|
+
return self2[IS_EMPTY] ? "" : string;
|
522
|
+
}
|
523
|
+
let styler = self2[STYLER];
|
524
|
+
if (styler === void 0) {
|
525
|
+
return string;
|
526
|
+
}
|
527
|
+
const { openAll, closeAll } = styler;
|
528
|
+
if (string.includes("\x1B")) {
|
529
|
+
while (styler !== void 0) {
|
530
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
531
|
+
styler = styler.parent;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
const lfIndex = string.indexOf("\n");
|
535
|
+
if (lfIndex !== -1) {
|
536
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
537
|
+
}
|
538
|
+
return openAll + string + closeAll;
|
539
|
+
};
|
540
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
541
|
+
chalk = createChalk();
|
542
|
+
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
543
|
+
source_default = chalk;
|
544
|
+
}
|
545
|
+
});
|
546
|
+
|
37
547
|
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
|
38
548
|
var require_readline = __commonJS({
|
39
549
|
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
|
@@ -546,7 +1056,7 @@ var require_hanji = __commonJS({
|
|
546
1056
|
return;
|
547
1057
|
}
|
548
1058
|
exports.render = render2;
|
549
|
-
function
|
1059
|
+
function renderWithTask3(view, task) {
|
550
1060
|
return __awaiter(this, void 0, void 0, function* () {
|
551
1061
|
const terminal = new TaskTerminal(view, process.stdout);
|
552
1062
|
terminal.requestLayout();
|
@@ -555,7 +1065,7 @@ var require_hanji = __commonJS({
|
|
555
1065
|
return result;
|
556
1066
|
});
|
557
1067
|
}
|
558
|
-
exports.renderWithTask =
|
1068
|
+
exports.renderWithTask = renderWithTask3;
|
559
1069
|
var terminateHandler;
|
560
1070
|
function onTerminate(callback) {
|
561
1071
|
terminateHandler = callback;
|
@@ -4965,12 +5475,49 @@ var init_utils = __esm({
|
|
4965
5475
|
});
|
4966
5476
|
|
4967
5477
|
// src/cli/views.ts
|
4968
|
-
var import_hanji;
|
5478
|
+
var import_hanji, Spinner, ProgressView;
|
4969
5479
|
var init_views = __esm({
|
4970
5480
|
"src/cli/views.ts"() {
|
4971
5481
|
"use strict";
|
5482
|
+
init_source();
|
4972
5483
|
import_hanji = __toESM(require_hanji());
|
4973
5484
|
init_utils();
|
5485
|
+
Spinner = class {
|
5486
|
+
constructor(frames) {
|
5487
|
+
this.frames = frames;
|
5488
|
+
this.offset = 0;
|
5489
|
+
this.tick = () => {
|
5490
|
+
this.iterator();
|
5491
|
+
};
|
5492
|
+
this.value = () => {
|
5493
|
+
return this.frames[this.offset];
|
5494
|
+
};
|
5495
|
+
this.iterator = () => {
|
5496
|
+
this.offset += 1;
|
5497
|
+
this.offset %= frames.length - 1;
|
5498
|
+
};
|
5499
|
+
}
|
5500
|
+
};
|
5501
|
+
ProgressView = class extends import_hanji.TaskView {
|
5502
|
+
constructor(progressText, successText) {
|
5503
|
+
super();
|
5504
|
+
this.progressText = progressText;
|
5505
|
+
this.successText = successText;
|
5506
|
+
this.spinner = new Spinner("\u28F7\u28EF\u28DF\u287F\u28BF\u28FB\u28FD\u28FE".split(""));
|
5507
|
+
this.timeout = setInterval(() => {
|
5508
|
+
this.spinner.tick();
|
5509
|
+
this.requestLayout();
|
5510
|
+
}, 128);
|
5511
|
+
this.on("detach", () => clearInterval(this.timeout));
|
5512
|
+
}
|
5513
|
+
render(status) {
|
5514
|
+
if (status === "pending") {
|
5515
|
+
const spin = this.spinner.value();
|
5516
|
+
return `[${spin}] ${this.progressText}`;
|
5517
|
+
}
|
5518
|
+
return `[${source_default.green("\u2713")}] ${this.successText}`;
|
5519
|
+
}
|
5520
|
+
};
|
4974
5521
|
}
|
4975
5522
|
});
|
4976
5523
|
|
@@ -5052,12 +5599,24 @@ var init_sqliteSerializer = __esm({
|
|
5052
5599
|
`SELECT
|
5053
5600
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
5054
5601
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
5055
|
-
WHERE m.type = 'table'
|
5602
|
+
WHERE m.type = 'table'
|
5603
|
+
and m.tbl_name != 'sqlite_sequence'
|
5604
|
+
and m.tbl_name != 'sqlite_stat1'
|
5605
|
+
and m.tbl_name != '_litestream_seq'
|
5606
|
+
and m.tbl_name != '_litestream_lock'
|
5607
|
+
and m.tbl_name != 'libsql_wasm_func_table'
|
5608
|
+
and m.tbl_name != '__drizzle_migrations'
|
5609
|
+
and m.tbl_name != '_cf_KV';
|
5056
5610
|
`
|
5057
5611
|
);
|
5058
5612
|
const tablesWithSeq = [];
|
5059
5613
|
const seq = await db.query(
|
5060
|
-
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
|
5614
|
+
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
|
5615
|
+
and name != 'sqlite_stat1'
|
5616
|
+
and name != '_litestream_seq'
|
5617
|
+
and name != '_litestream_lock'
|
5618
|
+
and tbl_name != '_cf_KV'
|
5619
|
+
and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
|
5061
5620
|
);
|
5062
5621
|
for (const s of seq) {
|
5063
5622
|
tablesWithSeq.push(s.name);
|
@@ -5142,7 +5701,8 @@ var init_sqliteSerializer = __esm({
|
|
5142
5701
|
try {
|
5143
5702
|
const fks = await db.query(
|
5144
5703
|
`SELECT m.name as "tableFrom", f.id as "id", f."table" as "tableTo", f."from", f."to", f."on_update" as "onUpdate", f."on_delete" as "onDelete", f.seq as "seq"
|
5145
|
-
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5704
|
+
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5705
|
+
where m.tbl_name != '_cf_KV';`
|
5146
5706
|
);
|
5147
5707
|
const fkByTableName = {};
|
5148
5708
|
for (const fkRow of fks) {
|
@@ -5201,7 +5761,9 @@ FROM sqlite_master AS m,
|
|
5201
5761
|
pragma_index_list(m.name) AS il,
|
5202
5762
|
pragma_index_info(il.name) AS ii
|
5203
5763
|
WHERE
|
5204
|
-
m.type = 'table'
|
5764
|
+
m.type = 'table'
|
5765
|
+
and il.name NOT LIKE 'sqlite_autoindex_%'
|
5766
|
+
and m.tbl_name != '_cf_KV';`
|
5205
5767
|
);
|
5206
5768
|
for (const idxRow of idxs) {
|
5207
5769
|
const tableName = idxRow.tableName;
|
@@ -5905,6 +6467,7 @@ var init_pgSerializer = __esm({
|
|
5905
6467
|
"time without time zone": "::time without time zone",
|
5906
6468
|
// "timestamp with time zone": "::timestamp with time zone",
|
5907
6469
|
"timestamp without time zone": "::timestamp without time zone",
|
6470
|
+
"timestamp(": "::timestamp without time zone",
|
5908
6471
|
// date: "::date",
|
5909
6472
|
// interval: "::interval",
|
5910
6473
|
// character: "::bpchar",
|
@@ -5917,15 +6480,15 @@ var init_pgSerializer = __esm({
|
|
5917
6480
|
"character(": "::bpchar"
|
5918
6481
|
};
|
5919
6482
|
defaultForColumn = (column4) => {
|
6483
|
+
if (column4.column_default === null) {
|
6484
|
+
return void 0;
|
6485
|
+
}
|
5920
6486
|
if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
|
5921
6487
|
return void 0;
|
5922
6488
|
}
|
5923
6489
|
const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
|
5924
6490
|
(it) => column4.data_type.startsWith(it)
|
5925
6491
|
);
|
5926
|
-
if (column4.column_default === null) {
|
5927
|
-
return void 0;
|
5928
|
-
}
|
5929
6492
|
const columnDefaultAsString = column4.column_default.toString();
|
5930
6493
|
if (columnDefaultAsString.endsWith(
|
5931
6494
|
hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
|
@@ -7317,7 +7880,14 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7317
7880
|
}
|
7318
7881
|
return false;
|
7319
7882
|
};
|
7320
|
-
const
|
7883
|
+
const progress = new ProgressView(
|
7884
|
+
"Pulling schema from database...",
|
7885
|
+
"Pulling schema from database..."
|
7886
|
+
);
|
7887
|
+
const res = await (0, import_hanji2.renderWithTask)(
|
7888
|
+
progress,
|
7889
|
+
fromDatabase(db, filter2)
|
7890
|
+
);
|
7321
7891
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7322
7892
|
return { schema: schema3 };
|
7323
7893
|
};
|
@@ -7325,6 +7895,8 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7325
7895
|
// src/cli/commands/pgIntrospect.ts
|
7326
7896
|
init_pgSerializer();
|
7327
7897
|
init_global();
|
7898
|
+
init_views();
|
7899
|
+
var import_hanji3 = __toESM(require_hanji());
|
7328
7900
|
var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
7329
7901
|
const matchers = filters.map((it) => {
|
7330
7902
|
return new Minimatch(it);
|
@@ -7339,7 +7911,14 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
|
7339
7911
|
}
|
7340
7912
|
return false;
|
7341
7913
|
};
|
7342
|
-
const
|
7914
|
+
const progress = new ProgressView(
|
7915
|
+
"Pulling schema from database...",
|
7916
|
+
"Pulling schema from database..."
|
7917
|
+
);
|
7918
|
+
const res = await (0, import_hanji3.renderWithTask)(
|
7919
|
+
progress,
|
7920
|
+
fromDatabase2(db, filter2, schemaFilters)
|
7921
|
+
);
|
7343
7922
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7344
7923
|
const { internal, ...schemaWithoutInternals } = schema3;
|
7345
7924
|
return { schema: schemaWithoutInternals };
|