@sqb/connect 4.8.0 → 4.8.2

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.
@@ -81,19 +81,19 @@ class Repository extends (0, strict_typed_events_1.TypedEventEmitterClass)(stric
81
81
  update(keyValue, values, options) {
82
82
  return this._execute(async (connection) => {
83
83
  const opts = { ...options, connection };
84
- const keyValues = await this._updateByPk(keyValue, values, opts);
84
+ const keyValues = await this._update(keyValue, values, opts);
85
85
  if (keyValues)
86
86
  return this._find(keyValues, opts);
87
87
  }, options);
88
88
  }
89
89
  updateOnly(keyValue, values, options) {
90
90
  return this._execute(async (connection) => {
91
- return !!(await this._updateByPk(keyValue, values, { ...options, connection }));
91
+ return !!(await this._update(keyValue, values, { ...options, connection }));
92
92
  }, options);
93
93
  }
94
94
  updateMany(values, options) {
95
95
  return this._execute(async (connection) => {
96
- return this._updateAll(values, { ...options, connection });
96
+ return this._updateMany(values, { ...options, connection });
97
97
  });
98
98
  }
99
99
  /**
@@ -217,7 +217,7 @@ class Repository extends (0, strict_typed_events_1.TypedEventEmitterClass)(stric
217
217
  params: options?.params
218
218
  });
219
219
  }
220
- async _updateByPk(keyValue, values, options) {
220
+ async _update(keyValue, values, options) {
221
221
  if (!values)
222
222
  throw new TypeError('You must provide values');
223
223
  const keyValues = (0, extract_keyvalues_js_1.extractKeyValues)(this._entity, keyValue, true);
@@ -238,7 +238,7 @@ class Repository extends (0, strict_typed_events_1.TypedEventEmitterClass)(stric
238
238
  });
239
239
  return rowsAffected ? keyValues : undefined;
240
240
  }
241
- async _updateAll(values, options) {
241
+ async _updateMany(values, options) {
242
242
  if (!values)
243
243
  throw new TypeError('You must provide values');
244
244
  return await update_command_js_1.UpdateCommand.execute({
@@ -130,10 +130,10 @@ export declare class Repository<T> extends Repository_base {
130
130
  protected _deleteMany(options: Repository.DeleteManyOptions & {
131
131
  connection: SqbConnection;
132
132
  }): Promise<number>;
133
- protected _updateByPk(keyValue: any | Record<string, any>, values: EntityInput<T>, options: Repository.UpdateOptions & {
133
+ protected _update(keyValue: any | Record<string, any>, values: EntityInput<T>, options: Repository.UpdateOptions & {
134
134
  connection: SqbConnection;
135
135
  }): Promise<Record<string, any> | undefined>;
136
- protected _updateAll(values: EntityInput<T>, options: Repository.UpdateManyOptions & {
136
+ protected _updateMany(values: EntityInput<T>, options: Repository.UpdateManyOptions & {
137
137
  connection: SqbConnection;
138
138
  }): Promise<number>;
139
139
  }
@@ -78,19 +78,19 @@ export class Repository extends TypedEventEmitterClass(AsyncEventEmitter) {
78
78
  update(keyValue, values, options) {
79
79
  return this._execute(async (connection) => {
80
80
  const opts = { ...options, connection };
81
- const keyValues = await this._updateByPk(keyValue, values, opts);
81
+ const keyValues = await this._update(keyValue, values, opts);
82
82
  if (keyValues)
83
83
  return this._find(keyValues, opts);
84
84
  }, options);
85
85
  }
86
86
  updateOnly(keyValue, values, options) {
87
87
  return this._execute(async (connection) => {
88
- return !!(await this._updateByPk(keyValue, values, { ...options, connection }));
88
+ return !!(await this._update(keyValue, values, { ...options, connection }));
89
89
  }, options);
90
90
  }
91
91
  updateMany(values, options) {
92
92
  return this._execute(async (connection) => {
93
- return this._updateAll(values, { ...options, connection });
93
+ return this._updateMany(values, { ...options, connection });
94
94
  });
95
95
  }
96
96
  /**
@@ -214,7 +214,7 @@ export class Repository extends TypedEventEmitterClass(AsyncEventEmitter) {
214
214
  params: options?.params
215
215
  });
216
216
  }
217
- async _updateByPk(keyValue, values, options) {
217
+ async _update(keyValue, values, options) {
218
218
  if (!values)
219
219
  throw new TypeError('You must provide values');
220
220
  const keyValues = extractKeyValues(this._entity, keyValue, true);
@@ -235,7 +235,7 @@ export class Repository extends TypedEventEmitterClass(AsyncEventEmitter) {
235
235
  });
236
236
  return rowsAffected ? keyValues : undefined;
237
237
  }
238
- async _updateAll(values, options) {
238
+ async _updateMany(values, options) {
239
239
  if (!values)
240
240
  throw new TypeError('You must provide values');
241
241
  return await UpdateCommand.execute({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sqb/connect",
3
3
  "description": "Multi-dialect database connection framework written with TypeScript",
4
- "version": "4.8.0",
4
+ "version": "4.8.2",
5
5
  "author": "Panates",
6
6
  "contributors": [
7
7
  "Eray Hanoglu <e.hanoglu@panates.com>",
@@ -46,7 +46,7 @@
46
46
  "@types/lodash": "^4.14.194"
47
47
  },
48
48
  "peerDependencies": {
49
- "@sqb/builder": "^4.8.0"
49
+ "@sqb/builder": "^4.8.2"
50
50
  },
51
51
  "type": "module",
52
52
  "types": "esm/index.d.ts",