drizzle-kit 0.20.17-14a4eaa → 0.20.17-151701
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/@types/utils.d.ts +1 -0
- package/bin.cjs +48 -33
- package/cli/views.d.ts +1 -0
- package/package.json +1 -1
- package/payload.js +3 -0
- package/payload.mjs +3 -0
- package/utils-studio.js +3 -0
- package/utils-studio.mjs +3 -0
package/@types/utils.d.ts
CHANGED
package/bin.cjs
CHANGED
|
@@ -1076,7 +1076,7 @@ var require_hanji = __commonJS({
|
|
|
1076
1076
|
});
|
|
1077
1077
|
|
|
1078
1078
|
// src/cli/views.ts
|
|
1079
|
-
var import_hanji, err, info, error, schema, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, DropMigrationView, trimmedRange;
|
|
1079
|
+
var import_hanji, err, info, grey, error, schema, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, DropMigrationView, trimmedRange;
|
|
1080
1080
|
var init_views = __esm({
|
|
1081
1081
|
"src/cli/views.ts"() {
|
|
1082
1082
|
"use strict";
|
|
@@ -1089,6 +1089,9 @@ var init_views = __esm({
|
|
|
1089
1089
|
info = (msg, greyMsg = "") => {
|
|
1090
1090
|
return `${source_default.blue.bold("Info:")} ${msg} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
|
|
1091
1091
|
};
|
|
1092
|
+
grey = (msg) => {
|
|
1093
|
+
return source_default.grey(msg);
|
|
1094
|
+
};
|
|
1092
1095
|
error = (error2, greyMsg = "") => {
|
|
1093
1096
|
return `${source_default.red.bold("Err:")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
|
|
1094
1097
|
};
|
|
@@ -1339,14 +1342,14 @@ Is ${source_default.bold.blue(
|
|
|
1339
1342
|
this.requestLayout();
|
|
1340
1343
|
}
|
|
1341
1344
|
render() {
|
|
1342
|
-
let
|
|
1345
|
+
let info4 = "";
|
|
1343
1346
|
const spin = this.spinner.value();
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
return
|
|
1347
|
+
info4 += this.statusText(spin, this.state.tables);
|
|
1348
|
+
info4 += this.statusText(spin, this.state.columns);
|
|
1349
|
+
info4 += this.statusText(spin, this.state.enums);
|
|
1350
|
+
info4 += this.statusText(spin, this.state.indexes);
|
|
1351
|
+
info4 += this.statusText(spin, this.state.fks);
|
|
1352
|
+
return info4;
|
|
1350
1353
|
}
|
|
1351
1354
|
};
|
|
1352
1355
|
DropMigrationView = class extends import_hanji.Prompt {
|
|
@@ -8320,6 +8323,9 @@ var init_utils3 = __esm({
|
|
|
8320
8323
|
String.prototype.camelCase = function() {
|
|
8321
8324
|
return camelCase(String(this));
|
|
8322
8325
|
};
|
|
8326
|
+
String.prototype.capitalise = function() {
|
|
8327
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
8328
|
+
};
|
|
8323
8329
|
String.prototype.concatIf = function(it, condition) {
|
|
8324
8330
|
return condition ? `${this}${it}` : String(this);
|
|
8325
8331
|
};
|
|
@@ -11743,13 +11749,13 @@ var require_node2 = __commonJS({
|
|
|
11743
11749
|
}
|
|
11744
11750
|
function asyncGeneratorStep(gen, resolve2, reject, _next, _throw, key, arg) {
|
|
11745
11751
|
try {
|
|
11746
|
-
var
|
|
11747
|
-
var value =
|
|
11752
|
+
var info4 = gen[key](arg);
|
|
11753
|
+
var value = info4.value;
|
|
11748
11754
|
} catch (error2) {
|
|
11749
11755
|
reject(error2);
|
|
11750
11756
|
return;
|
|
11751
11757
|
}
|
|
11752
|
-
if (
|
|
11758
|
+
if (info4.done) {
|
|
11753
11759
|
resolve2(value);
|
|
11754
11760
|
} else {
|
|
11755
11761
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -28299,7 +28305,7 @@ var require_partial = __commonJS({
|
|
|
28299
28305
|
match(filepath) {
|
|
28300
28306
|
const parts = filepath.split("/");
|
|
28301
28307
|
const levels = parts.length;
|
|
28302
|
-
const patterns = this._storage.filter((
|
|
28308
|
+
const patterns = this._storage.filter((info4) => !info4.complete || info4.segments.length > levels);
|
|
28303
28309
|
for (const pattern of patterns) {
|
|
28304
28310
|
const section = pattern.sections[0];
|
|
28305
28311
|
if (!pattern.complete && levels > section.length) {
|
|
@@ -36952,14 +36958,14 @@ var init_dist = __esm({
|
|
|
36952
36958
|
if (typeof global.crypto === "undefined") {
|
|
36953
36959
|
global.crypto = import_crypto2.default;
|
|
36954
36960
|
}
|
|
36955
|
-
global.fetch = (
|
|
36961
|
+
global.fetch = (info4, init2) => {
|
|
36956
36962
|
init2 = {
|
|
36957
36963
|
// Disable compression handling so people can return the result of a fetch
|
|
36958
36964
|
// directly in the loader without messing with the Content-Encoding header.
|
|
36959
36965
|
compress: false,
|
|
36960
36966
|
...init2
|
|
36961
36967
|
};
|
|
36962
|
-
return webFetch(
|
|
36968
|
+
return webFetch(info4, init2);
|
|
36963
36969
|
};
|
|
36964
36970
|
regBuffer = /^no$/i;
|
|
36965
36971
|
regContentType = /^(application\/json\b|text\/(?!event-stream\b))/i;
|
|
@@ -43609,13 +43615,13 @@ var require_websocket_server = __commonJS({
|
|
|
43609
43615
|
}
|
|
43610
43616
|
}
|
|
43611
43617
|
if (this.options.verifyClient) {
|
|
43612
|
-
const
|
|
43618
|
+
const info4 = {
|
|
43613
43619
|
origin: req.headers[`${version2 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
43614
43620
|
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
43615
43621
|
req
|
|
43616
43622
|
};
|
|
43617
43623
|
if (this.options.verifyClient.length === 2) {
|
|
43618
|
-
this.options.verifyClient(
|
|
43624
|
+
this.options.verifyClient(info4, (verified, code, message, headers) => {
|
|
43619
43625
|
if (!verified) {
|
|
43620
43626
|
return abortHandshake(socket, code || 401, message, headers);
|
|
43621
43627
|
}
|
|
@@ -43631,7 +43637,7 @@ var require_websocket_server = __commonJS({
|
|
|
43631
43637
|
});
|
|
43632
43638
|
return;
|
|
43633
43639
|
}
|
|
43634
|
-
if (!this.options.verifyClient(
|
|
43640
|
+
if (!this.options.verifyClient(info4))
|
|
43635
43641
|
return abortHandshake(socket, 401);
|
|
43636
43642
|
}
|
|
43637
43643
|
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
@@ -54993,7 +54999,7 @@ var require_dist_cjs42 = __commonJS({
|
|
|
54993
54999
|
calculateBodyLength: () => calculateBodyLength
|
|
54994
55000
|
});
|
|
54995
55001
|
module2.exports = __toCommonJS2(src_exports2);
|
|
54996
|
-
var
|
|
55002
|
+
var import_fs13 = require("fs");
|
|
54997
55003
|
var calculateBodyLength = /* @__PURE__ */ __name((body) => {
|
|
54998
55004
|
if (!body) {
|
|
54999
55005
|
return 0;
|
|
@@ -55007,9 +55013,9 @@ var require_dist_cjs42 = __commonJS({
|
|
|
55007
55013
|
} else if (typeof body.start === "number" && typeof body.end === "number") {
|
|
55008
55014
|
return body.end + 1 - body.start;
|
|
55009
55015
|
} else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
|
|
55010
|
-
return (0,
|
|
55016
|
+
return (0, import_fs13.lstatSync)(body.path).size;
|
|
55011
55017
|
} else if (typeof body.fd === "number") {
|
|
55012
|
-
return (0,
|
|
55018
|
+
return (0, import_fs13.fstatSync)(body.fd).size;
|
|
55013
55019
|
}
|
|
55014
55020
|
throw new Error(`Body Length computation failed for ${body}`);
|
|
55015
55021
|
}, "calculateBodyLength");
|
|
@@ -57316,8 +57322,8 @@ var require_dist_cjs47 = __commonJS({
|
|
|
57316
57322
|
}
|
|
57317
57323
|
}, "validateTokenKey");
|
|
57318
57324
|
var import_shared_ini_file_loader = require_dist_cjs13();
|
|
57319
|
-
var
|
|
57320
|
-
var { writeFile } =
|
|
57325
|
+
var import_fs13 = require("fs");
|
|
57326
|
+
var { writeFile } = import_fs13.promises;
|
|
57321
57327
|
var writeSSOTokenToFile = /* @__PURE__ */ __name((id, ssoToken) => {
|
|
57322
57328
|
const tokenFilepath = (0, import_shared_ini_file_loader.getSSOTokenFilepath)(id);
|
|
57323
57329
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
@@ -83234,13 +83240,13 @@ var require_websocket_server2 = __commonJS({
|
|
|
83234
83240
|
}
|
|
83235
83241
|
}
|
|
83236
83242
|
if (this.options.verifyClient) {
|
|
83237
|
-
const
|
|
83243
|
+
const info4 = {
|
|
83238
83244
|
origin: req.headers[`${version2 === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
83239
83245
|
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
83240
83246
|
req
|
|
83241
83247
|
};
|
|
83242
83248
|
if (this.options.verifyClient.length === 2) {
|
|
83243
|
-
this.options.verifyClient(
|
|
83249
|
+
this.options.verifyClient(info4, (verified, code, message, headers) => {
|
|
83244
83250
|
if (!verified) {
|
|
83245
83251
|
return abortHandshake(socket, code || 401, message, headers);
|
|
83246
83252
|
}
|
|
@@ -83256,7 +83262,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
83256
83262
|
});
|
|
83257
83263
|
return;
|
|
83258
83264
|
}
|
|
83259
|
-
if (!this.options.verifyClient(
|
|
83265
|
+
if (!this.options.verifyClient(info4))
|
|
83260
83266
|
return abortHandshake(socket, 401);
|
|
83261
83267
|
}
|
|
83262
83268
|
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
@@ -103769,7 +103775,7 @@ var init_introspect_pg = __esm({
|
|
|
103769
103775
|
assertUnreachable(casing2);
|
|
103770
103776
|
};
|
|
103771
103777
|
paramNameFor = (name, schema5) => {
|
|
103772
|
-
const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5}` : "";
|
|
103778
|
+
const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5.capitalise()}` : "";
|
|
103773
103779
|
return `${name}${schemaSuffix}`;
|
|
103774
103780
|
};
|
|
103775
103781
|
schemaToTypeScript3 = (schema5, casing2) => {
|
|
@@ -104663,7 +104669,6 @@ var init_introspect = __esm({
|
|
|
104663
104669
|
const relationsTs = relationsToTypeScript(schema5, casing2);
|
|
104664
104670
|
const { internal, ...schemaWithoutInternals } = schema5;
|
|
104665
104671
|
const schemaFile = (0, import_path7.join)(out, "schema.ts");
|
|
104666
|
-
(0, import_fs11.mkdirSync)(out, { recursive: true });
|
|
104667
104672
|
(0, import_fs11.writeFileSync)(schemaFile, ts2.file);
|
|
104668
104673
|
const relationsFile = (0, import_path7.join)(out, "relations.ts");
|
|
104669
104674
|
(0, import_fs11.writeFileSync)(relationsFile, relationsTs.file);
|
|
@@ -104865,8 +104870,10 @@ var init_introspect = __esm({
|
|
|
104865
104870
|
const tableRelations = {};
|
|
104866
104871
|
Object.values(schema5.tables).forEach((table4) => {
|
|
104867
104872
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
|
104868
|
-
const
|
|
104869
|
-
const
|
|
104873
|
+
const tableNameFrom = paramNameFor(fk4.tableFrom, table4.schema);
|
|
104874
|
+
const tableNameTo = paramNameFor(fk4.tableTo, fk4.schemaTo);
|
|
104875
|
+
const tableFrom = withCasing3(tableNameFrom, casing2);
|
|
104876
|
+
const tableTo = withCasing3(tableNameTo, casing2);
|
|
104870
104877
|
const columnFrom = withCasing3(fk4.columnsFrom[0], casing2);
|
|
104871
104878
|
const columnTo = withCasing3(fk4.columnsTo[0], casing2);
|
|
104872
104879
|
imports.push(tableTo, tableFrom);
|
|
@@ -104908,17 +104915,17 @@ import { ${uniqueImports.join(
|
|
|
104908
104915
|
const hasOne = relations4.some((it) => it.type === "one");
|
|
104909
104916
|
const hasMany = relations4.some((it) => it.type === "many");
|
|
104910
104917
|
const preparedRelations = relations4.map(
|
|
104911
|
-
(relation,
|
|
104918
|
+
(relation, relationIndex, originArray) => {
|
|
104912
104919
|
let name = relation.name;
|
|
104913
104920
|
let relationName;
|
|
104914
|
-
const hasMultipleRelations =
|
|
104915
|
-
(it) =>
|
|
104921
|
+
const hasMultipleRelations = originArray.some(
|
|
104922
|
+
(it, originIndex) => relationIndex !== originIndex && it.tableTo === relation.tableTo
|
|
104916
104923
|
);
|
|
104917
104924
|
if (hasMultipleRelations) {
|
|
104918
104925
|
relationName = relation.type === "one" ? `${relation.tableFrom}_${relation.columnFrom}_${relation.tableTo}_${relation.columnTo}` : `${relation.tableTo}_${relation.columnTo}_${relation.tableFrom}_${relation.columnFrom}`;
|
|
104919
104926
|
}
|
|
104920
104927
|
const hasDuplicatedRelation = originArray.some(
|
|
104921
|
-
(it, originIndex) => it.name === relation.name
|
|
104928
|
+
(it, originIndex) => relationIndex !== originIndex && it.name === relation.name
|
|
104922
104929
|
);
|
|
104923
104930
|
if (hasDuplicatedRelation) {
|
|
104924
104931
|
name = `${relation.name}_${relation.type === "one" ? relation.columnFrom : relation.columnTo}`;
|
|
@@ -106276,6 +106283,7 @@ certs();
|
|
|
106276
106283
|
init_cli();
|
|
106277
106284
|
init_studio();
|
|
106278
106285
|
init_views();
|
|
106286
|
+
var import_fs12 = require("fs");
|
|
106279
106287
|
var printVersions = async () => {
|
|
106280
106288
|
const v6 = await versions();
|
|
106281
106289
|
console.log(`${source_default.gray(v6)}
|
|
@@ -106408,6 +106416,13 @@ var pullCommand = new import_commander.Command("introspect").option("--config <c
|
|
|
106408
106416
|
tablesFilter,
|
|
106409
106417
|
schemasFilter
|
|
106410
106418
|
} = await preparePullConfig(options);
|
|
106419
|
+
(0, import_fs12.mkdirSync)(out, { recursive: true });
|
|
106420
|
+
console.log(
|
|
106421
|
+
grey(
|
|
106422
|
+
`Pulling from [${schemasFilter.map((it) => `'${it}'`).join(", ")}] list of schemas`
|
|
106423
|
+
)
|
|
106424
|
+
);
|
|
106425
|
+
console.log();
|
|
106411
106426
|
try {
|
|
106412
106427
|
if (dialect7 === "postgresql") {
|
|
106413
106428
|
const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
package/cli/views.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Named, NamedWithSchema } from "./commands/migrate";
|
|
|
4
4
|
export declare const warning: (msg: string) => void;
|
|
5
5
|
export declare const err: (msg: string) => void;
|
|
6
6
|
export declare const info: (msg: string, greyMsg?: string) => string;
|
|
7
|
+
export declare const grey: (msg: string) => string;
|
|
7
8
|
export declare const error: (error: string, greyMsg?: string) => string;
|
|
8
9
|
export declare const schema: (schema: CommonSchema) => string;
|
|
9
10
|
export interface RenamePropmtItem<T> {
|
package/package.json
CHANGED
package/payload.js
CHANGED
|
@@ -19064,6 +19064,9 @@ String.prototype.squashSpaces = function() {
|
|
|
19064
19064
|
String.prototype.camelCase = function() {
|
|
19065
19065
|
return camelCase(String(this));
|
|
19066
19066
|
};
|
|
19067
|
+
String.prototype.capitalise = function() {
|
|
19068
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
19069
|
+
};
|
|
19067
19070
|
String.prototype.concatIf = function(it, condition) {
|
|
19068
19071
|
return condition ? `${this}${it}` : String(this);
|
|
19069
19072
|
};
|
package/payload.mjs
CHANGED
|
@@ -19073,6 +19073,9 @@ String.prototype.squashSpaces = function() {
|
|
|
19073
19073
|
String.prototype.camelCase = function() {
|
|
19074
19074
|
return camelCase(String(this));
|
|
19075
19075
|
};
|
|
19076
|
+
String.prototype.capitalise = function() {
|
|
19077
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
19078
|
+
};
|
|
19076
19079
|
String.prototype.concatIf = function(it, condition) {
|
|
19077
19080
|
return condition ? `${this}${it}` : String(this);
|
|
19078
19081
|
};
|
package/utils-studio.js
CHANGED
|
@@ -5933,6 +5933,9 @@ String.prototype.squashSpaces = function() {
|
|
|
5933
5933
|
String.prototype.camelCase = function() {
|
|
5934
5934
|
return camelCase(String(this));
|
|
5935
5935
|
};
|
|
5936
|
+
String.prototype.capitalise = function() {
|
|
5937
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
5938
|
+
};
|
|
5936
5939
|
String.prototype.concatIf = function(it, condition) {
|
|
5937
5940
|
return condition ? `${this}${it}` : String(this);
|
|
5938
5941
|
};
|
package/utils-studio.mjs
CHANGED
|
@@ -5969,6 +5969,9 @@ String.prototype.squashSpaces = function() {
|
|
|
5969
5969
|
String.prototype.camelCase = function() {
|
|
5970
5970
|
return camelCase(String(this));
|
|
5971
5971
|
};
|
|
5972
|
+
String.prototype.capitalise = function() {
|
|
5973
|
+
return this && this.length > 0 ? `${this[0].toUpperCase()}${this.slice(1)}` : String(this);
|
|
5974
|
+
};
|
|
5972
5975
|
String.prototype.concatIf = function(it, condition) {
|
|
5973
5976
|
return condition ? `${this}${it}` : String(this);
|
|
5974
5977
|
};
|