@punks/backend-entity-manager 0.0.80 → 0.0.81

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/dist/esm/index.js CHANGED
@@ -21020,7 +21020,7 @@ class TypeOrmRepository {
21020
21020
  return this.innerRepository;
21021
21021
  }
21022
21022
  async exists(id) {
21023
- if (typeof id === "undefined") {
21023
+ if (isNullOrUndefined(id)) {
21024
21024
  throw new Error("Invalid 'id' parameter.");
21025
21025
  }
21026
21026
  return await this.innerRepository.exist({
@@ -21033,7 +21033,7 @@ class TypeOrmRepository {
21033
21033
  return await this.innerRepository.exist(condition);
21034
21034
  }
21035
21035
  async get(id) {
21036
- if (typeof id === "undefined") {
21036
+ if (isNullOrUndefined(id)) {
21037
21037
  throw new Error("Invalid 'id' parameter.");
21038
21038
  }
21039
21039
  const result = await this.innerRepository.findOne({
@@ -21062,6 +21062,9 @@ class TypeOrmRepository {
21062
21062
  });
21063
21063
  }
21064
21064
  async delete(id) {
21065
+ if (isNullOrUndefined(id)) {
21066
+ throw new Error("Invalid 'id' parameter.");
21067
+ }
21065
21068
  await this.innerRepository.delete({
21066
21069
  id: id,
21067
21070
  });
@@ -21081,6 +21084,9 @@ class TypeOrmRepository {
21081
21084
  return current;
21082
21085
  }
21083
21086
  async update(id, entity) {
21087
+ if (isNullOrUndefined(id)) {
21088
+ throw new Error("Invalid 'id' parameter.");
21089
+ }
21084
21090
  await this.innerRepository.update(id, entity);
21085
21091
  const current = await this.get(id);
21086
21092
  if (!current) {
@@ -21093,6 +21099,9 @@ class TypeOrmRepository {
21093
21099
  return await this.findById(updateResult.generatedMaps.map((x) => x.id));
21094
21100
  }
21095
21101
  async upsert(id, entity) {
21102
+ if (isNullOrUndefined(id)) {
21103
+ throw new Error("Invalid 'id' parameter.");
21104
+ }
21096
21105
  if (await this.exists(id)) {
21097
21106
  return await this.update(id, entity);
21098
21107
  }