@tachybase/data-source 0.23.18 → 0.23.20

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.
@@ -10,6 +10,7 @@ export declare class Collection implements ICollection {
10
10
  setField(name: string, options: any): CollectionField;
11
11
  removeField(name: string): void;
12
12
  getField(name: string): IField;
13
+ getFieldByField(field: string): IField;
13
14
  getFields(): IField[];
14
15
  protected setRepository(repository: any): void;
15
16
  }
package/lib/collection.js CHANGED
@@ -67,6 +67,14 @@ const _Collection = class _Collection {
67
67
  getField(name) {
68
68
  return this.fields.get(name);
69
69
  }
70
+ getFieldByField(field) {
71
+ for (const item of this.fields.values()) {
72
+ if (item.options.field === field) {
73
+ return item;
74
+ }
75
+ }
76
+ return null;
77
+ }
70
78
  getFields() {
71
79
  return [...this.fields.values()];
72
80
  }
package/lib/types.d.ts CHANGED
@@ -30,6 +30,7 @@ export interface ICollection {
30
30
  removeField(name: string): void;
31
31
  getFields(): Array<IField>;
32
32
  getField(name: string): IField;
33
+ getFieldByField(field: string): IField;
33
34
  [key: string]: any;
34
35
  }
35
36
  export interface IModel {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/data-source",
3
- "version": "0.23.18",
3
+ "version": "0.23.20",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./lib/index.js",
@@ -11,12 +11,12 @@
11
11
  "jsonwebtoken": "^8.5.1",
12
12
  "koa-compose": "^4.1.0",
13
13
  "lodash": "4.17.21",
14
- "@tachybase/acl": "0.23.18",
15
- "@tachybase/cache": "0.23.18",
16
- "@tachybase/database": "0.23.18",
17
- "@tachybase/resourcer": "0.23.18",
18
- "@tachybase/actions": "0.23.18",
19
- "@tachybase/utils": "0.23.18"
14
+ "@tachybase/acl": "0.23.20",
15
+ "@tachybase/actions": "0.23.20",
16
+ "@tachybase/cache": "0.23.20",
17
+ "@tachybase/utils": "0.23.20",
18
+ "@tachybase/resourcer": "0.23.20",
19
+ "@tachybase/database": "0.23.20"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/koa": "^2.15.0",