@tachybase/plugin-full-text-search 1.3.21 → 1.3.23

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.
@@ -1,9 +1,7 @@
1
1
  module.exports = {
2
- "@tachybase/client": "1.3.21",
2
+ "@tachybase/client": "1.3.23",
3
3
  "antd": "5.22.5",
4
4
  "lodash": "4.17.21",
5
- "@tachybase/server": "1.3.21",
6
- "@tachybase/database": "1.3.21",
7
- "@tachybase/actions": "1.3.21",
5
+ "@tego/server": "1.3.43",
8
6
  "sequelize": "6.37.5"
9
7
  };
@@ -1,4 +1,4 @@
1
- import { Collection } from '@tachybase/database';
1
+ import { Collection } from '@tego/server';
2
2
  import { WhereOptions } from 'sequelize';
3
3
  import { handleFieldParams } from '../types';
4
4
  type NestedRecord<T, K extends string> = K extends `${infer Head}.${infer Tail}` ? {
@@ -20,13 +20,13 @@ __export(FieldBase_exports, {
20
20
  FieldBase: () => FieldBase
21
21
  });
22
22
  module.exports = __toCommonJS(FieldBase_exports);
23
- var import_database = require("@tachybase/database");
23
+ var import_server = require("@tego/server");
24
24
  var import_sequelize = require("sequelize");
25
25
  var import_utils = require("../utils");
26
26
  class FieldBase {
27
27
  constructor() {
28
28
  this.type = "";
29
- this.like = import_database.Op.like;
29
+ this.like = import_server.Op.like;
30
30
  this.likeOperator = "LIKE";
31
31
  }
32
32
  getFormateDateStr(field, fieldInfo) {
@@ -44,7 +44,7 @@ class FieldBase {
44
44
  if (!matchEnum.length) {
45
45
  return null;
46
46
  }
47
- return this.convertToObj(field, { [import_database.Op.in]: matchEnum });
47
+ return this.convertToObj(field, { [import_server.Op.in]: matchEnum });
48
48
  }
49
49
  return this.convertToObj(field, { [this.like]: `%${(0, import_utils.escapeLike)(keyword)}%` });
50
50
  }
@@ -54,12 +54,12 @@ class FieldBase {
54
54
  return null;
55
55
  }
56
56
  return {
57
- [import_database.Op.and]: [
58
- (0, import_database.where)(
59
- (0, import_database.literal)(`CAST(${this.getCollectionFieldColName(field, collection, collectionName)} AS TEXT)`),
57
+ [import_server.Op.and]: [
58
+ (0, import_server.where)(
59
+ (0, import_server.literal)(`CAST(${this.getCollectionFieldColName(field, collection, collectionName)} AS TEXT)`),
60
60
  // 确保不加引号,直接插入 SQL 表达式
61
61
  {
62
- [import_database.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
62
+ [import_server.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
63
63
  }
64
64
  )
65
65
  ]
@@ -86,7 +86,7 @@ class FieldBase {
86
86
  }
87
87
  // 多选框如何生成filter
88
88
  getMultiSelectFilter(rawField, matchEnum) {
89
- return this.convertToObj(rawField, { [import_database.Op.contains]: matchEnum });
89
+ return this.convertToObj(rawField, { [import_server.Op.contains]: matchEnum });
90
90
  }
91
91
  array(params) {
92
92
  var _a, _b;
@@ -20,7 +20,7 @@ __export(FieldMariadb_exports, {
20
20
  FieldMariadb: () => FieldMariadb
21
21
  });
22
22
  module.exports = __toCommonJS(FieldMariadb_exports);
23
- var import_database = require("@tachybase/database");
23
+ var import_server = require("@tego/server");
24
24
  var import_utils = require("../utils");
25
25
  var import_FieldBase = require("./FieldBase");
26
26
  class FieldMariadb extends import_FieldBase.FieldBase {
@@ -47,12 +47,12 @@ class FieldMariadb extends import_FieldBase.FieldBase {
47
47
  number(params) {
48
48
  const { field, keyword, collectionName, collection } = params;
49
49
  return {
50
- [import_database.Op.and]: [
51
- (0, import_database.where)(
52
- (0, import_database.literal)(`CAST(${this.getCollectionFieldColName(field, collection, collectionName)} AS CHAR)`),
50
+ [import_server.Op.and]: [
51
+ (0, import_server.where)(
52
+ (0, import_server.literal)(`CAST(${this.getCollectionFieldColName(field, collection, collectionName)} AS CHAR)`),
53
53
  // 确保不加引号,直接插入 SQL 表达式
54
54
  {
55
- [import_database.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
55
+ [import_server.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
56
56
  }
57
57
  )
58
58
  ]
@@ -61,11 +61,11 @@ class FieldMariadb extends import_FieldBase.FieldBase {
61
61
  date(params) {
62
62
  const { field, keyword, dateStr, timezone, collectionName, collection } = params;
63
63
  return {
64
- [import_database.Op.and]: [
65
- (0, import_database.where)(
66
- (0, import_database.fn)(
64
+ [import_server.Op.and]: [
65
+ (0, import_server.where)(
66
+ (0, import_server.fn)(
67
67
  "DATE_FORMAT",
68
- (0, import_database.fn)("CONVERT_TZ", this.getCollectionField(field, collection, collectionName), "+00:00", timezone),
68
+ (0, import_server.fn)("CONVERT_TZ", this.getCollectionField(field, collection, collectionName), "+00:00", timezone),
69
69
  dateStr
70
70
  ),
71
71
  {
@@ -78,13 +78,13 @@ class FieldMariadb extends import_FieldBase.FieldBase {
78
78
  json(params) {
79
79
  const { field, keyword, collection, collectionName } = params;
80
80
  return {
81
- [import_database.Op.and]: [
82
- (0, import_database.where)(
83
- (0, import_database.literal)(
81
+ [import_server.Op.and]: [
82
+ (0, import_server.where)(
83
+ (0, import_server.literal)(
84
84
  `JSON_UNQUOTE(JSON_EXTRACT(${this.getCollectionFieldColName(field, collection, collectionName)}, '$'))`
85
85
  ),
86
86
  {
87
- [import_database.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
87
+ [import_server.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
88
88
  }
89
89
  )
90
90
  ]
@@ -92,7 +92,7 @@ class FieldMariadb extends import_FieldBase.FieldBase {
92
92
  }
93
93
  getMultiSelectFilter(rawField, matchEnum) {
94
94
  return {
95
- [import_database.Op.and]: [(0, import_database.literal)(`JSON_CONTAINS(${rawField}, '${JSON.stringify(matchEnum)}')`)]
95
+ [import_server.Op.and]: [(0, import_server.literal)(`JSON_CONTAINS(${rawField}, '${JSON.stringify(matchEnum)}')`)]
96
96
  };
97
97
  }
98
98
  }
@@ -20,7 +20,7 @@ __export(FieldPostgres_exports, {
20
20
  FieldPostgres: () => FieldPostgres
21
21
  });
22
22
  module.exports = __toCommonJS(FieldPostgres_exports);
23
- var import_database = require("@tachybase/database");
23
+ var import_server = require("@tego/server");
24
24
  var import_sequelize = require("sequelize");
25
25
  var import_utils = require("../utils");
26
26
  var import_FieldBase = require("./FieldBase");
@@ -28,7 +28,7 @@ class FieldPostgres extends import_FieldBase.FieldBase {
28
28
  constructor() {
29
29
  super(...arguments);
30
30
  this.type = "postgres";
31
- this.like = import_database.Op.iLike;
31
+ this.like = import_server.Op.iLike;
32
32
  this.likeOperator = "ILIKE";
33
33
  }
34
34
  getFormateDateStr(field, fieldInfo) {
@@ -46,22 +46,22 @@ class FieldPostgres extends import_FieldBase.FieldBase {
46
46
  date(params) {
47
47
  const { field, keyword, dateStr, timezone, collectionName, collection } = params;
48
48
  return {
49
- [import_database.Op.and]: [
50
- (0, import_database.where)(
51
- (0, import_database.fn)(
49
+ [import_server.Op.and]: [
50
+ (0, import_server.where)(
51
+ (0, import_server.fn)(
52
52
  "TO_CHAR",
53
- (0, import_database.fn)(
53
+ (0, import_server.fn)(
54
54
  "TIMEZONE",
55
55
  timezone,
56
56
  // 参数1:目标时区
57
- (0, import_database.fn)("TIMEZONE", "UTC", this.getCollectionField(field, collection, collectionName))
57
+ (0, import_server.fn)("TIMEZONE", "UTC", this.getCollectionField(field, collection, collectionName))
58
58
  // 参数2:UTC 转换后的字段
59
59
  ),
60
60
  dateStr
61
61
  // 参数3:格式化字符串
62
62
  ),
63
63
  {
64
- [import_database.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
64
+ [import_server.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
65
65
  }
66
66
  )
67
67
  ]
@@ -81,12 +81,12 @@ class FieldPostgres extends import_FieldBase.FieldBase {
81
81
  return null;
82
82
  }
83
83
  return {
84
- [import_database.Op.and]: [
85
- (0, import_database.where)(
84
+ [import_server.Op.and]: [
85
+ (0, import_server.where)(
86
86
  (0, import_sequelize.literal)(`CAST(${this.getCollectionFieldColName(field, collection, collectionName)} AS TEXT)`),
87
87
  // 确保不加引号,直接插入 SQL 表达式
88
88
  {
89
- [import_database.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
89
+ [import_server.Op.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
90
90
  }
91
91
  )
92
92
  ]
@@ -1,4 +1,4 @@
1
- import { Op } from '@tachybase/database';
1
+ import { Op } from '@tego/server';
2
2
  import { WhereOptions } from 'sequelize';
3
3
  import { handleFieldParams } from '../types';
4
4
  import { FieldBase } from './FieldBase';
@@ -20,7 +20,7 @@ __export(FieldSqlite_exports, {
20
20
  FieldSqlite: () => FieldSqlite
21
21
  });
22
22
  module.exports = __toCommonJS(FieldSqlite_exports);
23
- var import_database = require("@tachybase/database");
23
+ var import_server = require("@tego/server");
24
24
  var import_utils = require("../utils");
25
25
  var import_FieldBase = require("./FieldBase");
26
26
  class FieldSqlite extends import_FieldBase.FieldBase {
@@ -47,12 +47,12 @@ class FieldSqlite extends import_FieldBase.FieldBase {
47
47
  date(params) {
48
48
  const { field, keyword, dateStr, timezone, collectionName, collection } = params;
49
49
  return {
50
- [import_database.Op.and]: [
51
- (0, import_database.where)(
52
- (0, import_database.fn)(
50
+ [import_server.Op.and]: [
51
+ (0, import_server.where)(
52
+ (0, import_server.fn)(
53
53
  "strftime",
54
54
  dateStr,
55
- (0, import_database.fn)("datetime", this.getCollectionField(field, collection, collectionName), (0, import_utils.convertTimezoneOffset)(timezone))
55
+ (0, import_server.fn)("datetime", this.getCollectionField(field, collection, collectionName), (0, import_utils.convertTimezoneOffset)(timezone))
56
56
  ),
57
57
  {
58
58
  [this.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
@@ -64,8 +64,8 @@ class FieldSqlite extends import_FieldBase.FieldBase {
64
64
  json(params) {
65
65
  const { field, keyword, collectionName, collection } = params;
66
66
  return {
67
- [import_database.Op.and]: [
68
- (0, import_database.where)((0, import_database.literal)(`json_extract(${this.getCollectionFieldColName(field, collection, collectionName)}, '$')`), {
67
+ [import_server.Op.and]: [
68
+ (0, import_server.where)((0, import_server.literal)(`json_extract(${this.getCollectionFieldColName(field, collection, collectionName)}, '$')`), {
69
69
  [this.like]: `%${(0, import_utils.escapeLike)(keyword)}%`
70
70
  })
71
71
  ]
@@ -74,8 +74,8 @@ class FieldSqlite extends import_FieldBase.FieldBase {
74
74
  getMultiSelectFilter(rawField, matchEnum) {
75
75
  const matchList = matchEnum.map((value) => `'${value}'`).join(",");
76
76
  return {
77
- [import_database.Op.and]: [
78
- (0, import_database.literal)(`
77
+ [import_server.Op.and]: [
78
+ (0, import_server.literal)(`
79
79
  EXISTS (
80
80
  SELECT 1
81
81
  FROM json_each(${rawField})
@@ -1,2 +1,2 @@
1
- import { Context } from '@tachybase/actions';
1
+ import { Context } from '@tego/server';
2
2
  export declare function searchMiddleware(ctx: Context, next: Function): Promise<any>;
@@ -1,4 +1,4 @@
1
- import { Plugin } from '@tachybase/server';
1
+ import { Plugin } from '@tego/server';
2
2
  export declare class PluginFullTextSearchServer extends Plugin {
3
3
  afterAdd(): Promise<void>;
4
4
  beforeLoad(): Promise<void>;
@@ -21,7 +21,7 @@ __export(plugin_exports, {
21
21
  default: () => plugin_default
22
22
  });
23
23
  module.exports = __toCommonJS(plugin_exports);
24
- var import_server = require("@tachybase/server");
24
+ var import_server = require("@tego/server");
25
25
  var import_search = require("./middlewares/search");
26
26
  class PluginFullTextSearchServer extends import_server.Plugin {
27
27
  async afterAdd() {
@@ -1,4 +1,4 @@
1
- import { Collection } from '@tachybase/database';
1
+ import { Collection } from '@tego/server';
2
2
  import { FieldBase } from './dialects/FieldBase';
3
3
  import { ProcessFieldParams } from './types';
4
4
  export declare function handleField(handler: FieldBase, func: Function, field: string, fields: Map<string, any>, keywords: string[], extraParams?: {
@@ -1,5 +1,4 @@
1
- import { Context } from '@tachybase/actions';
2
- import { Collection } from '@tachybase/database';
1
+ import { Collection, Context } from '@tego/server';
3
2
  import { FieldBase } from './dialects/FieldBase';
4
3
  export type FiledName = string;
5
4
  export interface SearchParams {
package/package.json CHANGED
@@ -1,24 +1,21 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-full-text-search",
3
3
  "displayName": "Full-text Search",
4
- "version": "1.3.21",
4
+ "version": "1.3.23",
5
5
  "description": "Provides full text search capability",
6
6
  "keywords": [
7
7
  "System management"
8
8
  ],
9
9
  "main": "dist/server/index.js",
10
10
  "devDependencies": {
11
+ "@tachybase/test": "^1.3.43",
12
+ "@tego/client": "^1.3.43",
13
+ "@tego/server": "^1.3.43",
11
14
  "@types/sequelize": "^4.28.20",
12
15
  "antd": "5.22.5",
13
16
  "lodash": "4.17.21",
14
- "sequelize": "^6.37.5"
15
- },
16
- "peerDependencies": {
17
- "@tachybase/actions": "1.3.21",
18
- "@tachybase/database": "1.3.21",
19
- "@tachybase/server": "1.3.21",
20
- "@tachybase/test": "1.3.21",
21
- "@tachybase/client": "1.3.21"
17
+ "sequelize": "^6.37.5",
18
+ "@tachybase/client": "1.3.23"
22
19
  },
23
20
  "description.zh-CN": "提供全字段搜索能力",
24
21
  "displayName.zh-CN": "全文搜索"