@holistics/cli-core 2.4.6 → 2.4.7

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.
Files changed (2) hide show
  1. package/dist/commands.js +42 -21
  2. package/package.json +1 -1
package/dist/commands.js CHANGED
@@ -27799,7 +27799,7 @@ var require_dist3 = __commonJS((exports2) => {
27799
27799
  exports2.default = deferred;
27800
27800
  });
27801
27801
  // package.json
27802
- var version = "2.4.6";
27802
+ var version = "2.4.7";
27803
27803
 
27804
27804
  // ../../node_modules/.pnpm/@commander-js+extra-typings@13.1.0_commander@13.1.0/node_modules/@commander-js/extra-typings/esm.mjs
27805
27805
  var import__ = __toESM(require_extra_typings(), 1);
@@ -112251,9 +112251,9 @@ function convertModelingParamField(e10, t) {
112251
112251
  };
112252
112252
  }
112253
112253
  var convertModelingMetricFields = (e10) => e10 ? import_lodash2.compact(e10).map((e11) => convertModelingField(e11, "measure", true)) : [];
112254
- function modelFromModeling(e10, t, n = true) {
112255
- let r3 = getFqn(e10.name), i = (e11, t3) => e11 ? import_lodash2.compact(e11).map((e12) => convertModelingField(e12, t3, n, r3)) : [], a = (e11) => e11 ? import_lodash2.compact(e11).map((e12) => convertModelingParamField(e12, r3)) : [], s3 = (e11) => e11 ? import_lodash2.compact(e11.map((e12) => {
112256
- let t3 = convertModelingField(e12, "measure", n, r3);
112254
+ function modelFromModeling(e10, t, n, r3) {
112255
+ let i = getFqn(e10.name), a = (e11, t3) => e11 ? import_lodash2.compact(e11).map((e12) => convertModelingField(e12, t3, n, i)) : [], s3 = (e11) => e11 ? import_lodash2.compact(e11).map((e12) => convertModelingParamField(e12, i)) : [], c3 = (e11) => e11 ? import_lodash2.compact(e11.map((e12) => {
112256
+ let t3 = convertModelingField(e12, "measure", n, i);
112257
112257
  if (t3 && t3.syntax === "sql")
112258
112258
  return {
112259
112259
  ...t3,
@@ -112266,7 +112266,7 @@ function modelFromModeling(e10, t, n = true) {
112266
112266
  fieldName: `${t3.origin.fieldName}->inner`
112267
112267
  } }
112268
112268
  };
112269
- })) : [], c3 = (e11) => {
112269
+ })) : [], l = (e11) => {
112270
112270
  if (e11)
112271
112271
  return {
112272
112272
  mode: e11.mode,
@@ -112284,31 +112284,31 @@ function modelFromModeling(e10, t, n = true) {
112284
112284
  return "QueryModel";
112285
112285
  })(e10)) {
112286
112286
  case "QueryModel": {
112287
- let n3 = e10, { models: l } = n3;
112287
+ let n3 = e10, { models: u } = n3;
112288
112288
  return createQueryModel({
112289
- name: r3,
112289
+ name: i,
112290
112290
  dataSource: t,
112291
- models: import_lodash2.values(l).map((e11) => modelFromModeling(e11, t, false)),
112292
- dimensions: import_lodash2.compact(import_lodash2.concat(i(n3.dimensions, "dimension"), s3(n3.measures))),
112293
- measures: import_lodash2.compact(i(n3.measures, "measure")),
112294
- params: import_lodash2.compact(a(n3.params)),
112291
+ models: r3 ?? import_lodash2.values(u).map((e11) => modelFromModeling(e11, t, false)),
112292
+ dimensions: import_lodash2.compact(import_lodash2.concat(a(n3.dimensions, "dimension"), c3(n3.measures))),
112293
+ measures: import_lodash2.compact(a(n3.measures, "measure")),
112294
+ params: import_lodash2.compact(s3(n3.params)),
112295
112295
  label: n3.label,
112296
112296
  description: n3.description,
112297
112297
  query: n3.query,
112298
- persistence: n3.persistence && c3(n3.persistence)
112298
+ persistence: n3.persistence && l(n3.persistence)
112299
112299
  });
112300
112300
  }
112301
112301
  case "TableModel": {
112302
- let n3 = e10, c4 = typeof n3.table_name == "string" ? n3.table_name : n3.table_name.table_name;
112302
+ let n3 = e10, r4 = typeof n3.table_name == "string" ? n3.table_name : n3.table_name.table_name;
112303
112303
  return createTableModel({
112304
- name: r3,
112304
+ name: i,
112305
112305
  dataSource: t,
112306
- dimensions: import_lodash2.compact(import_lodash2.concat(i(n3.dimensions, "dimension"), s3(n3.measures))),
112307
- measures: import_lodash2.compact(i(n3.measures, "measure")),
112308
- params: import_lodash2.compact(a(n3.params)),
112306
+ dimensions: import_lodash2.compact(import_lodash2.concat(a(n3.dimensions, "dimension"), c3(n3.measures))),
112307
+ measures: import_lodash2.compact(a(n3.measures, "measure")),
112308
+ params: import_lodash2.compact(s3(n3.params)),
112309
112309
  label: n3.label,
112310
112310
  description: n3.description,
112311
- tableName: c4
112311
+ tableName: r4
112312
112312
  });
112313
112313
  }
112314
112314
  default:
@@ -112345,8 +112345,27 @@ function relationshipConfigFromModeling(e10) {
112345
112345
  ...e10.join.where ? { where: e10.join.where } : {}
112346
112346
  };
112347
112347
  }
112348
+ function modelsFromCompactModeling(e10, t) {
112349
+ let { model_keys: n, model_definitions: r3 } = e10;
112350
+ if (!n || !r3)
112351
+ throw createError(ErrorCode.INVALID_EXPRESSION_0, undefined, `Dataset \`${e10.name}\` has no model_keys or model_definitions`);
112352
+ let i = /* @__PURE__ */ new Map, a = (n3, s3) => {
112353
+ let c3 = `${n3}:${s3}`, l = i.get(c3);
112354
+ if (l)
112355
+ return l;
112356
+ let u = r3[n3];
112357
+ if (!u)
112358
+ throw createError(ErrorCode.INVALID_EXPRESSION_0, undefined, `Dataset \`${e10.name}\` refers to unknown model \`${n3}\``);
112359
+ let f = "query" in u ? Object.values(u.models).map((e11) => a(e11, false)) : undefined, p3 = modelFromModeling({
112360
+ ...u,
112361
+ models: {}
112362
+ }, t, s3, f);
112363
+ return i.set(c3, p3), p3;
112364
+ };
112365
+ return n.map((e11) => a(e11, true));
112366
+ }
112348
112367
  function datasetFromModeling(e10) {
112349
- let t = dataSourceFromModeling(e10.data_source), n = e10.models.map((e11) => modelFromModeling(e11, t)), r3 = convertModelingMetricFields(e10.metrics), i = (e10.join_configs ?? []).map((e11) => relationshipConfigFromModeling(e11)), a = loadDatasetModuleFromModeling(e10.functions, e10.function_modules);
112368
+ let t = dataSourceFromModeling(e10.data_source), n = e10.model_definitions ? modelsFromCompactModeling(e10, t) : e10.models.map((e11) => modelFromModeling(e11, t, true)), r3 = convertModelingMetricFields(e10.metrics), i = (e10.join_configs ?? []).map((e11) => relationshipConfigFromModeling(e11)), a = loadDatasetModuleFromModeling(e10.functions, e10.function_modules);
112350
112369
  return createDataset({
112351
112370
  name: getFqn(e10.name),
112352
112371
  label: e10.label,
@@ -112421,10 +112440,12 @@ var DatasetStore = class {
112421
112440
  globalModule;
112422
112441
  models;
112423
112442
  constructor(e10, t, { allowAmbiguousPaths: n = false, shouldPrioritizeLengthForMixedPaths: r3 } = {}) {
112424
- this.dataset = e10, this.dataSource = t, this.models = new Map(e10.models.map((e11) => [e11.name, import_lodash2.cloneDeep({
112443
+ this.dataset = e10, this.dataSource = t;
112444
+ let i = import_lodash2.cloneDeep(e10.models.map((e11) => ({
112425
112445
  ...e11,
112426
112446
  dataSource: t
112427
- })])), this.globalModule = new AmlModule, this.globalModule.setName("::");
112447
+ })));
112448
+ this.models = new Map(i.map((e11) => [e11.name, e11])), this.globalModule = new AmlModule, this.globalModule.setName("::");
112428
112449
  for (let e11 of this.models.keys())
112429
112450
  this.addToGlobalModule(e11);
112430
112451
  if (this.modelGraph = new ModelGraph(this.dataset.models.map((e11) => e11.name), this.dataset.relationships, undefined, n, r3), !n && this.modelGraph.isCyclic())
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@holistics/cli-core",
3
3
  "type": "module",
4
- "version": "2.4.6",
4
+ "version": "2.4.7",
5
5
  "bin": {
6
6
  "holistics": "./bin/holistics.js"
7
7
  },