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