@gooddata/code-cli 0.46.0-alpha.2 → 0.46.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.
Files changed (2) hide show
  1. package/dist/index.js +154 -69
  2. 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.46.0-alpha.2";
37373
+ var version$1 = "0.46.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) => {
@@ -93179,7 +93179,7 @@ function visitParents(node, visitor) {
93179
93179
  }
93180
93180
  function visitParentsInternal(parents, node, visitor) {
93181
93181
  const parent = node;
93182
- if (parent.children && parent.children.length) {
93182
+ if (parent.children?.length) {
93183
93183
  const subParents = [...parents, parent];
93184
93184
  const l = parent.children.length;
93185
93185
  for (let i = 0; i < l; i++) {
@@ -93200,7 +93200,7 @@ function visitSimple(node, visitor) {
93200
93200
  }
93201
93201
  function visitSimpleInternal(node, visitor) {
93202
93202
  const parent = node;
93203
- if (parent.children && parent.children.length) {
93203
+ if (parent.children?.length) {
93204
93204
  const l = parent.children.length;
93205
93205
  for (let i = 0; i < l; i++) {
93206
93206
  const child = parent.children[i];
@@ -93217,7 +93217,7 @@ function visitSimpleInternalChild(parent, node, visitor) {
93217
93217
  }
93218
93218
  function visitChildren(node, visitor) {
93219
93219
  const parent = node;
93220
- if (parent.children && parent.children.length) {
93220
+ if (parent.children?.length) {
93221
93221
  const l = parent.children.length;
93222
93222
  for (let i = 0; i < l; i++) {
93223
93223
  const child = parent.children[i];
@@ -103433,7 +103433,7 @@ const resolveVariable = (varName, profile, env, secret = false, optional = false
103433
103433
  if (secret && value && !envVarNameRx.test(value)) throw new ManifestError(texts$1.err__secret_plain_text(varName));
103434
103434
  if (value && envVarNameRx.test(value)) {
103435
103435
  const envVarName = value.replace(/^\$/, "");
103436
- if (!env || !env[envVarName]) throw new ManifestError(texts$1.err__no_env_variable(varName, value));
103436
+ if (!env?.[envVarName]) throw new ManifestError(texts$1.err__no_env_variable(varName, value));
103437
103437
  value = env[envVarName];
103438
103438
  }
103439
103439
  if (!value && !optional) throw new ManifestError(texts$1.err__no_value(varName));
@@ -106440,6 +106440,32 @@ function collectFieldLevelFilters(visualisation) {
106440
106440
  }
106441
106441
  //#endregion
106442
106442
  //#region ../../../sdk/libs/sdk-code-convertors/src/utils/granularityUtils.ts
106443
+ const CF_YAML_TO_GDC_GRANULARITY = {
106444
+ minute: "GDC.time.minute",
106445
+ hour: "GDC.time.hour",
106446
+ day: "GDC.time.date",
106447
+ week: "GDC.time.week_us",
106448
+ month: "GDC.time.month",
106449
+ quarter: "GDC.time.quarter",
106450
+ year: "GDC.time.year"
106451
+ };
106452
+ const isCfYamlGranularityName = (name) => Object.hasOwn(CF_YAML_TO_GDC_GRANULARITY, name);
106453
+ const CF_GDC_TO_YAML_GRANULARITY = Object.fromEntries(Object.entries(CF_YAML_TO_GDC_GRANULARITY).map(([yaml, gdc]) => [gdc, yaml]));
106454
+ /**
106455
+ * YAML name -\> GDC constant for a conditional-formatting relative-period granularity. Unknown
106456
+ * names pass through unchanged on purpose: they round-trip losslessly and the consuming engine
106457
+ * treats them as unresolvable (the condition never matches) instead of the conversion guessing.
106458
+ */
106459
+ function cfGranularityFromYaml(name) {
106460
+ return isCfYamlGranularityName(name) ? CF_YAML_TO_GDC_GRANULARITY[name] : name;
106461
+ }
106462
+ /**
106463
+ * GDC constant -\> YAML name for a conditional-formatting relative-period granularity; unknown
106464
+ * values pass through (see {@link cfGranularityFromYaml}).
106465
+ */
106466
+ function cfGranularityToYaml(granularity) {
106467
+ return CF_GDC_TO_YAML_GRANULARITY[granularity] ?? granularity;
106468
+ }
106443
106469
  function convertGranularity$1(gran) {
106444
106470
  const g = gran;
106445
106471
  switch (g) {
@@ -106471,6 +106497,7 @@ function convertGranularity$1(gran) {
106471
106497
  default: assertUnreachable(g);
106472
106498
  }
106473
106499
  }
106500
+ /** @public */
106474
106501
  function parseGranularity(gran) {
106475
106502
  switch (gran) {
106476
106503
  case "GDC.time.minute": return "MINUTE";
@@ -138063,6 +138090,15 @@ function loadConditionalFormattingValue(value) {
138063
138090
  from: value.from,
138064
138091
  to: value.to
138065
138092
  } };
138093
+ if (value.kind === "absoluteDate") return { value: { absolute: {
138094
+ from: value.from,
138095
+ to: value.to
138096
+ } } };
138097
+ if (value.kind === "relativeDate") return { value: { relative: {
138098
+ granularity: cfGranularityToYaml(value.granularity),
138099
+ from: value.from,
138100
+ to: value.to
138101
+ } } };
138066
138102
  return {};
138067
138103
  }
138068
138104
  function loadConditionalFormattingCondition(condition) {
@@ -138094,11 +138130,25 @@ function loadConditionalFormatting(value) {
138094
138130
  }
138095
138131
  function saveConditionalFormattingValue(value) {
138096
138132
  if (value === null || value === void 0) return { kind: "none" };
138097
- if (typeof value === "object" && "from" in value) return {
138098
- kind: "literalRange",
138099
- from: value.from,
138100
- to: value.to
138101
- };
138133
+ if (typeof value === "object") {
138134
+ if ("absolute" in value) return {
138135
+ kind: "absoluteDate",
138136
+ from: value.absolute.from,
138137
+ to: value.absolute.to
138138
+ };
138139
+ if ("relative" in value) return {
138140
+ kind: "relativeDate",
138141
+ granularity: cfGranularityFromYaml(value.relative.granularity),
138142
+ from: value.relative.from,
138143
+ to: value.relative.to
138144
+ };
138145
+ if ("from" in value) return {
138146
+ kind: "literalRange",
138147
+ from: value.from,
138148
+ to: value.to
138149
+ };
138150
+ return { kind: "none" };
138151
+ }
138102
138152
  return {
138103
138153
  kind: "literal",
138104
138154
  value
@@ -138836,6 +138886,39 @@ function convertDateValues(gran, values) {
138836
138886
  return values.map((v) => parseGranularityValue$1(granularity, v)).filter((v) => v !== null && v !== void 0);
138837
138887
  }
138838
138888
  //#endregion
138889
+ //#region ../../../sdk/libs/sdk-code-convertors/src/utils/visualisationTypeMap.ts
138890
+ /**
138891
+ * Keyed by the schema's `Visualisation["type"]` union so a new chart type fails the build until mapped;
138892
+ * both conversion directions read it, so they cannot drift.
138893
+ * @internal
138894
+ */
138895
+ const yamlVisTypeToVisualizationUrl = {
138896
+ table: "local:table",
138897
+ bar_chart: "local:bar",
138898
+ column_chart: "local:column",
138899
+ line_chart: "local:line",
138900
+ area_chart: "local:area",
138901
+ scatter_chart: "local:scatter",
138902
+ bubble_chart: "local:bubble",
138903
+ pie_chart: "local:pie",
138904
+ donut_chart: "local:donut",
138905
+ treemap_chart: "local:treemap",
138906
+ pyramid_chart: "local:pyramid",
138907
+ funnel_chart: "local:funnel",
138908
+ heatmap_chart: "local:heatmap",
138909
+ bullet_chart: "local:bullet",
138910
+ waterfall_chart: "local:waterfall",
138911
+ dependency_wheel_chart: "local:dependencywheel",
138912
+ sankey_chart: "local:sankey",
138913
+ headline_chart: "local:headline",
138914
+ combo_chart: "local:combo2",
138915
+ geo_chart: "local:pushpin",
138916
+ geo_area_chart: "local:choropleth",
138917
+ repeater_chart: "local:repeater",
138918
+ radar_chart: "local:radar"
138919
+ };
138920
+ const visualizationUrlToYamlVisType = new Map(Object.entries(yamlVisTypeToVisualizationUrl).map(([yamlType, url]) => [url, yamlType]));
138921
+ //#endregion
138839
138922
  //#region ../../../sdk/libs/sdk-code-convertors/src/to/yamlVisualisationToDeclarative.ts
138840
138923
  /** @public */
138841
138924
  function yamlVisualisationToDeclarative(entities, input) {
@@ -138864,31 +138947,7 @@ function yamlVisualisationToDeclarative(entities, input) {
138864
138947
  return output;
138865
138948
  }
138866
138949
  function yamlVisTypeToDeclarative(def) {
138867
- switch (def.type) {
138868
- case "table": return "local:table";
138869
- case "bar_chart": return "local:bar";
138870
- case "column_chart": return "local:column";
138871
- case "line_chart": return "local:line";
138872
- case "area_chart": return "local:area";
138873
- case "scatter_chart": return "local:scatter";
138874
- case "bubble_chart": return "local:bubble";
138875
- case "pie_chart": return "local:pie";
138876
- case "donut_chart": return "local:donut";
138877
- case "treemap_chart": return "local:treemap";
138878
- case "pyramid_chart": return "local:pyramid";
138879
- case "funnel_chart": return "local:funnel";
138880
- case "heatmap_chart": return "local:heatmap";
138881
- case "bullet_chart": return "local:bullet";
138882
- case "waterfall_chart": return "local:waterfall";
138883
- case "dependency_wheel_chart": return "local:dependencywheel";
138884
- case "sankey_chart": return "local:sankey";
138885
- case "headline_chart": return "local:headline";
138886
- case "combo_chart": return "local:combo2";
138887
- case "geo_chart": return "local:pushpin";
138888
- case "geo_area_chart": return "local:choropleth";
138889
- case "repeater_chart": return "local:repeater";
138890
- case "radar_chart": return "local:radar";
138891
- }
138950
+ return yamlVisTypeToVisualizationUrl[def.type];
138892
138951
  }
138893
138952
  function yamlConfigToDeclarative(def, positions) {
138894
138953
  let controls;
@@ -140793,32 +140852,7 @@ function declarativeFiltersConfigToYaml$1(insight, filtersMap, errorContext) {
140793
140852
  }
140794
140853
  /** @internal */
140795
140854
  function declarativeVisTypeToYaml(def) {
140796
- switch (def.visualizationUrl) {
140797
- case "local:table": return "table";
140798
- case "local:bar": return "bar_chart";
140799
- case "local:column": return "column_chart";
140800
- case "local:line": return "line_chart";
140801
- case "local:area": return "area_chart";
140802
- case "local:scatter": return "scatter_chart";
140803
- case "local:bubble": return "bubble_chart";
140804
- case "local:pie": return "pie_chart";
140805
- case "local:donut": return "donut_chart";
140806
- case "local:treemap": return "treemap_chart";
140807
- case "local:pyramid": return "pyramid_chart";
140808
- case "local:funnel": return "funnel_chart";
140809
- case "local:heatmap": return "heatmap_chart";
140810
- case "local:bullet": return "bullet_chart";
140811
- case "local:waterfall": return "waterfall_chart";
140812
- case "local:dependencywheel": return "dependency_wheel_chart";
140813
- case "local:sankey": return "sankey_chart";
140814
- case "local:headline": return "headline_chart";
140815
- case "local:combo2": return "combo_chart";
140816
- case "local:pushpin": return "geo_chart";
140817
- case "local:choropleth": return "geo_area_chart";
140818
- case "local:repeater": return "repeater_chart";
140819
- case "local:radar": return "radar_chart";
140820
- default: return null;
140821
- }
140855
+ return visualizationUrlToYamlVisType.get(def.visualizationUrl) ?? null;
140822
140856
  }
140823
140857
  function declarativeVisToYaml(doc, def, report, entities, errorContext) {
140824
140858
  const context = updateErrorContext(errorContext, { data: {
@@ -144844,6 +144878,7 @@ function stringCleaner(string) {
144844
144878
  }
144845
144879
  //#endregion
144846
144880
  //#region ../code/esm/features/references/resolve/tables.js
144881
+ const TIMESTAMP_DATA_TYPES = ["TIMESTAMP", "TIMESTAMP_TZ"];
144847
144882
  function resolveTablesReferences(state, file, context = {}) {
144848
144883
  const sourceFile = context.sourceFile || resolveSync(state, file);
144849
144884
  if (sourceFile?.relatedManifest?.manifest) {
@@ -144896,7 +144931,7 @@ function resolveColumnDataType(references) {
144896
144931
  const [table, diagnostics] = findTable(references, self, self.table_path);
144897
144932
  if (table) {
144898
144933
  const column = findColumn(table, findSourceColumn(references));
144899
- return [column ? [{ id: column.dataType }] : [], diagnostics];
144934
+ return [column ? getCompatibleColumnDataTypes(column) : [], diagnostics];
144900
144935
  }
144901
144936
  return [[], diagnostics];
144902
144937
  }
@@ -144904,7 +144939,7 @@ function resolveColumnDataType(references) {
144904
144939
  const [table, diagnostics] = findStatement(references, self, self.sql);
144905
144940
  if (table) {
144906
144941
  const column = findColumn(table, findSourceColumn(references));
144907
- return [column ? [{ id: column.dataType }] : [], diagnostics];
144942
+ return [column ? getCompatibleColumnDataTypes(column) : [], diagnostics];
144908
144943
  }
144909
144944
  return [[], diagnostics];
144910
144945
  }
@@ -144944,6 +144979,10 @@ function findStatement(references, dataset, sql) {
144944
144979
  function findColumn(table, column) {
144945
144980
  return table.columns.find((col) => col.name === column);
144946
144981
  }
144982
+ function getCompatibleColumnDataTypes(column) {
144983
+ if (TIMESTAMP_DATA_TYPES.includes(column.dataType)) return TIMESTAMP_DATA_TYPES.map((dataType) => ({ id: dataType }));
144984
+ return [{ id: column.dataType }];
144985
+ }
144947
144986
  function getTableIds(references, dataset) {
144948
144987
  const hash = stringToHash(getTableRootId(references.profile, dataset));
144949
144988
  const tables = references.tables[hash] || {};
@@ -149227,7 +149266,7 @@ const metadata_v1 = {
149227
149266
  ]
149228
149267
  },
149229
149268
  "value": {
149230
- "description": "Literal (number or string); a {from,to} range for between/not_between; omitted for all/is_empty/is_not_empty.",
149269
+ "description": "Literal (number or string); a {from,to} range for between/not_between; an {absolute} period or {relative} period for date-attribute conditions; omitted for all/is_empty/is_not_empty.",
149231
149270
  "oneOf": [
149232
149271
  { "type": "number" },
149233
149272
  { "type": "string" },
@@ -149239,6 +149278,52 @@ const metadata_v1 = {
149239
149278
  "from": { "type": "number" },
149240
149279
  "to": { "type": "number" }
149241
149280
  }
149281
+ },
149282
+ {
149283
+ "type": "object",
149284
+ "additionalProperties": false,
149285
+ "required": ["absolute"],
149286
+ "properties": { "absolute": {
149287
+ "type": "object",
149288
+ "description": "Static period, snapped to the target date attribute's granularity: from = period start, to = inclusive period end. Platform date strings: \"YYYY-MM-DD\", or \"YYYY-MM-DD HH:mm\" for hour/minute granularities.",
149289
+ "additionalProperties": false,
149290
+ "required": ["from", "to"],
149291
+ "properties": {
149292
+ "from": { "type": "string" },
149293
+ "to": { "type": "string" }
149294
+ }
149295
+ } }
149296
+ },
149297
+ {
149298
+ "type": "object",
149299
+ "additionalProperties": false,
149300
+ "required": ["relative"],
149301
+ "properties": { "relative": {
149302
+ "type": "object",
149303
+ "description": "Relative period re-resolved on every render/export: integer period offsets where 0 = the current period, negative = past. Granularity must be coarser than or equal to (and aligned with) the target date attribute's granularity.",
149304
+ "additionalProperties": false,
149305
+ "required": [
149306
+ "granularity",
149307
+ "from",
149308
+ "to"
149309
+ ],
149310
+ "properties": {
149311
+ "granularity": {
149312
+ "type": "string",
149313
+ "enum": [
149314
+ "minute",
149315
+ "hour",
149316
+ "day",
149317
+ "week",
149318
+ "month",
149319
+ "quarter",
149320
+ "year"
149321
+ ]
149322
+ },
149323
+ "from": { "type": "integer" },
149324
+ "to": { "type": "integer" }
149325
+ }
149326
+ } }
149242
149327
  }
149243
149328
  ]
149244
149329
  },
@@ -159681,7 +159766,7 @@ async function open(state, emitter, file) {
159681
159766
  //#endregion
159682
159767
  //#region ../code/package.json
159683
159768
  var name = "@gooddata/code";
159684
- var version = "0.46.0-alpha.2";
159769
+ var version = "0.46.0-alpha.3";
159685
159770
  //#endregion
159686
159771
  //#region ../../../sdk/libs/api-client-tiger/src/axios.ts
159687
159772
  /**
@@ -159703,7 +159788,7 @@ const _CONFIG = {
159703
159788
  common: {
159704
159789
  "X-Requested-With": "XMLHttpRequest",
159705
159790
  "X-GDC-JS-PACKAGE": "@gooddata/api-client-tiger",
159706
- "X-GDC-JS-PACKAGE-VERSION": "11.50.0-alpha.2"
159791
+ "X-GDC-JS-PACKAGE-VERSION": "11.50.0-alpha.3"
159707
159792
  },
159708
159793
  post: { "Content-Type": "application/json;charset=utf8" },
159709
159794
  put: { "Content-Type": "application/json;charset=utf8" }
@@ -199982,7 +200067,7 @@ function offlineModeBanner(offline) {
199982
200067
  }
199983
200068
  }
199984
200069
  function experimentalFeaturesBanner(manifest) {
199985
- if (manifest && manifest.experimental_features && Object.keys(manifest.experimental_features).length > 0) {
200070
+ if (manifest?.experimental_features && Object.keys(manifest.experimental_features).length > 0) {
199986
200071
  empty("");
199987
200072
  warn(texts.experimental_features());
199988
200073
  Object.keys(manifest.experimental_features).forEach((key) => {
@@ -200929,12 +201014,12 @@ async function saveManifest(state, manifestYaml) {
200929
201014
  } catch (e) {
200930
201015
  throw new Error([texts.cmd__init__manifest__write__error(manifestPath), e.message].join("\n"));
200931
201016
  }
200932
- if (state.env && state.env.path && ["created", "updated"].includes(state.env.status)) try {
201017
+ if (state.env?.path && ["created", "updated"].includes(state.env.status)) try {
200933
201018
  await fsPromise.appendFile(state.env.path, `${state.env.status === "updated" ? os$1.EOL : ""}${state.token?.variable}="${state.token?.raw}"`, { flag: "a+" });
200934
201019
  } catch (e) {
200935
201020
  throw new Error([texts.cmd__init__env__write__error(state.env.path), e.message].join("\n"));
200936
201021
  }
200937
- if (state.gitignore && state.gitignore.path && ["created", "updated"].includes(state.gitignore.status)) try {
201022
+ if (state.gitignore?.path && ["created", "updated"].includes(state.gitignore.status)) try {
200938
201023
  await fsPromise.appendFile(state.gitignore.path, `${state.gitignore.status === "updated" ? os$1.EOL : ""}.env`, { flag: "a+" });
200939
201024
  } catch (e) {
200940
201025
  throw new Error([texts.cmd__init__gitignore__write__error(state.gitignore.path), e.message].join("\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/code-cli",
3
- "version": "0.46.0-alpha.2",
3
+ "version": "0.46.0-alpha.3",
4
4
  "description": "GoodData CLI",
5
5
  "keywords": [
6
6
  "analytics",