semanticdb-core 1.1.17 → 1.1.19

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,4 +1,5 @@
1
1
  import { RepresentationType } from '../common/representation';
2
+ import { PropertyType } from '../schema/property';
2
3
  import { SchemaType } from '../schema/schema';
3
4
  import { QueryType } from './types/query';
4
5
  export interface PredItemType {
@@ -20,6 +21,7 @@ export interface GroupbyItemType {
20
21
  name?: string;
21
22
  schema?: SchemaType;
22
23
  order?: string[];
24
+ property?: Pick<PropertyType, 'type' | 'primal_type'>;
23
25
  }
24
26
  export interface LogicformType {
25
27
  schema: string;
@@ -1,3 +1,3 @@
1
1
  import { GroupbyItemType, LogicformType } from '../../logicform/logicform';
2
2
  import { SchemaType } from '../schema';
3
- export declare const getDrilldownDimensions: (schema: SchemaType, schemasDict: Record<string, SchemaType>, logicform?: LogicformType) => Promise<GroupbyItemType[]>;
3
+ export declare const getDrilldownDimensions: (schema: SchemaType, schemasDict: Record<string, SchemaType>, logicform?: LogicformType, usage?: "drilldown" | "analyze") => Promise<GroupbyItemType[]>;
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getDrilldownDimensions = void 0;
16
16
  const logicform_utils_1 = require("../../logicform/logicform.utils");
17
17
  const moment_1 = __importDefault(require("moment"));
18
- const getDrilldownDimensions = (schema, schemasDict, logicform) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const getDrilldownDimensions = (schema_1, schemasDict_1, logicform_1, ...args_1) => __awaiter(void 0, [schema_1, schemasDict_1, logicform_1, ...args_1], void 0, function* (schema, schemasDict, logicform, usage = 'drilldown') {
19
19
  if (!schema)
20
20
  return []; // 如果没有schema,代表logicform result报错了
21
21
  if (logicform && schema.analyzer && schema.analyzer.drilldown) {
@@ -38,11 +38,11 @@ const getDrilldownDimensions = (schema, schemasDict, logicform) => __awaiter(voi
38
38
  let drilldownProps = [];
39
39
  // 一个递归函数
40
40
  const addToArrayWithProperty = (property, prefix, schema) => {
41
- if (property.is_analyzable === false)
41
+ if (usage === 'analyze' && property.is_analyzable === false)
42
42
  return;
43
- const pushToPropNames = (propertyName, level, prefix, schema) => {
43
+ const pushToPropNames = (property, level, prefix, schema) => {
44
44
  const groupbyItem = {
45
- _id: prefix ? `${prefix}_${propertyName}` : propertyName,
45
+ _id: prefix ? `${prefix}_${property.name}` : property.name,
46
46
  };
47
47
  if (level) {
48
48
  groupbyItem.level = level;
@@ -50,6 +50,10 @@ const getDrilldownDimensions = (schema, schemasDict, logicform) => __awaiter(voi
50
50
  if (schema) {
51
51
  groupbyItem.schema = schema;
52
52
  }
53
+ groupbyItem.property = {
54
+ type: property.type,
55
+ primal_type: property.primal_type,
56
+ };
53
57
  drilldownProps.push(groupbyItem);
54
58
  };
55
59
  if (property.isArray)
@@ -59,7 +63,7 @@ const getDrilldownDimensions = (schema, schemasDict, logicform) => __awaiter(voi
59
63
  if (property.can_drilldown === false)
60
64
  return;
61
65
  if (property.is_categorical) {
62
- pushToPropNames(property.name, undefined, prefix, schema);
66
+ pushToPropNames(property, undefined, prefix, schema);
63
67
  }
64
68
  else if (property.ref && schemasDict[property.ref]) {
65
69
  if (schemasDict[property.ref].drilldown) {
@@ -67,17 +71,17 @@ const getDrilldownDimensions = (schema, schemasDict, logicform) => __awaiter(voi
67
71
  if (!h._id.startsWith('_')) {
68
72
  property.name = h._id ? `${property.name}_${h._id}` : property.name;
69
73
  }
70
- pushToPropNames(property.name, h.level, prefix, schema);
74
+ pushToPropNames(property, h.level, prefix, schema);
71
75
  });
72
76
  return;
73
77
  }
74
78
  else if (schemasDict[property.ref].hierarchy) {
75
79
  schemasDict[property.ref].hierarchy.forEach((h) => {
76
- pushToPropNames(property.name, h.name, prefix, schema);
80
+ pushToPropNames(property, h.name, prefix, schema);
77
81
  });
78
82
  }
79
83
  else {
80
- pushToPropNames(property.name, undefined, prefix, schema);
84
+ pushToPropNames(property, undefined, prefix, schema);
81
85
  }
82
86
  // 这里要获取其他schema的属性
83
87
  if (!prefix || prefix.split('_').length < 3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [