drizzle-orm 0.10.39 → 0.10.40

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.
@@ -72,6 +72,7 @@ class SelectTRB extends abstractRequestBuilder_1.default {
72
72
  }
73
73
  if (this._logger) {
74
74
  this._logger.info(`Selecting from ${this._table.tableName()} using query:\n ${query}`);
75
+ this._logger.info(`Values for query:\n ${values}`);
75
76
  }
76
77
  const result = await this._session.execute(query, values);
77
78
  if (this.__partial) {
@@ -70,7 +70,7 @@ class UpdateTRB extends abstractRequestBuilder_1.default {
70
70
  }
71
71
  if (this._logger) {
72
72
  this._logger.info(`Updating ${this._table.tableName()} using query:\n ${query}`);
73
- console.log(values);
73
+ this._logger.info(`Values used for update:\n ${values}`);
74
74
  }
75
75
  const result = await this._session.execute(query, values);
76
76
  return responseMapper_1.default.map(this._mappedServiceToDb, result);
@@ -54,8 +54,6 @@ class AbstractJoined {
54
54
  catch (e) {
55
55
  throw new builderError_1.default(builderError_1.BuilderType.JOINED_SELECT, this._table.tableName(), Object.values(this._table.mapServiceToDb()), e, this._filter);
56
56
  }
57
- console.log(query);
58
- console.log(values);
59
57
  const result = await this._session.execute(query, values);
60
58
  return this.mapResponse(result);
61
59
  };
package/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export * from './db';
5
5
  export * from './builders';
6
6
  export * from './columns';
7
7
  export * from './tables';
8
+ export * from './logger/consoleLogger';
9
+ export * from './logger/abstractLogger';
8
10
  export declare const drizzle: {
9
11
  connect(config: ClientConfig): Promise<DB>;
10
12
  migrator(db: DB): Migrator;
package/index.js CHANGED
@@ -20,6 +20,8 @@ __exportStar(require("./db"), exports);
20
20
  __exportStar(require("./builders"), exports);
21
21
  __exportStar(require("./columns"), exports);
22
22
  __exportStar(require("./tables"), exports);
23
+ __exportStar(require("./logger/consoleLogger"), exports);
24
+ __exportStar(require("./logger/abstractLogger"), exports);
23
25
  exports.drizzle = {
24
26
  async connect(config) {
25
27
  const dbConnector = new db_1.DbConnector().params(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-orm",
3
- "version": "0.10.39",
3
+ "version": "0.10.40",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/test.d.ts CHANGED
@@ -1 +0,0 @@
1
- export {};
package/test.js CHANGED
@@ -1,64 +1,66 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const dbConnector_1 = __importDefault(require("./db/dbConnector"));
7
- const usersTable_1 = __importDefault(require("./docs/tables/usersTable"));
8
- const consoleLogger_1 = __importDefault(require("./logger/consoleLogger"));
9
- const serializer_1 = __importDefault(require("./serializer/serializer"));
10
- (async () => {
11
- try {
12
- const db = await new dbConnector_1.default()
13
- .connectionString('postgresql://postgres@127.0.0.1/migrator')
14
- .connect();
15
- db.useLogger(new consoleLogger_1.default());
16
- const usersTable = new usersTable_1.default(db);
17
- // const citiesTable = new CitiesTable(db);
18
- // await usersTable.insert({
19
- // });
20
- // const res = await citiesTable.update()
21
- // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone])
22
- // .where(eq(citiesTable.location, 'YR'))
23
- // .set({
24
- // metadata: [{
25
- // fallback_image: true,
26
- // team_image: 'https://files.slack.com/files-pri/T016CCC3FE3-F03461UR9M5/clinic_team_photo_1.jpg?pub_secret=560c098bfb',
27
- // image_alt_text: 'Generic Physiotherapy Clinic image 1',
28
- // logo: '',
29
- // logo_alt_text: ''
30
- // }],
31
- // })
32
- // // .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id)
33
- // // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id)
34
- // .execute();
35
- // console.log(res);
36
- const ser = new serializer_1.default();
37
- const res = ser.generate([usersTable], []);
38
- console.log(JSON.stringify(res, null, 2));
39
- // const f = {
40
- // id: count(usersTable.id),
41
- // };
42
- // type d = ExtractModel<typeof f>;
43
- // const res = await usersTable.select()
44
- // .leftJoin(UsersTable, (table) => table.id, (table) => table.id)
45
- // .leftJoin(UsersTable, CitiesTable, (table) => table.id, (table) => table.id)
46
- // .execute();
47
- // const res = await usersTable.select()
48
- // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone])
49
- // .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id)
50
- // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id)
51
- // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id)
52
- // // .groupBy({
53
- // // usersTable: usersTable.id,
54
- // // firstJoin: [usersTable.id],
55
- // // secondJoin: usersTable.id,
56
- // // thirdJoin: usersTable.id,
57
- // // })
58
- // .execute();
59
- // console.log(res);
60
- }
61
- catch (e) {
62
- console.log(e);
63
- }
64
- })();
2
+ // import DbConnector from './db/dbConnector';
3
+ // import UsersTable from './docs/tables/usersTable';
4
+ // import ConsoleLogger from './logger/consoleLogger';
5
+ // import MigrationSerializer from './serializer/serializer';
6
+ // import AbstractTable from './tables/abstractTable';
7
+ // import {
8
+ // ExtractColumnType, ExtractColumnType1,
9
+ // } from './tables/inferTypes';
10
+ // (async () => {
11
+ // try {
12
+ // const db = await new DbConnector()
13
+ // .connectionString('postgresql://postgres@127.0.0.1/migrator')
14
+ // .connect();
15
+ // db.useLogger(new ConsoleLogger());
16
+ // const usersTable = new UsersTable(db);
17
+ // type g = ReturnType<typeof usersTable.updatedAt.getColumnType>['codeType'];
18
+ // type f = ExtractColumnType<typeof usersTable.updatedAt>;
19
+ // type f1 = ExtractColumnType1<f>;
20
+ // // const citiesTable = new CitiesTable(db);
21
+ // // await usersTable.insert({
22
+ // // });
23
+ // // const res = await citiesTable.update()
24
+ // // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone])
25
+ // // .where(eq(citiesTable.location, 'YR'))
26
+ // // .set({
27
+ // // metadata: [{
28
+ // // fallback_image: true,
29
+ // // team_image: 'https://files.slack.com/files-pri/T016CCC3FE3-F03461UR9M5/clinic_team_photo_1.jpg?pub_secret=560c098bfb',
30
+ // // image_alt_text: 'Generic Physiotherapy Clinic image 1',
31
+ // // logo: '',
32
+ // // logo_alt_text: ''
33
+ // // }],
34
+ // // })
35
+ // // // .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id)
36
+ // // // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id)
37
+ // // .execute();
38
+ // // console.log(res);
39
+ // const ser = new MigrationSerializer();
40
+ // const res = ser.generate([usersTable as AbstractTable<UsersTable>], []);
41
+ // console.log(JSON.stringify(res, null, 2));
42
+ // // const f = {
43
+ // // id: count(usersTable.id),
44
+ // // };
45
+ // // type d = ExtractModel<typeof f>;
46
+ // // const res = await usersTable.select()
47
+ // // .leftJoin(UsersTable, (table) => table.id, (table) => table.id)
48
+ // // .leftJoin(UsersTable, CitiesTable, (table) => table.id, (table) => table.id)
49
+ // // .execute();
50
+ // // const res = await usersTable.select()
51
+ // // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone])
52
+ // // .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id)
53
+ // // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id)
54
+ // // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id)
55
+ // // // .groupBy({
56
+ // // // usersTable: usersTable.id,
57
+ // // // firstJoin: [usersTable.id],
58
+ // // // secondJoin: usersTable.id,
59
+ // // // thirdJoin: usersTable.id,
60
+ // // // })
61
+ // // .execute();
62
+ // // console.log(res);
63
+ // } catch (e) {
64
+ // console.log(e);
65
+ // }
66
+ // })();