semanticdb-core 1.1.8 → 1.1.9

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.
@@ -3,9 +3,9 @@ import { PropertyType } from '../schema/property';
3
3
  import { SchemaType } from '../schema/schema';
4
4
  export interface LogicformResultType {
5
5
  error?: string;
6
- result: Record<string, any>[];
7
- logicform: LogicformType;
8
- schemas: Record<string, SchemaType>;
9
- columnProperties: PropertyType[];
6
+ result?: Record<string, any>[];
7
+ logicform?: LogicformType;
8
+ schemas?: Record<string, SchemaType>;
9
+ columnProperties?: PropertyType[];
10
10
  }
11
11
  export declare const logicformResultToMarkdown: (ret: LogicformResultType, number_only?: boolean) => string;
@@ -8,6 +8,8 @@ const json2md_1 = __importDefault(require("json2md"));
8
8
  const property_utils_1 = require("../schema/property.utils");
9
9
  const logicformResultToMarkdown = (ret, number_only) => {
10
10
  const { schemas, result, logicform, columnProperties } = ret;
11
+ if (!result || !logicform || !columnProperties || !schemas)
12
+ return '没有数据';
11
13
  if (result.length === 0)
12
14
  return '没有数据';
13
15
  let markdownText = '';
@@ -27,13 +27,13 @@ function isSchemaValid(schema, schemasDict) {
27
27
  if (schema.type === 'entity') {
28
28
  const IDProp = schema.properties.find((property) => property.type === 'ID');
29
29
  if (!IDProp) {
30
- return { valid: false, message: 'entity类型必须有一个type为ID的属性' };
30
+ return { valid: false, message: '实体必须有一个语义类型为 ID 的属性' };
31
31
  }
32
32
  }
33
33
  else if (schema.type === 'event') {
34
34
  const timestampProps = schema.properties.filter((property) => property.type === 'timestamp');
35
35
  if (timestampProps.length === 0) {
36
- return { valid: false, message: 'event类型必须有一个type为timestamp的属性' };
36
+ return { valid: false, message: '事件必须有一个语义类型为 时间戳 的属性' };
37
37
  }
38
38
  }
39
39
  const noRefProperty = schema.properties.find((property) => property.ref && !(property.ref in schemasDict));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [