semanticdb-core 1.1.21 → 1.1.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.
@@ -13,6 +13,8 @@ export declare type PropertyTypePrimalType = 'string' | 'number' | 'boolean' | '
13
13
  export interface PropertyTypeDraft {
14
14
  _sid?: string | number;
15
15
  _id?: string;
16
+ sid?: string;
17
+ id?: string;
16
18
  name: string;
17
19
  syno?: string[];
18
20
  description?: string;
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getDrilldownDimensions = void 0;
16
16
  const logicform_utils_1 = require("../../logicform/logicform.utils");
17
- const property_utils_1 = require("../property.utils");
18
17
  const moment_1 = __importDefault(require("moment"));
19
18
  // 日期粒度,从粗到细
20
19
  const DATE_GRANULARITIES = [
@@ -50,7 +49,6 @@ const getDrilldownDimensions = (schema_1, schemasDict_1, logicform_1, ...args_1)
50
49
  let drilldownProps = [];
51
50
  // 一个递归函数
52
51
  const addToArrayWithProperty = (property, prefix, schema) => {
53
- var _a;
54
52
  if (usage === 'analyze' && property.is_analyzable === false)
55
53
  return;
56
54
  const pushToPropNames = (property, level, prefix, schema) => {
@@ -76,22 +74,12 @@ const getDrilldownDimensions = (schema_1, schemasDict_1, logicform_1, ...args_1)
76
74
  if (property.can_drilldown === false)
77
75
  return;
78
76
  if (property.primal_type === 'date') {
79
- // 日期维度的下钻:提供更细粒度的选项
80
- const propertyId = prefix ? `${prefix}_${property.name}` : property.name;
81
- // 找到当前 logicform 中该属性的粒度
82
- const currentGroupBy = (_a = logicform === null || logicform === void 0 ? void 0 : logicform.groupby) === null || _a === void 0 ? void 0 : _a.find((g) => g._id === propertyId);
83
- const currentGranularity = currentGroupBy === null || currentGroupBy === void 0 ? void 0 : currentGroupBy.level;
84
- // 获取属性的默认粒度
85
- const defaultGranularity = (0, property_utils_1.getGranularity)(property);
86
- // 确定起始粒度索引
87
- const startIndex = currentGranularity
88
- ? DATE_GRANULARITIES.indexOf(currentGranularity)
89
- : DATE_GRANULARITIES.indexOf(defaultGranularity);
90
- if (startIndex >= 0 && startIndex < DATE_GRANULARITIES.length - 1) {
91
- // 提供比当前粒度更细的所有选项
92
- for (let i = startIndex + 1; i < DATE_GRANULARITIES.length; i++) {
93
- pushToPropNames(property, DATE_GRANULARITIES[i], prefix, schema);
94
- }
77
+ // 日期维度的下钻:从 year 开始,提供更细粒度的所有选项
78
+ // TODO: 后续需要从 logicform.query 中获取当前粒度
79
+ const startIndex = DATE_GRANULARITIES.indexOf('year');
80
+ // 提供比当前粒度更细的所有选项
81
+ for (let i = startIndex + 1; i < DATE_GRANULARITIES.length; i++) {
82
+ pushToPropNames(property, DATE_GRANULARITIES[i], prefix, schema);
95
83
  }
96
84
  }
97
85
  else if (property.is_categorical) {
@@ -35,10 +35,6 @@ function isSchemaValid(schema, schemasDict) {
35
35
  if (!schema.properties.every((property) => property.name && property.name.trim() !== '' && property.type)) {
36
36
  return { valid: false, message: '每一个属性都必须有名称和类型' };
37
37
  }
38
- // 检查_id
39
- if (!schema._id) {
40
- return { valid: false, message: '错误的schema配置,缺少_id' };
41
- }
42
38
  // 检查db
43
39
  if (!schema.db) {
44
40
  return { valid: false, message: '缺少数据库配置' };
@@ -100,11 +96,11 @@ function isSchemaValid(schema, schemasDict) {
100
96
  seenNames.add(name);
101
97
  }
102
98
  // ==================== 检查属性_id重复 ====================
103
- const propertyIds = schema.properties.map((p) => p._id).filter((id) => !!id);
99
+ const propertyIds = schema.properties.map((p) => p.id).filter((id) => !!id);
104
100
  const seenIds = new Set();
105
101
  for (const id of propertyIds) {
106
102
  if (seenIds.has(id)) {
107
- return { valid: false, message: `${schema.name} 中有两个相同_id的属性:${id}` };
103
+ return { valid: false, message: `${schema.name} 中有两个相同id的属性:${id}` };
108
104
  }
109
105
  seenIds.add(id);
110
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [