@nocobase/database 1.0.0-alpha.15 → 1.0.0-alpha.16

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.
@@ -62,6 +62,7 @@ export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'>
62
62
  * - 'user' - collection is from user
63
63
  */
64
64
  origin?: string;
65
+ asStrategyResource?: boolean;
65
66
  [key: string]: any;
66
67
  }
67
68
  export interface CollectionContext {
package/lib/collection.js CHANGED
@@ -530,13 +530,9 @@ const _Collection = class _Collection extends import_events.EventEmitter {
530
530
  const indexes = this.model._indexes;
531
531
  this.model._indexes = import_lodash.default.uniqBy(
532
532
  indexes.filter((item) => {
533
- return item.fields.every(
534
- (field) => Object.values(this.model.rawAttributes).find((fieldVal) => fieldVal.field === field)
535
- );
533
+ return item.fields.every((field) => this.model.rawAttributes[field]);
536
534
  }).map((item) => {
537
- if (this.options.underscored) {
538
- item.fields = item.fields.map((field) => (0, import_utils.snakeCase)(field));
539
- }
535
+ item.fields = item.fields.map((field) => this.model.rawAttributes[field].field);
540
536
  return item;
541
537
  }),
542
538
  "name"
package/lib/database.js CHANGED
@@ -616,7 +616,7 @@ const _Database = class _Database extends import_events.EventEmitter {
616
616
  }
617
617
  /* istanbul ignore next -- @preserve */
618
618
  async auth(options = {}) {
619
- const { retry = 10, ...others } = options;
619
+ const { retry = 5, ...others } = options;
620
620
  const startingDelay = 50;
621
621
  const timeMultiple = 2;
622
622
  let attemptNumber = 1;
@@ -643,7 +643,7 @@ const _Database = class _Database extends import_events.EventEmitter {
643
643
  timeMultiple
644
644
  });
645
645
  } catch (error) {
646
- throw new Error("Connection failed, please check your database connection credentials and try again.");
646
+ throw new Error(`Unable to connect to the database`, { cause: error });
647
647
  }
648
648
  }
649
649
  /**
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.16",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.0.0-alpha.15",
10
- "@nocobase/utils": "1.0.0-alpha.15",
9
+ "@nocobase/logger": "1.0.0-alpha.16",
10
+ "@nocobase/utils": "1.0.0-alpha.16",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "2793d371368e094ea2bba04cfbe9b9b73c44edba"
41
+ "gitHead": "2a80f1804e0f0972d40e1a201310b192914849d0"
42
42
  }