@tachybase/database 0.23.17 → 0.23.18

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/lib/collection.js CHANGED
@@ -210,7 +210,7 @@ const _Collection = class _Collection extends (_a = import_events.EventEmitter,
210
210
  if (typeof repository === "string") {
211
211
  repo = this.context.database.repositories.get(repository) || import_repository.Repository;
212
212
  }
213
- if (this.options.tree == "adjacency-list" || this.options.tree == "adjacencyList") {
213
+ if (this.options.tree === "adjacency-list" || this.options.tree === "adjacencyList") {
214
214
  repo = import_adjacency_list_repository.AdjacencyListRepository;
215
215
  }
216
216
  this.repository = new repo(this);
@@ -291,7 +291,7 @@ const _Collection = class _Collection extends (_a = import_events.EventEmitter,
291
291
  }
292
292
  );
293
293
  const oldField = this.fields.get(name);
294
- if (oldField && oldField.options.inherit && field.typeToString() != oldField.typeToString()) {
294
+ if (oldField && oldField.options.inherit && field.typeToString() !== oldField.typeToString()) {
295
295
  throw new Error(
296
296
  `Field type conflict: cannot set "${name}" on "${this.name}" to ${options.type}, parent "${name}" type is ${oldField.options.type}`
297
297
  );
@@ -387,12 +387,15 @@ const _Collection = class _Collection extends (_a = import_events.EventEmitter,
387
387
  field.remove();
388
388
  return;
389
389
  }
390
- const columnReferencesCount = import_lodash.default.filter(this.model.rawAttributes, (attr) => attr.field == field.columnName()).length;
390
+ const columnReferencesCount = import_lodash.default.filter(
391
+ this.model.rawAttributes,
392
+ (attr) => attr.field === field.columnName()
393
+ ).length;
391
394
  if (await field.existsInDb({
392
395
  transaction: options == null ? void 0 : options.transaction
393
- }) && columnReferencesCount == 1) {
396
+ }) && columnReferencesCount === 1) {
394
397
  const columns = await this.model.sequelize.getQueryInterface().describeTable(this.getTableNameWithSchema(), options);
395
- if (Object.keys(columns).length == 1) {
398
+ if (Object.keys(columns).length === 1) {
396
399
  await this.removeFromDb({
397
400
  ...options,
398
401
  cascade: true,
@@ -669,7 +672,7 @@ const _Collection = class _Collection extends (_a = import_events.EventEmitter,
669
672
  checkTableName() {
670
673
  const tableName = this.tableName();
671
674
  for (const [k, collection] of this.db.collections) {
672
- if (collection.name != this.options.name && tableName === collection.tableName() && collection.collectionSchema() === this.collectionSchema()) {
675
+ if (collection.name !== this.options.name && tableName === collection.tableName() && collection.collectionSchema() === this.collectionSchema()) {
673
676
  throw new Error(`collection ${collection.name} and ${this.name} have same tableName "${tableName}"`);
674
677
  }
675
678
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/database",
3
- "version": "0.23.17",
3
+ "version": "0.23.18",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./lib/index.js",
@@ -24,8 +24,8 @@
24
24
  "semver": "^7.6.3",
25
25
  "sequelize": "^6.37.5",
26
26
  "umzug": "^3.8.2",
27
- "@tachybase/logger": "0.23.17",
28
- "@tachybase/utils": "0.23.17"
27
+ "@tachybase/logger": "0.23.18",
28
+ "@tachybase/utils": "0.23.18"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/flat": "^5.0.5",