semanticdb-core 1.1.51 → 1.1.52

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.
@@ -56,6 +56,18 @@ const isSubQueryLikeValue = (value) => {
56
56
  'query' in value &&
57
57
  !('groupby' in value));
58
58
  };
59
+ const isCompositeLogicformValue = (value) => {
60
+ return Boolean(value &&
61
+ typeof value === 'object' &&
62
+ !Array.isArray(value) &&
63
+ 'schema' in value &&
64
+ ('preds' in value ||
65
+ 'groupby' in value ||
66
+ 'having' in value ||
67
+ 'limit' in value ||
68
+ 'skip' in value ||
69
+ 'sort' in value));
70
+ };
59
71
  const explainInlineQueryValues = (query, schemas) => {
60
72
  return explainFilterLikeQuery(query ? (0, logicform_utils_1.getFlattenQuery)(query, schemas) : undefined, '', true, schemas).values;
61
73
  };
@@ -366,6 +378,12 @@ const stringifyExplainFilterLikeResult = (result, separator = ' ') => {
366
378
  return `${result.title}${separator}${result.values.join('、')}`;
367
379
  };
368
380
  exports.stringifyExplainFilterLikeResult = stringifyExplainFilterLikeResult;
381
+ const stringifyExplainLogicformInline = (logicform, schemas) => {
382
+ return (0, exports.explainLogicform)(logicform, schemas)
383
+ .map((item) => (0, exports.stringifyExplainFilterLikeResult)(item))
384
+ .filter((item) => item.length > 0)
385
+ .join(';');
386
+ };
369
387
  const explainGroupbyLevel = (level) => {
370
388
  if (!level) {
371
389
  return '';
@@ -396,9 +414,18 @@ const explainSchema = (logicform, schemas, locale = exports.DEFAULT_EXPLAIN_LOGI
396
414
  exports.explainSchema = explainSchema;
397
415
  const explainQuery = (logicform, _schemas, locale = exports.DEFAULT_EXPLAIN_LOGICFORM_LOCALE) => {
398
416
  (0, exports.normalizeExplainLogicformLocale)(locale);
399
- const query = logicform.query ? (0, logicform_utils_1.getFlattenQuery)(logicform.query, _schemas) : undefined;
400
417
  const entities = collectQueryEntities(logicform, logicform.query);
401
- return buildExplainResultWithEntities('筛选', explainFilterLikeQuery(query, '筛选', true, _schemas).values, entities);
418
+ const values = !logicform.query
419
+ ? []
420
+ : Object.entries(logicform.query)
421
+ .flatMap(([key, value]) => {
422
+ if (isCompositeLogicformValue(value)) {
423
+ return `${formatExplainKey(key)} = (${stringifyExplainLogicformInline(value, _schemas)})`;
424
+ }
425
+ return explainFilterLikeQuery((0, logicform_utils_1.getFlattenQuery)({ [key]: value }, _schemas), '筛选', true, _schemas).values;
426
+ })
427
+ .filter((value) => value.length > 0);
428
+ return buildExplainResultWithEntities('筛选', values, entities);
402
429
  };
403
430
  exports.explainQuery = explainQuery;
404
431
  const explainEntityID = (logicform, _schemas, locale = exports.DEFAULT_EXPLAIN_LOGICFORM_LOCALE) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.1.51",
3
+ "version": "1.1.52",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [