drizzle-kit 0.24.2-25af8ee → 0.24.2-277e6de

Sign up to get free protection for your applications and to get access to all the features.
Files changed (10) hide show
  1. package/api.d.mts +96 -0
  2. package/api.d.ts +96 -0
  3. package/api.js +77217 -89712
  4. package/api.mjs +77212 -89709
  5. package/bin.cjs +49377 -47328
  6. package/index.d.mts +10 -4
  7. package/index.d.ts +10 -4
  8. package/package.json +3 -3
  9. package/utils.js +32 -3
  10. package/utils.mjs +31 -3
package/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -127,9 +127,15 @@ type Config = {
127
127
  introspect?: {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
+ entities?: {
131
+ roles?: boolean | {
132
+ provider?: string;
133
+ exclude?: string[];
134
+ include?: string[];
135
+ }[];
136
+ };
130
137
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
138
+ dialect: Verify<Dialect, 'turso'>;
133
139
  dbCredentials: {
134
140
  url: string;
135
141
  authToken?: string;
package/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { ConnectionOptions } from 'tls';
2
2
 
3
3
  declare const prefixes: readonly ["index", "timestamp", "supabase", "unix", "none"];
4
4
  type Prefix = (typeof prefixes)[number];
5
- declare const drivers: readonly ["turso", "d1-http", "expo", "aws-data-api", "pglite"];
5
+ declare const drivers: readonly ["d1-http", "expo", "aws-data-api", "pglite"];
6
6
  type Driver = (typeof drivers)[number];
7
7
 
8
- declare const dialects: readonly ["postgresql", "mysql", "sqlite"];
8
+ declare const dialects: readonly ["postgresql", "mysql", "sqlite", "turso"];
9
9
  type Dialect = (typeof dialects)[number];
10
10
 
11
11
  type SslOptions = {
@@ -127,9 +127,15 @@ type Config = {
127
127
  introspect?: {
128
128
  casing: 'camel' | 'preserve';
129
129
  };
130
+ entities?: {
131
+ roles?: boolean | {
132
+ provider?: string;
133
+ exclude?: string[];
134
+ include?: string[];
135
+ }[];
136
+ };
130
137
  } & ({
131
- dialect: Verify<Dialect, 'sqlite'>;
132
- driver: Verify<Driver, 'turso'>;
138
+ dialect: Verify<Dialect, 'turso'>;
133
139
  dbCredentials: {
134
140
  url: string;
135
141
  authToken?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.2-25af8ee",
3
+ "version": "0.24.2-277e6de",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -51,10 +51,10 @@
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
- "@libsql/client": "^0.4.2",
57
+ "@libsql/client": "^0.10.0",
58
58
  "@neondatabase/serverless": "^0.9.1",
59
59
  "@originjs/vite-plugin-commonjs": "^1.0.3",
60
60
  "@planetscale/database": "^1.16.0",
package/utils.js CHANGED
@@ -568,6 +568,7 @@ __export(utils_exports, {
568
568
  columnRenameKey: () => columnRenameKey,
569
569
  copy: () => copy,
570
570
  dryJournal: () => dryJournal,
571
+ findAddedAndRemoved: () => findAddedAndRemoved,
571
572
  isPgArrayType: () => isPgArrayType,
572
573
  kloudMeta: () => kloudMeta,
573
574
  normalisePGliteUrl: () => normalisePGliteUrl,
@@ -5146,6 +5147,12 @@ var sequenceSchema = objectType({
5146
5147
  cycle: booleanType().optional(),
5147
5148
  schema: stringType()
5148
5149
  }).strict();
5150
+ var roleSchema = objectType({
5151
+ name: stringType(),
5152
+ createDb: booleanType().optional(),
5153
+ createRole: booleanType().optional(),
5154
+ inherit: booleanType().optional()
5155
+ }).strict();
5149
5156
  var sequenceSquashed = objectType({
5150
5157
  name: stringType(),
5151
5158
  schema: stringType(),
@@ -5209,6 +5216,14 @@ var uniqueConstraint2 = objectType({
5209
5216
  columns: stringType().array(),
5210
5217
  nullsNotDistinct: booleanType()
5211
5218
  }).strict();
5219
+ var policy = objectType({
5220
+ name: stringType(),
5221
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5222
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5223
+ to: stringType().array().optional(),
5224
+ using: stringType().optional(),
5225
+ withCheck: stringType().optional()
5226
+ }).strict();
5212
5227
  var tableV42 = objectType({
5213
5228
  name: stringType(),
5214
5229
  schema: stringType(),
@@ -5250,7 +5265,8 @@ var table2 = objectType({
5250
5265
  indexes: recordType(stringType(), index2),
5251
5266
  foreignKeys: recordType(stringType(), fk2),
5252
5267
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5253
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5268
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5269
+ policies: recordType(stringType(), policy).default({})
5254
5270
  }).strict();
5255
5271
  var schemaHash2 = objectType({
5256
5272
  id: stringType(),
@@ -5344,6 +5360,7 @@ var pgSchemaInternal = objectType({
5344
5360
  enums: recordType(stringType(), enumSchema),
5345
5361
  schemas: recordType(stringType(), stringType()),
5346
5362
  sequences: recordType(stringType(), sequenceSchema).default({}),
5363
+ roles: recordType(stringType(), roleSchema).default({}),
5347
5364
  _meta: objectType({
5348
5365
  schemas: recordType(stringType(), stringType()),
5349
5366
  tables: recordType(stringType(), stringType()),
@@ -5358,7 +5375,8 @@ var tableSquashed2 = objectType({
5358
5375
  indexes: recordType(stringType(), stringType()),
5359
5376
  foreignKeys: recordType(stringType(), stringType()),
5360
5377
  compositePrimaryKeys: recordType(stringType(), stringType()),
5361
- uniqueConstraints: recordType(stringType(), stringType())
5378
+ uniqueConstraints: recordType(stringType(), stringType()),
5379
+ policies: recordType(stringType(), stringType())
5362
5380
  }).strict();
5363
5381
  var tableSquashedV42 = objectType({
5364
5382
  name: stringType(),
@@ -5387,7 +5405,8 @@ var pgSchemaSquashed = objectType({
5387
5405
  tables: recordType(stringType(), tableSquashed2),
5388
5406
  enums: recordType(stringType(), enumSchema),
5389
5407
  schemas: recordType(stringType(), stringType()),
5390
- sequences: recordType(stringType(), sequenceSquashed)
5408
+ sequences: recordType(stringType(), sequenceSquashed),
5409
+ roles: recordType(stringType(), roleSchema).default({})
5391
5410
  }).strict();
5392
5411
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5393
5412
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -5596,6 +5615,8 @@ var validatorForDialect = (dialect3) => {
5596
5615
  return { validator: backwardCompatiblePgSchema, version: 7 };
5597
5616
  case "sqlite":
5598
5617
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5618
+ case "turso":
5619
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5599
5620
  case "mysql":
5600
5621
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5601
5622
  }
@@ -5750,12 +5771,20 @@ var normalisePGliteUrl = (it) => {
5750
5771
  function isPgArrayType(sqlType) {
5751
5772
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5752
5773
  }
5774
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5775
+ const set1 = new Set(columnNames1);
5776
+ const set2 = new Set(columnNames2);
5777
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5778
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5779
+ return { addedColumns, removedColumns };
5780
+ }
5753
5781
  // Annotate the CommonJS export names for ESM import in node:
5754
5782
  0 && (module.exports = {
5755
5783
  assertV1OutFolder,
5756
5784
  columnRenameKey,
5757
5785
  copy,
5758
5786
  dryJournal,
5787
+ findAddedAndRemoved,
5759
5788
  isPgArrayType,
5760
5789
  kloudMeta,
5761
5790
  normalisePGliteUrl,
package/utils.mjs CHANGED
@@ -5126,6 +5126,12 @@ var sequenceSchema = objectType({
5126
5126
  cycle: booleanType().optional(),
5127
5127
  schema: stringType()
5128
5128
  }).strict();
5129
+ var roleSchema = objectType({
5130
+ name: stringType(),
5131
+ createDb: booleanType().optional(),
5132
+ createRole: booleanType().optional(),
5133
+ inherit: booleanType().optional()
5134
+ }).strict();
5129
5135
  var sequenceSquashed = objectType({
5130
5136
  name: stringType(),
5131
5137
  schema: stringType(),
@@ -5189,6 +5195,14 @@ var uniqueConstraint2 = objectType({
5189
5195
  columns: stringType().array(),
5190
5196
  nullsNotDistinct: booleanType()
5191
5197
  }).strict();
5198
+ var policy = objectType({
5199
+ name: stringType(),
5200
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5201
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5202
+ to: stringType().array().optional(),
5203
+ using: stringType().optional(),
5204
+ withCheck: stringType().optional()
5205
+ }).strict();
5192
5206
  var tableV42 = objectType({
5193
5207
  name: stringType(),
5194
5208
  schema: stringType(),
@@ -5230,7 +5244,8 @@ var table2 = objectType({
5230
5244
  indexes: recordType(stringType(), index2),
5231
5245
  foreignKeys: recordType(stringType(), fk2),
5232
5246
  compositePrimaryKeys: recordType(stringType(), compositePK2),
5233
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5247
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5248
+ policies: recordType(stringType(), policy).default({})
5234
5249
  }).strict();
5235
5250
  var schemaHash2 = objectType({
5236
5251
  id: stringType(),
@@ -5324,6 +5339,7 @@ var pgSchemaInternal = objectType({
5324
5339
  enums: recordType(stringType(), enumSchema),
5325
5340
  schemas: recordType(stringType(), stringType()),
5326
5341
  sequences: recordType(stringType(), sequenceSchema).default({}),
5342
+ roles: recordType(stringType(), roleSchema).default({}),
5327
5343
  _meta: objectType({
5328
5344
  schemas: recordType(stringType(), stringType()),
5329
5345
  tables: recordType(stringType(), stringType()),
@@ -5338,7 +5354,8 @@ var tableSquashed2 = objectType({
5338
5354
  indexes: recordType(stringType(), stringType()),
5339
5355
  foreignKeys: recordType(stringType(), stringType()),
5340
5356
  compositePrimaryKeys: recordType(stringType(), stringType()),
5341
- uniqueConstraints: recordType(stringType(), stringType())
5357
+ uniqueConstraints: recordType(stringType(), stringType()),
5358
+ policies: recordType(stringType(), stringType())
5342
5359
  }).strict();
5343
5360
  var tableSquashedV42 = objectType({
5344
5361
  name: stringType(),
@@ -5367,7 +5384,8 @@ var pgSchemaSquashed = objectType({
5367
5384
  tables: recordType(stringType(), tableSquashed2),
5368
5385
  enums: recordType(stringType(), enumSchema),
5369
5386
  schemas: recordType(stringType(), stringType()),
5370
- sequences: recordType(stringType(), sequenceSquashed)
5387
+ sequences: recordType(stringType(), sequenceSquashed),
5388
+ roles: recordType(stringType(), roleSchema).default({})
5371
5389
  }).strict();
5372
5390
  var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5373
5391
  var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -5576,6 +5594,8 @@ var validatorForDialect = (dialect3) => {
5576
5594
  return { validator: backwardCompatiblePgSchema, version: 7 };
5577
5595
  case "sqlite":
5578
5596
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
5597
+ case "turso":
5598
+ return { validator: backwardCompatibleSqliteSchema, version: 6 };
5579
5599
  case "mysql":
5580
5600
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5581
5601
  }
@@ -5730,11 +5750,19 @@ var normalisePGliteUrl = (it) => {
5730
5750
  function isPgArrayType(sqlType) {
5731
5751
  return sqlType.match(/.*\[\d*\].*|.*\[\].*/g) !== null;
5732
5752
  }
5753
+ function findAddedAndRemoved(columnNames1, columnNames2) {
5754
+ const set1 = new Set(columnNames1);
5755
+ const set2 = new Set(columnNames2);
5756
+ const addedColumns = columnNames2.filter((it) => !set1.has(it));
5757
+ const removedColumns = columnNames1.filter((it) => !set2.has(it));
5758
+ return { addedColumns, removedColumns };
5759
+ }
5733
5760
  export {
5734
5761
  assertV1OutFolder,
5735
5762
  columnRenameKey,
5736
5763
  copy,
5737
5764
  dryJournal,
5765
+ findAddedAndRemoved,
5738
5766
  isPgArrayType,
5739
5767
  kloudMeta,
5740
5768
  normalisePGliteUrl,