@gooddata/code-cli 0.52.0-alpha.1 → 0.52.0-alpha.3
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.
- package/NOTICE +918 -1182
- package/dist/index.js +382 -65
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37370,7 +37370,7 @@ function isPromise(value) {
|
|
|
37370
37370
|
//#endregion
|
|
37371
37371
|
//#region package.json
|
|
37372
37372
|
var name$1 = "@gooddata/code-cli";
|
|
37373
|
-
var version$1 = "0.52.0-alpha.
|
|
37373
|
+
var version$1 = "0.52.0-alpha.3";
|
|
37374
37374
|
//#endregion
|
|
37375
37375
|
//#region ../../../common/temp/aac/node_modules/.pnpm/vscode-languageserver@8.1.0/node_modules/vscode-languageserver/lib/common/utils/is.js
|
|
37376
37376
|
var require_is$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -89288,7 +89288,7 @@ function createMetadataCompletionItem(metadataObject, range) {
|
|
|
89288
89288
|
kind,
|
|
89289
89289
|
insertText,
|
|
89290
89290
|
filterText: `{ ${maqlType} / ${metadataObject.id} } ${metadataObject.title}`,
|
|
89291
|
-
sortText:
|
|
89291
|
+
sortText: metadataObject.id,
|
|
89292
89292
|
detail: `ID: '${identifier}', Description: '${metadataObject.description}'`,
|
|
89293
89293
|
textEdit: range ? import_main$1.TextEdit.replace(range, insertText) : void 0
|
|
89294
89294
|
};
|
|
@@ -89415,6 +89415,9 @@ var LdmObjects = class LdmObjects {
|
|
|
89415
89415
|
if (!object.tigerType) return;
|
|
89416
89416
|
return this.get(object.tigerType)?.find((tigerObject) => areObjRefsEqual(tigerObject.ref, object.ref));
|
|
89417
89417
|
}
|
|
89418
|
+
findById(type, id) {
|
|
89419
|
+
return this.get(type)?.find((object) => object.id === id);
|
|
89420
|
+
}
|
|
89418
89421
|
processAttributes(attributes) {
|
|
89419
89422
|
return attributes.flatMap((attribute) => ({
|
|
89420
89423
|
attributes: [LdmObjects.toTigerMetadataObject(attribute.attribute)],
|
|
@@ -93630,6 +93633,42 @@ function renderParameterDefaults(maql, ldmObjects) {
|
|
|
93630
93633
|
unresolved
|
|
93631
93634
|
};
|
|
93632
93635
|
}
|
|
93636
|
+
/**
|
|
93637
|
+
* Resolves every parameter the given MAQL templates and metrics depend on to its default value,
|
|
93638
|
+
* following `{metric/id}` references into metric expressions. Each parameter is reported once, in
|
|
93639
|
+
* order of first appearance.
|
|
93640
|
+
*/
|
|
93641
|
+
function resolveParameterValues(maqls, metricIds, ldmObjects) {
|
|
93642
|
+
const parameters = /* @__PURE__ */ new Map();
|
|
93643
|
+
const visitedMetrics = /* @__PURE__ */ new Set();
|
|
93644
|
+
const visitTemplate = (template) => {
|
|
93645
|
+
for (const object of findAllObjects(new MaqlMetric(template))) {
|
|
93646
|
+
if (object.tigerType === "parameter" && !parameters.has(object.id)) parameters.set(object.id, resolveParameter(object.id, ldmObjects));
|
|
93647
|
+
if (object.tigerType === "metric") visitMetric(object.id);
|
|
93648
|
+
}
|
|
93649
|
+
};
|
|
93650
|
+
const visitMetric = (metricId) => {
|
|
93651
|
+
if (visitedMetrics.has(metricId)) return;
|
|
93652
|
+
visitedMetrics.add(metricId);
|
|
93653
|
+
const expression = ldmObjects.findById("metric", metricId)?.expression;
|
|
93654
|
+
if (expression) visitTemplate(expression);
|
|
93655
|
+
};
|
|
93656
|
+
maqls.forEach(visitTemplate);
|
|
93657
|
+
metricIds.forEach(visitMetric);
|
|
93658
|
+
return [...parameters.values()];
|
|
93659
|
+
}
|
|
93660
|
+
function resolveParameter(id, ldmObjects) {
|
|
93661
|
+
const found = ldmObjects.findById("parameter", id);
|
|
93662
|
+
if (!found) return { id };
|
|
93663
|
+
return isRenderableDefinition(found.definition) ? {
|
|
93664
|
+
id,
|
|
93665
|
+
title: found.title,
|
|
93666
|
+
value: found.definition.defaultValue
|
|
93667
|
+
} : {
|
|
93668
|
+
id,
|
|
93669
|
+
title: found.title
|
|
93670
|
+
};
|
|
93671
|
+
}
|
|
93633
93672
|
//#endregion
|
|
93634
93673
|
//#region ../code-ast/esm/yaml/types.js
|
|
93635
93674
|
/**
|
|
@@ -106918,7 +106957,7 @@ function isMetricValueFilter$1(obj) {
|
|
|
106918
106957
|
}
|
|
106919
106958
|
return false;
|
|
106920
106959
|
}
|
|
106921
|
-
function isRankingFilter$
|
|
106960
|
+
function isRankingFilter$3(obj) {
|
|
106922
106961
|
return !!(typeof obj === "object" && obj && "using" in obj && "type" in obj && obj.type === "ranking_filter");
|
|
106923
106962
|
}
|
|
106924
106963
|
function isAttributeSort$2(obj) {
|
|
@@ -133253,7 +133292,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
133253
133292
|
/**
|
|
133254
133293
|
* @public
|
|
133255
133294
|
*/
|
|
133256
|
-
const isAfmObjectIdentifier = (value) => {
|
|
133295
|
+
const isAfmObjectIdentifier$1 = (value) => {
|
|
133257
133296
|
return !!(value?.identifier?.id && value?.identifier?.type);
|
|
133258
133297
|
};
|
|
133259
133298
|
//#endregion
|
|
@@ -134544,7 +134583,7 @@ function isAttribute$2(obj) {
|
|
|
134544
134583
|
*
|
|
134545
134584
|
* @public
|
|
134546
134585
|
*/
|
|
134547
|
-
function isMeasure(obj) {
|
|
134586
|
+
function isMeasure$1(obj) {
|
|
134548
134587
|
return !isEmpty(obj) && obj.measure?.definition !== void 0;
|
|
134549
134588
|
}
|
|
134550
134589
|
/**
|
|
@@ -134552,7 +134591,7 @@ function isMeasure(obj) {
|
|
|
134552
134591
|
*
|
|
134553
134592
|
* @public
|
|
134554
134593
|
*/
|
|
134555
|
-
function isMeasureDefinition(obj) {
|
|
134594
|
+
function isMeasureDefinition$1(obj) {
|
|
134556
134595
|
return !isEmpty(obj) && obj.measureDefinition !== void 0;
|
|
134557
134596
|
}
|
|
134558
134597
|
/**
|
|
@@ -134560,7 +134599,7 @@ function isMeasureDefinition(obj) {
|
|
|
134560
134599
|
*
|
|
134561
134600
|
* @public
|
|
134562
134601
|
*/
|
|
134563
|
-
function isInlineMeasureDefinition(obj) {
|
|
134602
|
+
function isInlineMeasureDefinition$1(obj) {
|
|
134564
134603
|
return !isEmpty(obj) && obj.inlineDefinition !== void 0;
|
|
134565
134604
|
}
|
|
134566
134605
|
/**
|
|
@@ -134708,7 +134747,7 @@ function isDateFilter$1(obj) {
|
|
|
134708
134747
|
*
|
|
134709
134748
|
* @public
|
|
134710
134749
|
*/
|
|
134711
|
-
function isMeasureValueFilter(obj) {
|
|
134750
|
+
function isMeasureValueFilter$1(obj) {
|
|
134712
134751
|
return !isEmpty(obj) && obj.measureValueFilter !== void 0;
|
|
134713
134752
|
}
|
|
134714
134753
|
/**
|
|
@@ -134716,7 +134755,7 @@ function isMeasureValueFilter(obj) {
|
|
|
134716
134755
|
*
|
|
134717
134756
|
* @public
|
|
134718
134757
|
*/
|
|
134719
|
-
function isRankingFilter$
|
|
134758
|
+
function isRankingFilter$2(obj) {
|
|
134720
134759
|
return !isEmpty(obj) && obj.rankingFilter !== void 0;
|
|
134721
134760
|
}
|
|
134722
134761
|
/**
|
|
@@ -134725,7 +134764,7 @@ function isRankingFilter$1(obj) {
|
|
|
134725
134764
|
* @public
|
|
134726
134765
|
*/
|
|
134727
134766
|
function isFilter(obj) {
|
|
134728
|
-
return isDateFilter$1(obj) || isAttributeFilter$1(obj) || isMeasureValueFilter(obj) || isRankingFilter$
|
|
134767
|
+
return isDateFilter$1(obj) || isAttributeFilter$1(obj) || isMeasureValueFilter$1(obj) || isRankingFilter$2(obj);
|
|
134729
134768
|
}
|
|
134730
134769
|
/**
|
|
134731
134770
|
* Type guard checking whether the provided object is a measure value filter's comparison condition.
|
|
@@ -134793,8 +134832,8 @@ function filterLocalIdentifier(filter) {
|
|
|
134793
134832
|
if (isRelativeDateFilter$1(filter)) return filter.relativeDateFilter.localIdentifier;
|
|
134794
134833
|
if (isArbitraryAttributeFilter(filter)) return filter.arbitraryAttributeFilter.localIdentifier;
|
|
134795
134834
|
if (isMatchAttributeFilter(filter)) return filter.matchAttributeFilter.localIdentifier;
|
|
134796
|
-
if (isMeasureValueFilter(filter)) return filter.measureValueFilter.localIdentifier;
|
|
134797
|
-
if (isRankingFilter$
|
|
134835
|
+
if (isMeasureValueFilter$1(filter)) return filter.measureValueFilter.localIdentifier;
|
|
134836
|
+
if (isRankingFilter$2(filter)) return filter.rankingFilter.localIdentifier;
|
|
134798
134837
|
}
|
|
134799
134838
|
//#endregion
|
|
134800
134839
|
//#region ../../../sdk/libs/sdk-model/esm/execution/buckets/index.js
|
|
@@ -135176,13 +135215,13 @@ function createFilterItemKeyName(item, type = "date", errorContext) {
|
|
|
135176
135215
|
if (isNegativeAttributeFilter$1(item)) return item.negativeAttributeFilter.localIdentifier ?? `${getIdentifier(item.negativeAttributeFilter.displayForm, true, updateErrorContext(errorContext, { path: ["negativeAttributeFilter", "displayForm"] }))}_filter`;
|
|
135177
135216
|
if (isArbitraryAttributeFilter(item)) return item.arbitraryAttributeFilter.localIdentifier ?? `${getIdentifier(item.arbitraryAttributeFilter.label, true, updateErrorContext(errorContext, { path: ["arbitraryAttributeFilter", "label"] }))}_text_filter`;
|
|
135178
135217
|
if (isMatchAttributeFilter(item)) return item.matchAttributeFilter.localIdentifier ?? `${getIdentifier(item.matchAttributeFilter.label, true, updateErrorContext(errorContext, { path: ["matchAttributeFilter", "label"] }))}_text_filter`;
|
|
135179
|
-
if (isMeasureValueFilter(item)) return `maf_${getIdentifier(item.measureValueFilter.measure, true, updateErrorContext(errorContext, { path: ["measureValueFilter", "measure"] }))}_filter`;
|
|
135180
|
-
if (isRankingFilter$
|
|
135218
|
+
if (isMeasureValueFilter$1(item)) return `maf_${getIdentifier(item.measureValueFilter.measure, true, updateErrorContext(errorContext, { path: ["measureValueFilter", "measure"] }))}_filter`;
|
|
135219
|
+
if (isRankingFilter$2(item)) return `${getIdentifier(item.rankingFilter.measure, true, updateErrorContext(errorContext, { path: ["rankingFilter", "measure"] }))}_filter`;
|
|
135181
135220
|
throw newError("core.itemNotSupported", [JSON.stringify(item)], errorContext);
|
|
135182
135221
|
}
|
|
135183
135222
|
/** @public */
|
|
135184
135223
|
function getIdentifier(obj, untype, errorContext) {
|
|
135185
|
-
const idRef = isAfmObjectIdentifier(obj) ? {
|
|
135224
|
+
const idRef = isAfmObjectIdentifier$1(obj) ? {
|
|
135186
135225
|
type: obj.identifier.type,
|
|
135187
135226
|
identifier: obj.identifier.id
|
|
135188
135227
|
} : obj;
|
|
@@ -135767,7 +135806,7 @@ function isMetricAllValueFilter(obj) {
|
|
|
135767
135806
|
const condition = obj.condition;
|
|
135768
135807
|
return condition === void 0 || condition === null;
|
|
135769
135808
|
}
|
|
135770
|
-
function isRankingFilter(obj) {
|
|
135809
|
+
function isRankingFilter$1(obj) {
|
|
135771
135810
|
return typeof obj === "object" && obj !== null && "using" in obj && "type" in obj && obj.type === "ranking_filter";
|
|
135772
135811
|
}
|
|
135773
135812
|
function isAttributeSort(obj) {
|
|
@@ -139306,23 +139345,27 @@ function mapLocationLabel(entities, field) {
|
|
|
139306
139345
|
const fieldsId = Object.keys(dataset.fields || {});
|
|
139307
139346
|
for (const fieldId of fieldsId) {
|
|
139308
139347
|
const field = dataset.fields?.[fieldId];
|
|
139309
|
-
if (isAttribute(field)
|
|
139348
|
+
if (isAttribute(field)) {
|
|
139310
139349
|
const labelIds = Object.keys(field.labels || {});
|
|
139311
|
-
|
|
139312
|
-
|
|
139313
|
-
|
|
139314
|
-
|
|
139315
|
-
|
|
139316
|
-
|
|
139317
|
-
|
|
139318
|
-
|
|
139319
|
-
|
|
139320
|
-
|
|
139321
|
-
|
|
139322
|
-
|
|
139323
|
-
|
|
139324
|
-
|
|
139325
|
-
|
|
139350
|
+
const isAttributeItself = fieldId === displayForm?.identifier.id;
|
|
139351
|
+
const isLabel = labelIds.includes(displayForm?.identifier.id || "");
|
|
139352
|
+
if (isAttributeItself || isLabel) {
|
|
139353
|
+
let latitude;
|
|
139354
|
+
let longitude;
|
|
139355
|
+
for (const labelId of labelIds) {
|
|
139356
|
+
const label = field.labels?.[labelId];
|
|
139357
|
+
if (label?.value_type === "GEO_LATITUDE") latitude = labelId;
|
|
139358
|
+
if (label?.value_type === "GEO_LONGITUDE") longitude = labelId;
|
|
139359
|
+
}
|
|
139360
|
+
if (latitude) return {
|
|
139361
|
+
displayForm: { identifier: {
|
|
139362
|
+
id: latitude,
|
|
139363
|
+
type: "label"
|
|
139364
|
+
} },
|
|
139365
|
+
latitude,
|
|
139366
|
+
longitude
|
|
139367
|
+
};
|
|
139368
|
+
}
|
|
139326
139369
|
}
|
|
139327
139370
|
}
|
|
139328
139371
|
}
|
|
@@ -140174,7 +140217,7 @@ function yamlFilterToDeclarative(entities, key, filter, assignFilterLocalId) {
|
|
|
140174
140217
|
if (isMetricRangeValueFilter(filter)) return yamlMetricRangeValueFilterToDeclarative(filter);
|
|
140175
140218
|
if (isMetricComparisonValueFilter(filter)) return yamlMetricComparisonValueFilterToDeclarative(filter);
|
|
140176
140219
|
if (isMetricAllValueFilter(filter)) return yamlMetricAllValueFilterToDeclarative(filter);
|
|
140177
|
-
if (isRankingFilter(filter)) return yamlRankingFilterToDeclarative(filter);
|
|
140220
|
+
if (isRankingFilter$1(filter)) return yamlRankingFilterToDeclarative(filter);
|
|
140178
140221
|
assertUnreachable(filter);
|
|
140179
140222
|
}
|
|
140180
140223
|
function mergeDeclarativeResults(...results) {
|
|
@@ -141006,7 +141049,7 @@ function sourceInsightFilterIdToDeclarative(filterId, sourceVisualizationFilters
|
|
|
141006
141049
|
type: "measureValueFilter",
|
|
141007
141050
|
measure: createIdentifier(filter.using, { forceMetric: true }) ?? createLocalIdentifier(filter.using)
|
|
141008
141051
|
};
|
|
141009
|
-
if (isRankingFilter(filter)) return {
|
|
141052
|
+
if (isRankingFilter$1(filter)) return {
|
|
141010
141053
|
type: "rankingFilter",
|
|
141011
141054
|
measure: createIdentifier(filter.using, { forceMetric: true }) ?? createLocalIdentifier(filter.using)
|
|
141012
141055
|
};
|
|
@@ -141776,12 +141819,12 @@ function declarativeFilterToYaml(entities, filter, claimKey, connectedAttributeF
|
|
|
141776
141819
|
yaml: declarativeMatchAttributeFilterToYaml(filter.matchAttributeFilter, updateErrorContext(errorContext, { path: ["matchAttributeFilter"] })),
|
|
141777
141820
|
filter
|
|
141778
141821
|
};
|
|
141779
|
-
if (isMeasureValueFilter(filter)) return {
|
|
141822
|
+
if (isMeasureValueFilter$1(filter)) return {
|
|
141780
141823
|
key,
|
|
141781
141824
|
yaml: declarativeMeasureValueFilterToYaml$1(filter.measureValueFilter, updateErrorContext(errorContext, { path: ["measureValueFilter"] })),
|
|
141782
141825
|
filter
|
|
141783
141826
|
};
|
|
141784
|
-
if (isRankingFilter$
|
|
141827
|
+
if (isRankingFilter$2(filter)) return {
|
|
141785
141828
|
key,
|
|
141786
141829
|
yaml: declarativeRankingFilterToYaml(filter.rankingFilter, updateErrorContext(errorContext, { path: ["rankingFilter"] })),
|
|
141787
141830
|
filter
|
|
@@ -142209,31 +142252,31 @@ function declarativeBucketsToYaml(entities, buckets, errorContext) {
|
|
|
142209
142252
|
attributesMap[item.attribute.localIdentifier] = def;
|
|
142210
142253
|
return;
|
|
142211
142254
|
}
|
|
142212
|
-
if (isMeasure(item) && isInlineMeasureDefinition(item.measure.definition)) {
|
|
142255
|
+
if (isMeasure$1(item) && isInlineMeasureDefinition$1(item.measure.definition)) {
|
|
142213
142256
|
const def = declarativeInlineMetricToYaml(item.measure, item.measure.definition);
|
|
142214
142257
|
addField(item.measure.localIdentifier, def, group, { format: item.measure.format });
|
|
142215
142258
|
attributesMap[item.measure.localIdentifier] = def;
|
|
142216
142259
|
return;
|
|
142217
142260
|
}
|
|
142218
|
-
if (isMeasure(item) && isMeasureDefinition(item.measure.definition)) {
|
|
142261
|
+
if (isMeasure$1(item) && isMeasureDefinition$1(item.measure.definition)) {
|
|
142219
142262
|
const def = declarativeNormalMetricToYaml(item.measure, item.measure.definition, postProcessors, updateErrorContext(bucketItemErrorContext, { path: ["measure"] }));
|
|
142220
142263
|
addField(item.measure.localIdentifier, def, group, { format: item.measure.format });
|
|
142221
142264
|
attributesMap[item.measure.localIdentifier] = def;
|
|
142222
142265
|
return;
|
|
142223
142266
|
}
|
|
142224
|
-
if (isMeasure(item) && isArithmeticMeasureDefinition(item.measure.definition)) {
|
|
142267
|
+
if (isMeasure$1(item) && isArithmeticMeasureDefinition(item.measure.definition)) {
|
|
142225
142268
|
const def = declarativeArithmeticMetricToYaml(item.measure, item.measure.definition);
|
|
142226
142269
|
addField(item.measure.localIdentifier, def, group, { format: item.measure.format });
|
|
142227
142270
|
attributesMap[item.measure.localIdentifier] = def;
|
|
142228
142271
|
return;
|
|
142229
142272
|
}
|
|
142230
|
-
if (isMeasure(item) && isPoPMeasureDefinition(item.measure.definition)) {
|
|
142273
|
+
if (isMeasure$1(item) && isPoPMeasureDefinition(item.measure.definition)) {
|
|
142231
142274
|
const def = declarativePoPMetricToYaml(item.measure, item.measure.definition, updateErrorContext(bucketItemErrorContext, { path: ["measure"] }));
|
|
142232
142275
|
addField(item.measure.localIdentifier, def, group, { format: item.measure.format });
|
|
142233
142276
|
attributesMap[item.measure.localIdentifier] = def;
|
|
142234
142277
|
return;
|
|
142235
142278
|
}
|
|
142236
|
-
if (isMeasure(item) && isPreviousPeriodMeasureDefinition(item.measure.definition)) {
|
|
142279
|
+
if (isMeasure$1(item) && isPreviousPeriodMeasureDefinition(item.measure.definition)) {
|
|
142237
142280
|
const def = declarativePreviousPeriodMetricToYaml(item.measure, item.measure.definition, updateErrorContext(bucketItemErrorContext, { path: ["measure"] }));
|
|
142238
142281
|
addField(item.measure.localIdentifier, def, group, { format: item.measure.format });
|
|
142239
142282
|
attributesMap[item.measure.localIdentifier] = def;
|
|
@@ -143661,7 +143704,7 @@ function buildFilters(entities, filters_by) {
|
|
|
143661
143704
|
if (filter.dimensionality && Array.isArray(filter.dimensionality) && filter.dimensionality.length > 0) comparisonMeasureValueFilter.comparisonMeasureValueFilter.dimensionality = filter.dimensionality.map((item) => createIdentifier(item) || createLocalIdentifier(item));
|
|
143662
143705
|
filters.push(comparisonMeasureValueFilter);
|
|
143663
143706
|
}
|
|
143664
|
-
if (isRankingFilter(filter)) filters.push({ rankingFilter: {
|
|
143707
|
+
if (isRankingFilter$1(filter)) filters.push({ rankingFilter: {
|
|
143665
143708
|
measures: [createIdentifier(filter.using) || createLocalIdentifier(filter.using)],
|
|
143666
143709
|
...filter.attribute ? { dimensionality: [createIdentifier(filter.attribute) || createLocalIdentifier(filter.attribute)] } : {},
|
|
143667
143710
|
operator: filter.top === void 0 ? "BOTTOM" : "TOP",
|
|
@@ -144080,7 +144123,7 @@ function resolveFiltersReferences(filters) {
|
|
|
144080
144123
|
});
|
|
144081
144124
|
return;
|
|
144082
144125
|
}
|
|
144083
|
-
if (isRankingFilter$
|
|
144126
|
+
if (isRankingFilter$3(filter)) {
|
|
144084
144127
|
const ref = parseReferenceObject$1(filter.using);
|
|
144085
144128
|
ref && all.push(ref);
|
|
144086
144129
|
if (filter.attribute) {
|
|
@@ -145422,7 +145465,7 @@ function resolveCurrentInsightWidgetQueryFilterLocalIds(references, widget) {
|
|
|
145422
145465
|
const filters = visualisation.query?.filter_by ?? {};
|
|
145423
145466
|
const results = [];
|
|
145424
145467
|
Object.entries(filters).forEach(([id, filter]) => {
|
|
145425
|
-
if (isAttributeFilter$2(filter) || isTextFilter$1(filter) || isAbsoluteDateFilter$2(filter) || isRelativeDateFilter$2(filter) || isMetricValueFilter$1(filter) || isRankingFilter$
|
|
145468
|
+
if (isAttributeFilter$2(filter) || isTextFilter$1(filter) || isAbsoluteDateFilter$2(filter) || isRelativeDateFilter$2(filter) || isMetricValueFilter$1(filter) || isRankingFilter$3(filter)) results.push({
|
|
145426
145469
|
id,
|
|
145427
145470
|
visualisation: visualisation.id,
|
|
145428
145471
|
title: `${visualisation.title ?? convertIdToTitle(visualisation.id)}: ${id}`
|
|
@@ -145488,7 +145531,7 @@ function resolveCurrentInsightWidgetQueryFieldFilterLocalIds(references, widget)
|
|
|
145488
145531
|
for (const field of Object.values(fields)) {
|
|
145489
145532
|
const fullField = getFullField(field);
|
|
145490
145533
|
if ("filter_by" in fullField && fullField.filter_by) {
|
|
145491
|
-
for (const [id, filter] of Object.entries(fullField.filter_by)) if (isAttributeFilter$2(filter) || isTextFilter$1(filter) || isAbsoluteDateFilter$2(filter) || isRelativeDateFilter$2(filter) || isMetricValueFilter$1(filter) || isRankingFilter$
|
|
145534
|
+
for (const [id, filter] of Object.entries(fullField.filter_by)) if (isAttributeFilter$2(filter) || isTextFilter$1(filter) || isAbsoluteDateFilter$2(filter) || isRelativeDateFilter$2(filter) || isMetricValueFilter$1(filter) || isRankingFilter$3(filter)) results.push({
|
|
145492
145535
|
id,
|
|
145493
145536
|
visualisation: visualisation.id,
|
|
145494
145537
|
title: `${visualisation.title ?? convertIdToTitle(visualisation.id)}: ${id}`
|
|
@@ -157095,6 +157138,96 @@ function movePosition$2(fullDocument, point, position) {
|
|
|
157095
157138
|
};
|
|
157096
157139
|
}
|
|
157097
157140
|
//#endregion
|
|
157141
|
+
//#region ../../../sdk/libs/sdk-model/src/execution/measure/index.ts
|
|
157142
|
+
/**
|
|
157143
|
+
* Implementation of measure predicate which always returns true.
|
|
157144
|
+
*
|
|
157145
|
+
* @public
|
|
157146
|
+
*/
|
|
157147
|
+
const anyMeasure = (_) => true;
|
|
157148
|
+
/**
|
|
157149
|
+
* Type guard for checking whether object is any type of measure.
|
|
157150
|
+
*
|
|
157151
|
+
* @public
|
|
157152
|
+
*/
|
|
157153
|
+
function isMeasure(obj) {
|
|
157154
|
+
return !isEmpty(obj) && obj.measure?.definition !== void 0;
|
|
157155
|
+
}
|
|
157156
|
+
/**
|
|
157157
|
+
* Type guard for checking whether object is a measure definition.
|
|
157158
|
+
*
|
|
157159
|
+
* @public
|
|
157160
|
+
*/
|
|
157161
|
+
function isMeasureDefinition(obj) {
|
|
157162
|
+
return !isEmpty(obj) && obj.measureDefinition !== void 0;
|
|
157163
|
+
}
|
|
157164
|
+
/**
|
|
157165
|
+
* Type guard for checking whether object is a inline measure definition.
|
|
157166
|
+
*
|
|
157167
|
+
* @public
|
|
157168
|
+
*/
|
|
157169
|
+
function isInlineMeasureDefinition(obj) {
|
|
157170
|
+
return !isEmpty(obj) && obj.inlineDefinition !== void 0;
|
|
157171
|
+
}
|
|
157172
|
+
//#endregion
|
|
157173
|
+
//#region ../../../sdk/libs/sdk-model/src/execution/filter/index.ts
|
|
157174
|
+
/**
|
|
157175
|
+
* Type guard checking whether the provided object is a measure value filter.
|
|
157176
|
+
*
|
|
157177
|
+
* @public
|
|
157178
|
+
*/
|
|
157179
|
+
function isMeasureValueFilter(obj) {
|
|
157180
|
+
return !isEmpty(obj) && obj.measureValueFilter !== void 0;
|
|
157181
|
+
}
|
|
157182
|
+
/**
|
|
157183
|
+
* Type guard checking whether the provided object is a ranking filter.
|
|
157184
|
+
*
|
|
157185
|
+
* @public
|
|
157186
|
+
*/
|
|
157187
|
+
function isRankingFilter(obj) {
|
|
157188
|
+
return !isEmpty(obj) && obj.rankingFilter !== void 0;
|
|
157189
|
+
}
|
|
157190
|
+
//#endregion
|
|
157191
|
+
//#region ../../../sdk/libs/sdk-model/src/execution/buckets/index.ts
|
|
157192
|
+
/**
|
|
157193
|
+
* Gets all measures matching the provided predicate from the bucket.
|
|
157194
|
+
*
|
|
157195
|
+
* @remarks
|
|
157196
|
+
* If no predicate is provided, then the function defaults to anyMeasure predicate - meaning all measures from
|
|
157197
|
+
* the bucket will be returned.
|
|
157198
|
+
*
|
|
157199
|
+
* @param bucket - bucket to work with
|
|
157200
|
+
* @param predicate - measure predicate; {@link anyMeasure} predicate is default
|
|
157201
|
+
* @returns empty list if none match
|
|
157202
|
+
* @public
|
|
157203
|
+
*/
|
|
157204
|
+
function bucketMeasures(bucket, predicate = anyMeasure) {
|
|
157205
|
+
(0, import_invariant$1.invariant)(bucket, "bucket must be specified");
|
|
157206
|
+
const compositeGuard = (obj) => {
|
|
157207
|
+
return isMeasure(obj) && predicate(obj);
|
|
157208
|
+
};
|
|
157209
|
+
return bucket.items.filter(compositeGuard);
|
|
157210
|
+
}
|
|
157211
|
+
//#endregion
|
|
157212
|
+
//#region ../../../sdk/libs/sdk-model/src/execution/buckets/bucketArray.ts
|
|
157213
|
+
/**
|
|
157214
|
+
* Gets all measures matching the provided predicate from a list of buckets.
|
|
157215
|
+
*
|
|
157216
|
+
* @remarks
|
|
157217
|
+
* If no predicate is provided, then the function defaults to {@link anyMeasure} predicate - meaning all
|
|
157218
|
+
* measures will be returned.
|
|
157219
|
+
*
|
|
157220
|
+
* @param buckets - list of buckets to get measures from
|
|
157221
|
+
* @param predicate - measure predicate; {@link anyMeasure} is default
|
|
157222
|
+
* @returns empty list if none match
|
|
157223
|
+
* @public
|
|
157224
|
+
*/
|
|
157225
|
+
function bucketsMeasures(buckets, predicate = anyMeasure) {
|
|
157226
|
+
(0, import_invariant$1.invariant)(buckets, "buckets must be specified");
|
|
157227
|
+
if (!buckets.length) return [];
|
|
157228
|
+
return buckets.flatMap((b) => bucketMeasures(b, predicate));
|
|
157229
|
+
}
|
|
157230
|
+
//#endregion
|
|
157098
157231
|
//#region ../../../sdk/libs/sdk-model/src/dashboard/dashboard.ts
|
|
157099
157232
|
/**
|
|
157100
157233
|
* Value of {@link IDashboardTimezoneConfig.timezoneId} representing that the effective timezone
|
|
@@ -160532,7 +160665,7 @@ function createWidgetVisualisationQueryFieldFilterReference(references, value) {
|
|
|
160532
160665
|
function queryFieldFilterLocalIdDefinition(references, parents, nodeItem, value) {
|
|
160533
160666
|
if (isVisualisation(references.self)) {
|
|
160534
160667
|
const def = getNodeValue(getPropertyValueNode(getParentNode(parents[0], nodeItem))) ?? {};
|
|
160535
|
-
if (isAttributeFilter$2(def) || isAbsoluteDateFilter$2(def) || isRelativeDateFilter$2(def) || isMetricValueFilter$1(def) || isRankingFilter$
|
|
160668
|
+
if (isAttributeFilter$2(def) || isAbsoluteDateFilter$2(def) || isRelativeDateFilter$2(def) || isMetricValueFilter$1(def) || isRankingFilter$3(def)) return [createPartialLocalReferenceObjectInfo(references.self.id, [
|
|
160536
160669
|
"query",
|
|
160537
160670
|
"field",
|
|
160538
160671
|
"filter_by"
|
|
@@ -160543,7 +160676,7 @@ function queryFieldFilterLocalIdDefinition(references, parents, nodeItem, value)
|
|
|
160543
160676
|
function queryFilterLocalIdDefinition(references, parents, nodeItem, value) {
|
|
160544
160677
|
if (isVisualisation(references.self)) {
|
|
160545
160678
|
const def = getNodeValue(getPropertyValueNode(getParentNode(parents[0], nodeItem))) ?? {};
|
|
160546
|
-
if (isAttributeFilter$2(def) || isAbsoluteDateFilter$2(def) || isRelativeDateFilter$2(def) || isMetricValueFilter$1(def) || isRankingFilter$
|
|
160679
|
+
if (isAttributeFilter$2(def) || isAbsoluteDateFilter$2(def) || isRelativeDateFilter$2(def) || isMetricValueFilter$1(def) || isRankingFilter$3(def)) return [createPartialLocalReferenceObjectInfo(references.self.id, ["query", "filter_by"], value, value, true)];
|
|
160547
160680
|
}
|
|
160548
160681
|
return [];
|
|
160549
160682
|
}
|
|
@@ -161277,7 +161410,7 @@ async function open(state, emitter, file) {
|
|
|
161277
161410
|
//#endregion
|
|
161278
161411
|
//#region ../code/package.json
|
|
161279
161412
|
var name = "@gooddata/code";
|
|
161280
|
-
var version = "0.52.0-alpha.
|
|
161413
|
+
var version = "0.52.0-alpha.3";
|
|
161281
161414
|
//#endregion
|
|
161282
161415
|
//#region ../../../sdk/libs/api-client-tiger/src/axios.ts
|
|
161283
161416
|
/**
|
|
@@ -161299,7 +161432,7 @@ const _CONFIG = {
|
|
|
161299
161432
|
common: {
|
|
161300
161433
|
"X-Requested-With": "XMLHttpRequest",
|
|
161301
161434
|
"X-GDC-JS-PACKAGE": "@gooddata/api-client-tiger",
|
|
161302
|
-
"X-GDC-JS-PACKAGE-VERSION": "11.56.0-alpha.
|
|
161435
|
+
"X-GDC-JS-PACKAGE-VERSION": "11.56.0-alpha.3"
|
|
161303
161436
|
},
|
|
161304
161437
|
post: { "Content-Type": "application/json;charset=utf8" },
|
|
161305
161438
|
put: { "Content-Type": "application/json;charset=utf8" }
|
|
@@ -194176,6 +194309,70 @@ async function SmartFunctionsAiAxiosParamCreator_AiSearch(workspaceId, aiSearchR
|
|
|
194176
194309
|
};
|
|
194177
194310
|
}
|
|
194178
194311
|
/**
|
|
194312
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194313
|
+
* @summary Get active LLM configuration for this workspace
|
|
194314
|
+
* @param {string} workspaceId
|
|
194315
|
+
* @param {*} [options] Override http request option.
|
|
194316
|
+
* @param {Configuration} [configuration] Optional configuration.
|
|
194317
|
+
* @throws {RequiredError}
|
|
194318
|
+
*/
|
|
194319
|
+
async function SmartFunctionsAiAxiosParamCreator_ResolveLlmProviders(workspaceId, options = {}, configuration) {
|
|
194320
|
+
assertParamExists$2("resolveLlmProviders", "workspaceId", workspaceId);
|
|
194321
|
+
const localVarPath = `/api/v1/actions/workspaces/{workspace_id}/ai/resolveLlmProviders`.replace(`{workspace_id}`, encodeURIComponent(String(workspaceId)));
|
|
194322
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$2);
|
|
194323
|
+
let baseOptions;
|
|
194324
|
+
if (configuration) baseOptions = configuration.baseOptions;
|
|
194325
|
+
const localVarRequestOptions = {
|
|
194326
|
+
method: "GET",
|
|
194327
|
+
...baseOptions,
|
|
194328
|
+
...options
|
|
194329
|
+
};
|
|
194330
|
+
const localVarHeaderParameter = {};
|
|
194331
|
+
setSearchParams$2(localVarUrlObj, {});
|
|
194332
|
+
const headersFromBaseOptions = baseOptions?.headers ? baseOptions.headers : {};
|
|
194333
|
+
localVarRequestOptions.headers = {
|
|
194334
|
+
...localVarHeaderParameter,
|
|
194335
|
+
...headersFromBaseOptions,
|
|
194336
|
+
...options.headers
|
|
194337
|
+
};
|
|
194338
|
+
return {
|
|
194339
|
+
url: toPathString$2(localVarUrlObj),
|
|
194340
|
+
options: localVarRequestOptions
|
|
194341
|
+
};
|
|
194342
|
+
}
|
|
194343
|
+
/**
|
|
194344
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194345
|
+
* @summary Get active LLM configuration for this workspace
|
|
194346
|
+
* @param {string} workspaceId
|
|
194347
|
+
* @param {*} [options] Override http request option.
|
|
194348
|
+
* @param {Configuration} [configuration] Optional configuration.
|
|
194349
|
+
* @throws {RequiredError}
|
|
194350
|
+
*/
|
|
194351
|
+
async function SmartFunctionsAiAxiosParamCreator_ResolveLlmProvidersV2(workspaceId, options = {}, configuration) {
|
|
194352
|
+
assertParamExists$2("resolveLlmProvidersV2", "workspaceId", workspaceId);
|
|
194353
|
+
const localVarPath = `/api/v1/ai/workspaces/{workspace_id}/resolveLlmProviders`.replace(`{workspace_id}`, encodeURIComponent(String(workspaceId)));
|
|
194354
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$2);
|
|
194355
|
+
let baseOptions;
|
|
194356
|
+
if (configuration) baseOptions = configuration.baseOptions;
|
|
194357
|
+
const localVarRequestOptions = {
|
|
194358
|
+
method: "GET",
|
|
194359
|
+
...baseOptions,
|
|
194360
|
+
...options
|
|
194361
|
+
};
|
|
194362
|
+
const localVarHeaderParameter = {};
|
|
194363
|
+
setSearchParams$2(localVarUrlObj, {});
|
|
194364
|
+
const headersFromBaseOptions = baseOptions?.headers ? baseOptions.headers : {};
|
|
194365
|
+
localVarRequestOptions.headers = {
|
|
194366
|
+
...localVarHeaderParameter,
|
|
194367
|
+
...headersFromBaseOptions,
|
|
194368
|
+
...options.headers
|
|
194369
|
+
};
|
|
194370
|
+
return {
|
|
194371
|
+
url: toPathString$2(localVarUrlObj),
|
|
194372
|
+
options: localVarRequestOptions
|
|
194373
|
+
};
|
|
194374
|
+
}
|
|
194375
|
+
/**
|
|
194179
194376
|
* (BETA) Uses similarity (e.g. cosine distance) search to find top X most similar metadata objects.
|
|
194180
194377
|
* @summary (BETA) Semantic Search in Metadata
|
|
194181
194378
|
* @param {string} workspaceId
|
|
@@ -194227,6 +194424,32 @@ async function SmartFunctionsAi_AiSearch(axios, basePath, requestParameters, opt
|
|
|
194227
194424
|
return createRequestFunction$2(await SmartFunctionsAiAxiosParamCreator_AiSearch(requestParameters.workspaceId, requestParameters.aiSearchRequest, options || {}, configuration), axios$1, BASE_PATH$2, configuration)(axios, basePath);
|
|
194228
194425
|
}
|
|
194229
194426
|
/**
|
|
194427
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194428
|
+
* @summary Get active LLM configuration for this workspace
|
|
194429
|
+
* @param {AxiosInstance} axios Axios instance.
|
|
194430
|
+
* @param {string} basePath Base path.
|
|
194431
|
+
* @param {SmartFunctionsAiResolveLlmProvidersRequest} requestParameters Request parameters.
|
|
194432
|
+
* @param {*} [options] Override http request option.
|
|
194433
|
+
* @param {Configuration} [configuration] Optional configuration.
|
|
194434
|
+
* @throws {RequiredError}
|
|
194435
|
+
*/
|
|
194436
|
+
async function SmartFunctionsAi_ResolveLlmProviders(axios, basePath, requestParameters, options, configuration) {
|
|
194437
|
+
return createRequestFunction$2(await SmartFunctionsAiAxiosParamCreator_ResolveLlmProviders(requestParameters.workspaceId, options || {}, configuration), axios$1, BASE_PATH$2, configuration)(axios, basePath);
|
|
194438
|
+
}
|
|
194439
|
+
/**
|
|
194440
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194441
|
+
* @summary Get active LLM configuration for this workspace
|
|
194442
|
+
* @param {AxiosInstance} axios Axios instance.
|
|
194443
|
+
* @param {string} basePath Base path.
|
|
194444
|
+
* @param {SmartFunctionsAiResolveLlmProvidersV2Request} requestParameters Request parameters.
|
|
194445
|
+
* @param {*} [options] Override http request option.
|
|
194446
|
+
* @param {Configuration} [configuration] Optional configuration.
|
|
194447
|
+
* @throws {RequiredError}
|
|
194448
|
+
*/
|
|
194449
|
+
async function SmartFunctionsAi_ResolveLlmProvidersV2(axios, basePath, requestParameters, options, configuration) {
|
|
194450
|
+
return createRequestFunction$2(await SmartFunctionsAiAxiosParamCreator_ResolveLlmProvidersV2(requestParameters.workspaceId, options || {}, configuration), axios$1, BASE_PATH$2, configuration)(axios, basePath);
|
|
194451
|
+
}
|
|
194452
|
+
/**
|
|
194230
194453
|
* (BETA) Uses similarity (e.g. cosine distance) search to find top X most similar metadata objects.
|
|
194231
194454
|
* @summary (BETA) Semantic Search in Metadata
|
|
194232
194455
|
* @param {AxiosInstance} axios Axios instance.
|
|
@@ -194259,6 +194482,29 @@ var SmartFunctionsAi = class extends BaseAPI$2 {
|
|
|
194259
194482
|
return SmartFunctionsAi_AiSearch(this.axios, this.basePath, requestParameters, options, this.configuration);
|
|
194260
194483
|
}
|
|
194261
194484
|
/**
|
|
194485
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194486
|
+
* @summary Get active LLM configuration for this workspace
|
|
194487
|
+
* @param {SmartFunctionsAiResolveLlmProvidersRequest} requestParameters Request parameters.
|
|
194488
|
+
* @param {*} [options] Override http request option.
|
|
194489
|
+
* @deprecated
|
|
194490
|
+
* @throws {RequiredError}
|
|
194491
|
+
* @memberof SmartFunctionsAi
|
|
194492
|
+
*/
|
|
194493
|
+
resolveLlmProviders(requestParameters, options) {
|
|
194494
|
+
return SmartFunctionsAi_ResolveLlmProviders(this.axios, this.basePath, requestParameters, options, this.configuration);
|
|
194495
|
+
}
|
|
194496
|
+
/**
|
|
194497
|
+
* Resolves the active LLM provider configuration for the given workspace.
|
|
194498
|
+
* @summary Get active LLM configuration for this workspace
|
|
194499
|
+
* @param {SmartFunctionsAiResolveLlmProvidersV2Request} requestParameters Request parameters.
|
|
194500
|
+
* @param {*} [options] Override http request option.
|
|
194501
|
+
* @throws {RequiredError}
|
|
194502
|
+
* @memberof SmartFunctionsAi
|
|
194503
|
+
*/
|
|
194504
|
+
resolveLlmProvidersV2(requestParameters, options) {
|
|
194505
|
+
return SmartFunctionsAi_ResolveLlmProvidersV2(this.axios, this.basePath, requestParameters, options, this.configuration);
|
|
194506
|
+
}
|
|
194507
|
+
/**
|
|
194262
194508
|
* (BETA) Uses similarity (e.g. cosine distance) search to find top X most similar metadata objects.
|
|
194263
194509
|
* @summary (BETA) Semantic Search in Metadata
|
|
194264
194510
|
* @param {SmartFunctionsAiSemanticSearchRequest} requestParameters Request parameters.
|
|
@@ -195783,6 +196029,12 @@ function isAttributeHeader(header) {
|
|
|
195783
196029
|
/**
|
|
195784
196030
|
* @public
|
|
195785
196031
|
*/
|
|
196032
|
+
const isAfmObjectIdentifier = (value) => {
|
|
196033
|
+
return !!(value?.identifier?.id && value?.identifier?.type);
|
|
196034
|
+
};
|
|
196035
|
+
/**
|
|
196036
|
+
* @public
|
|
196037
|
+
*/
|
|
195786
196038
|
function isResultAttributeHeader(header) {
|
|
195787
196039
|
return header.attributeHeader !== void 0;
|
|
195788
196040
|
}
|
|
@@ -202046,6 +202298,51 @@ async function toExecution(store, profile, query) {
|
|
|
202046
202298
|
return buildAfmExecution(entities, query);
|
|
202047
202299
|
}
|
|
202048
202300
|
//#endregion
|
|
202301
|
+
//#region ../code/esm/shared/maql/querySources.js
|
|
202302
|
+
/**
|
|
202303
|
+
* Collects the metrics and inline MAQL a visualisation executes. Walks the declarative form the
|
|
202304
|
+
* deploy produces, so exactly what deploys counts: surplus bucket items a chart type drops, fields
|
|
202305
|
+
* no bucket references and no-op filters contribute nothing. A visualisation that cannot be
|
|
202306
|
+
* converted executes nothing and yields no sources.
|
|
202307
|
+
*/
|
|
202308
|
+
function collectVisualisationMaqlSources(visualisation) {
|
|
202309
|
+
const sources = {
|
|
202310
|
+
maqls: [],
|
|
202311
|
+
metricIds: []
|
|
202312
|
+
};
|
|
202313
|
+
let content;
|
|
202314
|
+
try {
|
|
202315
|
+
content = yamlVisualisationToDeclarative([], visualisation).content;
|
|
202316
|
+
} catch {
|
|
202317
|
+
return sources;
|
|
202318
|
+
}
|
|
202319
|
+
const scopes = [content, ...content.layers ?? []];
|
|
202320
|
+
for (const scope of scopes) {
|
|
202321
|
+
for (const measure of bucketsMeasures(scope.buckets ?? [])) collectMeasure(sources, measure);
|
|
202322
|
+
for (const filter of scope.filters ?? []) collectFilter(sources, filter);
|
|
202323
|
+
}
|
|
202324
|
+
return sources;
|
|
202325
|
+
}
|
|
202326
|
+
function collectMeasure(sources, measure) {
|
|
202327
|
+
const definition = measure.measure.definition;
|
|
202328
|
+
if (isMeasureDefinition(definition)) pushMetricRef(sources, definition.measureDefinition.item);
|
|
202329
|
+
if (isInlineMeasureDefinition(definition)) sources.maqls.push(definition.inlineDefinition.maql);
|
|
202330
|
+
}
|
|
202331
|
+
function collectFilter(sources, filter) {
|
|
202332
|
+
if (isMeasureValueFilter(filter)) {
|
|
202333
|
+
const { measure, condition, conditions } = filter.measureValueFilter;
|
|
202334
|
+
if (condition || (conditions?.length ?? 0) > 0) pushMetricRef(sources, measure);
|
|
202335
|
+
}
|
|
202336
|
+
if (isRankingFilter(filter)) pushMetricRef(sources, filter.rankingFilter.measure);
|
|
202337
|
+
}
|
|
202338
|
+
/**
|
|
202339
|
+
* The converter emits AFM-shaped identifiers; a local-identifier reference points at a bucket item
|
|
202340
|
+
* that is collected on its own.
|
|
202341
|
+
*/
|
|
202342
|
+
function pushMetricRef(sources, ref) {
|
|
202343
|
+
if (isAfmObjectIdentifier(ref) && ref.identifier.type === "metric" && ref.identifier.id.length > 0) sources.metricIds.push(ref.identifier.id);
|
|
202344
|
+
}
|
|
202345
|
+
//#endregion
|
|
202049
202346
|
//#region ../code/esm/actions/services/preview.js
|
|
202050
202347
|
async function datasetPreview(state, emitter, file, datasetId) {
|
|
202051
202348
|
await awaitWaiters(state, ["initialize"]);
|
|
@@ -202109,7 +202406,7 @@ async function metricPreview(state, emitter, file, metricId, columns) {
|
|
|
202109
202406
|
},
|
|
202110
202407
|
diagnostics: [offlineDiagnostic()]
|
|
202111
202408
|
}, () => server.loadMetricPreview(profile, metric, columns)),
|
|
202112
|
-
rendered: renderMetricMaql(state,
|
|
202409
|
+
rendered: guardPreviewExtra(emitter, () => renderMetricMaql(state, file, metric))
|
|
202113
202410
|
};
|
|
202114
202411
|
}
|
|
202115
202412
|
return null;
|
|
@@ -202156,16 +202453,19 @@ async function visualisationPreview(state, emitter, file, visualisationId) {
|
|
|
202156
202453
|
const visualisation = resolveObject(file, visualisationId);
|
|
202157
202454
|
if (visualisation && manifestContent && server) {
|
|
202158
202455
|
const { profile } = resolveUsingProfile(state, manifestContent);
|
|
202159
|
-
if (profile) return
|
|
202160
|
-
|
|
202161
|
-
|
|
202162
|
-
|
|
202163
|
-
|
|
202164
|
-
|
|
202165
|
-
|
|
202166
|
-
|
|
202167
|
-
|
|
202168
|
-
|
|
202456
|
+
if (profile) return {
|
|
202457
|
+
...await runServiceMethod(state, {
|
|
202458
|
+
data: {
|
|
202459
|
+
visualisationId: visualisation.id,
|
|
202460
|
+
host: "",
|
|
202461
|
+
token: "",
|
|
202462
|
+
workspaceId: "",
|
|
202463
|
+
settings: { mapboxToken: "" }
|
|
202464
|
+
},
|
|
202465
|
+
diagnostics: [offlineDiagnostic()]
|
|
202466
|
+
}, () => server.loadVisualisationPreview(state, profile, visualisation)),
|
|
202467
|
+
parameters: guardPreviewExtra(emitter, () => resolveVisualisationParameters(state, file, visualisation))
|
|
202468
|
+
};
|
|
202169
202469
|
}
|
|
202170
202470
|
return null;
|
|
202171
202471
|
} catch (err) {
|
|
@@ -202218,18 +202518,35 @@ async function schemaPreview(state, emitter, file, datasetId) {
|
|
|
202218
202518
|
}
|
|
202219
202519
|
}
|
|
202220
202520
|
/**
|
|
202221
|
-
*
|
|
202222
|
-
*
|
|
202521
|
+
* Runs a computation that enriches an already loaded preview. On failure the error is reported and
|
|
202522
|
+
* the preview is kept rather than lost.
|
|
202223
202523
|
*/
|
|
202224
|
-
function
|
|
202225
|
-
if (!metric.maql) return;
|
|
202524
|
+
function guardPreviewExtra(emitter, compute) {
|
|
202226
202525
|
try {
|
|
202227
|
-
return
|
|
202526
|
+
return compute();
|
|
202228
202527
|
} catch (err) {
|
|
202229
202528
|
emitter.emit("core.error", err);
|
|
202230
202529
|
return;
|
|
202231
202530
|
}
|
|
202232
202531
|
}
|
|
202532
|
+
/**
|
|
202533
|
+
* Resolves the parameters the visualisation's query depends on to their defaults. Returns undefined
|
|
202534
|
+
* when no parameter is involved.
|
|
202535
|
+
*/
|
|
202536
|
+
function resolveVisualisationParameters(state, file, visualisation) {
|
|
202537
|
+
const { maqls, metricIds } = collectVisualisationMaqlSources(visualisation);
|
|
202538
|
+
if (maqls.length === 0 && metricIds.length === 0) return;
|
|
202539
|
+
const parameters = resolveParameterValues(maqls, metricIds, resolvedReferences(state, file).objects);
|
|
202540
|
+
return parameters.length > 0 ? parameters : void 0;
|
|
202541
|
+
}
|
|
202542
|
+
/**
|
|
202543
|
+
* Renders the metric's MAQL with its parameters' defaults substituted. Returns undefined when the
|
|
202544
|
+
* template names no parameters, so the preview only shows a rendered form when it differs.
|
|
202545
|
+
*/
|
|
202546
|
+
function renderMetricMaql(state, file, metric) {
|
|
202547
|
+
if (!metric.maql) return;
|
|
202548
|
+
return renderParameterDefaults(metric.maql, resolvedReferences(state, file).objects);
|
|
202549
|
+
}
|
|
202233
202550
|
//#endregion
|
|
202234
202551
|
//#region ../code/esm/store/textDocument/load.js
|
|
202235
202552
|
function loadTextDocument(file) {
|