drizzle-kit 0.25.0-1fba875 → 0.25.0-225f91d

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
2
+ type Prefix = (typeof prefixes)[number];
3
+ declare const casingTypes: readonly ["snake_case", "camelCase"];
4
+ type CasingType = (typeof casingTypes)[number];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
+ type Driver = (typeof drivers)[number];
7
+
8
+ export type { CasingType as C, Driver as D, Prefix as P };
@@ -0,0 +1,8 @@
1
+ declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
2
+ type Prefix = (typeof prefixes)[number];
3
+ declare const casingTypes: readonly ["snake_case", "camelCase"];
4
+ type CasingType = (typeof casingTypes)[number];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
+ type Driver = (typeof drivers)[number];
7
+
8
+ export type { CasingType as C, Driver as D, Prefix as P };
package/index.d.mts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { ConnectionOptions } from 'tls';
2
-
3
- declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
- type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
- type Driver = (typeof drivers)[number];
2
+ import { P as Prefix, D as Driver } from './common-DYjgLS6u.mjs';
7
3
 
8
4
  declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
5
  type Dialect = (typeof dialects)[number];
@@ -119,6 +115,7 @@ type Config = {
119
115
  schema?: string | string[];
120
116
  verbose?: boolean;
121
117
  strict?: boolean;
118
+ casing?: 'camelCase' | 'snake_case';
122
119
  migrations?: {
123
120
  table?: string;
124
121
  schema?: string;
@@ -127,6 +124,13 @@ type Config = {
127
124
  introspect?: {
128
125
  casing: 'camel' | 'preserve';
129
126
  };
127
+ entities?: {
128
+ roles?: boolean | {
129
+ provider?: string;
130
+ exclude?: string[];
131
+ include?: string[];
132
+ }[];
133
+ };
130
134
  } & ({
131
135
  dialect: Verify<Dialect, 'turso'>;
132
136
  dbCredentials: {
package/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { ConnectionOptions } from 'tls';
2
-
3
- declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
- type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
- type Driver = (typeof drivers)[number];
2
+ import { P as Prefix, D as Driver } from './common-DYjgLS6u.js';
7
3
 
8
4
  declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
5
  type Dialect = (typeof dialects)[number];
@@ -119,6 +115,7 @@ type Config = {
119
115
  schema?: string | string[];
120
116
  verbose?: boolean;
121
117
  strict?: boolean;
118
+ casing?: 'camelCase' | 'snake_case';
122
119
  migrations?: {
123
120
  table?: string;
124
121
  schema?: string;
@@ -127,6 +124,13 @@ type Config = {
127
124
  introspect?: {
128
125
  casing: 'camel' | 'preserve';
129
126
  };
127
+ entities?: {
128
+ roles?: boolean | {
129
+ provider?: string;
130
+ exclude?: string[];
131
+ include?: string[];
132
+ }[];
133
+ };
130
134
  } & ({
131
135
  dialect: Verify<Dialect, 'turso'>;
132
136
  dbCredentials: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.25.0-1fba875",
3
+ "version": "0.25.0-225f91d",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -51,7 +51,7 @@
51
51
  "@arethetypeswrong/cli": "^0.15.3",
52
52
  "@aws-sdk/client-rds-data": "^3.556.0",
53
53
  "@cloudflare/workers-types": "^4.20230518.0",
54
- "@electric-sql/pglite": "^0.1.5",
54
+ "@electric-sql/pglite": "^0.2.5",
55
55
  "@hono/node-server": "^1.9.0",
56
56
  "@hono/zod-validator": "^0.2.1",
57
57
  "@libsql/client": "^0.10.0",
@@ -80,7 +80,7 @@
80
80
  "commander": "^12.1.0",
81
81
  "dockerode": "^3.3.4",
82
82
  "dotenv": "^16.0.3",
83
- "drizzle-kit": "0.21.2",
83
+ "drizzle-kit": "0.25.0-b1faa33",
84
84
  "drizzle-orm": "workspace:./drizzle-orm/dist",
85
85
  "env-paths": "^3.0.0",
86
86
  "esbuild-node-externals": "^1.9.0",
package/utils.js CHANGED
@@ -569,6 +569,7 @@ __export(utils_exports, {
569
569
  copy: () => copy,
570
570
  dryJournal: () => dryJournal,
571
571
  findAddedAndRemoved: () => findAddedAndRemoved,
572
+ getColumnCasing: () => getColumnCasing,
572
573
  isPgArrayType: () => isPgArrayType,
573
574
  kloudMeta: () => kloudMeta,
574
575
  normalisePGliteUrl: () => normalisePGliteUrl,
@@ -1073,6 +1074,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1073
1074
  var source_default = chalk;
1074
1075
 
1075
1076
  // src/utils.ts
1077
+ var import_casing = require("drizzle-orm/casing");
1076
1078
  var import_fs = require("fs");
1077
1079
  var import_path = require("path");
1078
1080
  var import_url = require("url");
@@ -5147,6 +5149,12 @@ var sequenceSchema = objectType({
5147
5149
  cycle: booleanType().optional(),
5148
5150
  schema: stringType()
5149
5151
  }).strict();
5152
+ var roleSchema = objectType({
5153
+ name: stringType(),
5154
+ createDb: booleanType().optional(),
5155
+ createRole: booleanType().optional(),
5156
+ inherit: booleanType().optional()
5157
+ }).strict();
5150
5158
  var sequenceSquashed = objectType({
5151
5159
  name: stringType(),
5152
5160
  schema: stringType(),
@@ -5210,6 +5218,14 @@ var uniqueConstraint2 = objectType({
5210
5218
  columns: stringType().array(),
5211
5219
  nullsNotDistinct: booleanType()
5212
5220
  }).strict();
5221
+ var policy = objectType({
5222
+ name: stringType(),
5223
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5224
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5225
+ to: stringType().array().optional(),
5226
+ using: stringType().optional(),
5227
+ withCheck: stringType().optional()
5228
+ }).strict();
5213
5229
  var tableV42 = objectType({
5214
5230
  name: stringType(),
5215
5231
  schema: stringType(),
@@ -5251,7 +5267,8 @@ var table2 = objectType({
5251
5267
  indexes: recordType(stringType(), index2),
5252
5268
  foreignKeys: recordType(stringType(), fk2),
5253
5269
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5254
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5270
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5271
+ policies: recordType(stringType(), policy).default({})
5255
5272
  }).strict();
5256
5273
  var schemaHash2 = objectType({
5257
5274
  id: stringType(),
@@ -5345,6 +5362,7 @@ var pgSchemaInternal = objectType({
5345
5362
  enums: recordType(stringType(), enumSchema),
5346
5363
  schemas: recordType(stringType(), stringType()),
5347
5364
  sequences: recordType(stringType(), sequenceSchema).default({}),
5365
+ roles: recordType(stringType(), roleSchema).default({}),
5348
5366
  _meta: objectType({
5349
5367
  schemas: recordType(stringType(), stringType()),
5350
5368
  tables: recordType(stringType(), stringType()),
@@ -5359,7 +5377,8 @@ var tableSquashed2 = objectType({
5359
5377
  indexes: recordType(stringType(), stringType()),
5360
5378
  foreignKeys: recordType(stringType(), stringType()),
5361
5379
  compositePrimaryKeys: recordType(stringType(), stringType()),
5362
- uniqueConstraints: recordType(stringType(), stringType())
5380
+ uniqueConstraints: recordType(stringType(), stringType()),
5381
+ policies: recordType(stringType(), stringType())
5363
5382
  }).strict();
5364
5383
  var tableSquashedV42 = objectType({
5365
5384
  name: stringType(),
@@ -5388,7 +5407,8 @@ var pgSchemaSquashed = objectType({
5388
5407
  tables: recordType(stringType(), tableSquashed2),
5389
5408
  enums: recordType(stringType(), enumSchema),
5390
5409
  schemas: recordType(stringType(), stringType()),
5391
- sequences: recordType(stringType(), sequenceSquashed)
5410
+ sequences: recordType(stringType(), sequenceSquashed),
5411
+ roles: recordType(stringType(), roleSchema).default({})
5392
5412
  }).strict();
5393
5413
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5394
5414
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -5760,6 +5780,11 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5760
5780
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5761
5781
  return { addedColumns, removedColumns };
5762
5782
  }
5783
+ function getColumnCasing(column4, casing) {
5784
+ if (!column4.name)
5785
+ return "";
5786
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? (0, import_casing.toCamelCase)(column4.name) : (0, import_casing.toSnakeCase)(column4.name);
5787
+ }
5763
5788
  // Annotate the CommonJS export names for ESM import in node:
5764
5789
  0 && (module.exports = {
5765
5790
  assertV1OutFolder,
@@ -5767,6 +5792,7 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5767
5792
  copy,
5768
5793
  dryJournal,
5769
5794
  findAddedAndRemoved,
5795
+ getColumnCasing,
5770
5796
  isPgArrayType,
5771
5797
  kloudMeta,
5772
5798
  normalisePGliteUrl,
package/utils.mjs CHANGED
@@ -1052,6 +1052,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
1052
1052
  var source_default = chalk;
1053
1053
 
1054
1054
  // src/utils.ts
1055
+ import { toCamelCase, toSnakeCase } from "drizzle-orm/casing";
1055
1056
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
1056
1057
  import { join } from "path";
1057
1058
  import { parse } from "url";
@@ -5126,6 +5127,12 @@ var sequenceSchema = objectType({
5126
5127
  cycle: booleanType().optional(),
5127
5128
  schema: stringType()
5128
5129
  }).strict();
5130
+ var roleSchema = objectType({
5131
+ name: stringType(),
5132
+ createDb: booleanType().optional(),
5133
+ createRole: booleanType().optional(),
5134
+ inherit: booleanType().optional()
5135
+ }).strict();
5129
5136
  var sequenceSquashed = objectType({
5130
5137
  name: stringType(),
5131
5138
  schema: stringType(),
@@ -5189,6 +5196,14 @@ var uniqueConstraint2 = objectType({
5189
5196
  columns: stringType().array(),
5190
5197
  nullsNotDistinct: booleanType()
5191
5198
  }).strict();
5199
+ var policy = objectType({
5200
+ name: stringType(),
5201
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5202
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5203
+ to: stringType().array().optional(),
5204
+ using: stringType().optional(),
5205
+ withCheck: stringType().optional()
5206
+ }).strict();
5192
5207
  var tableV42 = objectType({
5193
5208
  name: stringType(),
5194
5209
  schema: stringType(),
@@ -5230,7 +5245,8 @@ var table2 = objectType({
5230
5245
  indexes: recordType(stringType(), index2),
5231
5246
  foreignKeys: recordType(stringType(), fk2),
5232
5247
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5233
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5248
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5249
+ policies: recordType(stringType(), policy).default({})
5234
5250
  }).strict();
5235
5251
  var schemaHash2 = objectType({
5236
5252
  id: stringType(),
@@ -5324,6 +5340,7 @@ var pgSchemaInternal = objectType({
5324
5340
  enums: recordType(stringType(), enumSchema),
5325
5341
  schemas: recordType(stringType(), stringType()),
5326
5342
  sequences: recordType(stringType(), sequenceSchema).default({}),
5343
+ roles: recordType(stringType(), roleSchema).default({}),
5327
5344
  _meta: objectType({
5328
5345
  schemas: recordType(stringType(), stringType()),
5329
5346
  tables: recordType(stringType(), stringType()),
@@ -5338,7 +5355,8 @@ var tableSquashed2 = objectType({
5338
5355
  indexes: recordType(stringType(), stringType()),
5339
5356
  foreignKeys: recordType(stringType(), stringType()),
5340
5357
  compositePrimaryKeys: recordType(stringType(), stringType()),
5341
- uniqueConstraints: recordType(stringType(), stringType())
5358
+ uniqueConstraints: recordType(stringType(), stringType()),
5359
+ policies: recordType(stringType(), stringType())
5342
5360
  }).strict();
5343
5361
  var tableSquashedV42 = objectType({
5344
5362
  name: stringType(),
@@ -5367,7 +5385,8 @@ var pgSchemaSquashed = objectType({
5367
5385
  tables: recordType(stringType(), tableSquashed2),
5368
5386
  enums: recordType(stringType(), enumSchema),
5369
5387
  schemas: recordType(stringType(), stringType()),
5370
- sequences: recordType(stringType(), sequenceSquashed)
5388
+ sequences: recordType(stringType(), sequenceSquashed),
5389
+ roles: recordType(stringType(), roleSchema).default({})
5371
5390
  }).strict();
5372
5391
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5373
5392
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -5739,12 +5758,18 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
5739
5758
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
5740
5759
  return { addedColumns, removedColumns };
5741
5760
  }
5761
+ function getColumnCasing(column4, casing) {
5762
+ if (!column4.name)
5763
+ return "";
5764
+ return !column4.keyAsName || casing === void 0 ? column4.name : casing === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
5765
+ }
5742
5766
  export {
5743
5767
  assertV1OutFolder,
5744
5768
  columnRenameKey,
5745
5769
  copy,
5746
5770
  dryJournal,
5747
5771
  findAddedAndRemoved,
5772
+ getColumnCasing,
5748
5773
  isPgArrayType,
5749
5774
  kloudMeta,
5750
5775
  normalisePGliteUrl,