@siming-org/core 0.8.12 → 0.8.14

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/index.d.ts CHANGED
@@ -1482,13 +1482,18 @@ declare const TaskSummarySchema: z.ZodObject<{
1482
1482
  type TaskSummary = z.infer<typeof TaskSummarySchema>;
1483
1483
 
1484
1484
  type TaskListFilter = {
1485
- status?: string;
1486
- track?: string;
1485
+ /** T202610190001:维度内多选并集($in;空数组=不过滤) */
1486
+ status?: string[];
1487
+ type?: string[];
1488
+ /** 锚精确匹配(单轨锚原值;'all' 为通配哨兵不在任何 $in 命中集内) */
1489
+ track?: string[];
1490
+ /** 组合轨道派生条件:锚含 '+' 或存量字面值 'mixed'(T202610120005 前创建,M15 只回填 trackMatch 不改写锚) */
1491
+ trackCombined?: boolean;
1487
1492
  projectId?: string;
1488
1493
  page?: number;
1489
1494
  limit?: number;
1490
1495
  sort?: 'progress' | 'createdAt' | 'updatedAt';
1491
- /** T202608290001:标题模糊搜索(不区分大小写的包含匹配——元字符转义防注入,长度上限归路由层) */
1496
+ /** T202610190001:搜索双语义——标题模糊 OR taskId 全等(均不区分大小写;元字符转义防注入,长度上限归路由层) */
1492
1497
  q?: string;
1493
1498
  };
1494
1499
  /**
package/dist/index.js CHANGED
@@ -1952,10 +1952,27 @@ function createTaskRepo(db) {
1952
1952
  ...base,
1953
1953
  async listTasks(filter) {
1954
1954
  const match = {};
1955
- if (filter?.status) match.status = filter.status;
1956
- if (filter?.track) match.track = filter.track;
1957
1955
  if (filter?.projectId) match.projectId = filter.projectId;
1958
- if (filter?.q) match.title = { $regex: escapeRegExpLiteral(filter.q), $options: "i" };
1956
+ if (filter?.status?.length) match.status = { $in: filter.status };
1957
+ if (filter?.type?.length) match.type = { $in: filter.type };
1958
+ const and = [];
1959
+ const trackConds = [];
1960
+ if (filter?.track?.length) trackConds.push({ track: { $in: filter.track } });
1961
+ if (filter?.trackCombined) {
1962
+ trackConds.push({ $or: [{ track: { $regex: /\+/ } }, { track: "mixed" }] });
1963
+ }
1964
+ if (trackConds.length === 1) Object.assign(match, trackConds[0]);
1965
+ else if (trackConds.length === 2) and.push({ $or: trackConds });
1966
+ if (filter?.q) {
1967
+ const esc = escapeRegExpLiteral(filter.q);
1968
+ and.push({
1969
+ $or: [
1970
+ { title: { $regex: esc, $options: "i" } },
1971
+ { taskId: { $regex: `^${esc}$`, $options: "i" } }
1972
+ ]
1973
+ });
1974
+ }
1975
+ if (and.length > 0) match.$and = and;
1959
1976
  const page = filter?.page ?? 1;
1960
1977
  const limit = filter?.limit ?? 20;
1961
1978
  const skip = (page - 1) * limit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siming-org/core",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "license": "MIT",
5
5
  "author": "Wuchao",
6
6
  "engines": {