@gooddata/code-cli 0.64.0-alpha.1 → 0.64.0-alpha.2
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/dist/index.js +63 -77
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import https from "https";
|
|
|
26
26
|
import http2 from "http2";
|
|
27
27
|
import zlib from "zlib";
|
|
28
28
|
import * as fs from "node:fs";
|
|
29
|
-
import { readFileSync as readFileSync$1 } from "node:fs";
|
|
29
|
+
import { constants, readFileSync as readFileSync$1 } from "node:fs";
|
|
30
30
|
import * as fsPromise from "node:fs/promises";
|
|
31
31
|
import { lstat, readdir, realpath, stat } from "node:fs/promises";
|
|
32
32
|
import * as util$1 from "node:util";
|
|
@@ -37445,7 +37445,7 @@ function isPromise(value) {
|
|
|
37445
37445
|
//#endregion
|
|
37446
37446
|
//#region package.json
|
|
37447
37447
|
var name$1 = "@gooddata/code-cli";
|
|
37448
|
-
var version$1 = "0.64.0-alpha.
|
|
37448
|
+
var version$1 = "0.64.0-alpha.2";
|
|
37449
37449
|
//#endregion
|
|
37450
37450
|
//#region ../../../common/temp/aac/node_modules/.pnpm/@gooddata+sdk-maql-language-server@file+..+..+..+sdk+libs+sdk-maql-language-server_debug@4.4.3/node_modules/@gooddata/sdk-maql-language-server/esm/docs/en/docs/create-metrics/maql/aggregation/approximate_count.js
|
|
37451
37451
|
const content$65 = `# APPROXIMATE_COUNT
|
|
@@ -117738,7 +117738,7 @@ const _CONFIG$1 = {
|
|
|
117738
117738
|
common: {
|
|
117739
117739
|
"X-Requested-With": "XMLHttpRequest",
|
|
117740
117740
|
"X-GDC-JS-PACKAGE": "@gooddata/api-client-tiger",
|
|
117741
|
-
"X-GDC-JS-PACKAGE-VERSION": "11.67.0-alpha.
|
|
117741
|
+
"X-GDC-JS-PACKAGE-VERSION": "11.67.0-alpha.2"
|
|
117742
117742
|
},
|
|
117743
117743
|
post: { "Content-Type": "application/json;charset=utf8" },
|
|
117744
117744
|
put: { "Content-Type": "application/json;charset=utf8" }
|
|
@@ -170085,6 +170085,42 @@ function yamlAttributeHierarchyToDeclarative(input) {
|
|
|
170085
170085
|
};
|
|
170086
170086
|
}
|
|
170087
170087
|
//#endregion
|
|
170088
|
+
//#region ../../../common/temp/aac/node_modules/.pnpm/@gooddata+sdk-code-convertors@file+..+..+..+sdk+libs+sdk-code-convertors_debug@4.4.3/node_modules/@gooddata/sdk-code-convertors/esm/to/yamlDocumentsToDeclarativeWorkspace.js
|
|
170089
|
+
/**
|
|
170090
|
+
* Converts the entities of one workspace to its declarative model and stores the declarative form
|
|
170091
|
+
* of each entity in its `declarative` property.
|
|
170092
|
+
*
|
|
170093
|
+
* @internal
|
|
170094
|
+
*/
|
|
170095
|
+
function yamlEntitiesToDeclarativeWorkspace(entities, { dataSourceId } = {}) {
|
|
170096
|
+
const convert = (types, toDeclarative) => entities.filter((entity) => types.includes(entity.type)).map((entity) => {
|
|
170097
|
+
const declarative = toDeclarative(entity.data);
|
|
170098
|
+
entity.declarative = declarative;
|
|
170099
|
+
return declarative;
|
|
170100
|
+
});
|
|
170101
|
+
const dashboards = convert(DashboardTypes$1, (dashboard) => yamlDashboardToDeclarative(entities, dashboard));
|
|
170102
|
+
return {
|
|
170103
|
+
ldm: {
|
|
170104
|
+
datasets: convert(DatasetTypes$2, (dataset) => yamlDatasetToDeclarative(entities, dataset, dataSourceId)),
|
|
170105
|
+
dateInstances: convert(DateDatasetTypes$2, yamlDateDatesetToDeclarative)
|
|
170106
|
+
},
|
|
170107
|
+
analytics: {
|
|
170108
|
+
metrics: convert(MetricTypes$1, yamlMetricToDeclarative),
|
|
170109
|
+
parameters: convert(ParameterTypes$1, yamlParameterToDeclarative),
|
|
170110
|
+
computedAttributes: convert(ComputedAttributeTypes$1, yamlComputedAttributeToDeclarative),
|
|
170111
|
+
visualizationObjects: convert(VisualisationsTypes, (visualisation) => yamlVisualisationToDeclarative(entities, visualisation)),
|
|
170112
|
+
analyticalDashboards: dashboards.map(({ dashboard }) => dashboard),
|
|
170113
|
+
filterContexts: dashboards.flatMap(dashboardFilterContexts),
|
|
170114
|
+
dashboardPlugins: convert(PluginTypes$1, yamlPluginToDeclarative),
|
|
170115
|
+
attributeHierarchies: convert(AttributeHierarchyTypes$1, yamlAttributeHierarchyToDeclarative)
|
|
170116
|
+
}
|
|
170117
|
+
};
|
|
170118
|
+
}
|
|
170119
|
+
function dashboardFilterContexts({ filterContext, tabFilterContexts = [] }) {
|
|
170120
|
+
const contexts = filterContext ? [filterContext, ...tabFilterContexts] : tabFilterContexts;
|
|
170121
|
+
return contexts.filter((context, index) => contexts.findIndex(({ id }) => id === context.id) === index);
|
|
170122
|
+
}
|
|
170123
|
+
//#endregion
|
|
170088
170124
|
//#region ../../../common/temp/aac/node_modules/.pnpm/@gooddata+sdk-code-convertors@file+..+..+..+sdk+libs+sdk-code-convertors_debug@4.4.3/node_modules/@gooddata/sdk-code-convertors/esm/from/declarativeDatasetToYaml.js
|
|
170089
170125
|
function processDeclarativeLabel(dataset, label, tablesMap, profile) {
|
|
170090
170126
|
const map = new import_dist$5.YAMLMap();
|
|
@@ -209669,7 +209705,7 @@ async function open(state, emitter, file) {
|
|
|
209669
209705
|
//#endregion
|
|
209670
209706
|
//#region ../code/package.json
|
|
209671
209707
|
var name = "@gooddata/code";
|
|
209672
|
-
var version = "0.64.0-alpha.
|
|
209708
|
+
var version = "0.64.0-alpha.2";
|
|
209673
209709
|
//#endregion
|
|
209674
209710
|
//#region ../code/esm/services/server/client.js
|
|
209675
209711
|
function getApiClient$1(profile, { packageName, packageVersion }) {
|
|
@@ -215322,9 +215358,8 @@ function initializeServices(state, options) {
|
|
|
215322
215358
|
async function toDeclarative(store, basePath, profile, { experimentalFeatures: _experimentalFeatures = {}, ...restOpts } = {}) {
|
|
215323
215359
|
const { mode, related } = asDefaultFileMode(restOpts);
|
|
215324
215360
|
const entities = loadAllEntities(getRoots(store.memory, mode, related ?? false), basePath);
|
|
215325
|
-
const { ws } = createDeclarativeWorkspaceModel(entities, profile);
|
|
215326
215361
|
return {
|
|
215327
|
-
ws,
|
|
215362
|
+
ws: yamlEntitiesToDeclarativeWorkspace(entities, { dataSourceId: profile.data_source }),
|
|
215328
215363
|
entities
|
|
215329
215364
|
};
|
|
215330
215365
|
}
|
|
@@ -215354,75 +215389,6 @@ function loadAllEntities(roots, basePath) {
|
|
|
215354
215389
|
}
|
|
215355
215390
|
return entitiesPerRoot.flat();
|
|
215356
215391
|
}
|
|
215357
|
-
function createDeclarativeWorkspaceModel(entities, profile) {
|
|
215358
|
-
const ws = {
|
|
215359
|
-
ldm: {},
|
|
215360
|
-
analytics: {}
|
|
215361
|
-
};
|
|
215362
|
-
const datasetsEntities = entities.filter((e) => DatasetTypes$2.includes(e.type)).map((data) => {
|
|
215363
|
-
data.declarative = yamlDatasetToDeclarative(entities, data.data, profile.data_source);
|
|
215364
|
-
return data;
|
|
215365
|
-
});
|
|
215366
|
-
ws.ldm.datasets = datasetsEntities.map((d) => d.declarative);
|
|
215367
|
-
const dateInstancesEntities = entities.filter((e) => DateDatasetTypes$2.includes(e.type)).map((data) => {
|
|
215368
|
-
data.declarative = yamlDateDatesetToDeclarative(data.data);
|
|
215369
|
-
return data;
|
|
215370
|
-
});
|
|
215371
|
-
ws.ldm.dateInstances = dateInstancesEntities.map((d) => d.declarative);
|
|
215372
|
-
const metricsEntities = entities.filter((e) => MetricTypes$1.includes(e.type)).map((data) => {
|
|
215373
|
-
data.declarative = yamlMetricToDeclarative(data.data);
|
|
215374
|
-
return data;
|
|
215375
|
-
});
|
|
215376
|
-
ws.analytics.metrics = metricsEntities.map((d) => d.declarative);
|
|
215377
|
-
const parameterEntities = entities.filter((e) => ParameterTypes$1.includes(e.type)).map((data) => {
|
|
215378
|
-
data.declarative = yamlParameterToDeclarative(data.data);
|
|
215379
|
-
return data;
|
|
215380
|
-
});
|
|
215381
|
-
ws.analytics.parameters = parameterEntities.map((d) => d.declarative);
|
|
215382
|
-
const computedAttributesEntities = entities.filter((e) => ComputedAttributeTypes$1.includes(e.type)).map((data) => {
|
|
215383
|
-
data.declarative = yamlComputedAttributeToDeclarative(data.data);
|
|
215384
|
-
return data;
|
|
215385
|
-
});
|
|
215386
|
-
ws.analytics.computedAttributes = computedAttributesEntities.map((d) => d.declarative);
|
|
215387
|
-
const visualisationsEntities = entities.filter((e) => VisualisationsTypes.includes(e.type)).map((data) => {
|
|
215388
|
-
data.declarative = yamlVisualisationToDeclarative(entities, data.data);
|
|
215389
|
-
return data;
|
|
215390
|
-
});
|
|
215391
|
-
ws.analytics.visualizationObjects = visualisationsEntities.map((d) => d.declarative);
|
|
215392
|
-
const dashboardEntities = entities.filter((e) => DashboardTypes$1.includes(e.type)).map((data) => {
|
|
215393
|
-
data.declarative = yamlDashboardToDeclarative(entities, data.data);
|
|
215394
|
-
return data;
|
|
215395
|
-
});
|
|
215396
|
-
ws.analytics.analyticalDashboards = dashboardEntities.map((d) => d.declarative.dashboard);
|
|
215397
|
-
ws.analytics.filterContexts = dashboardEntities.flatMap((d) => {
|
|
215398
|
-
const declarative = d.declarative;
|
|
215399
|
-
const seen = /* @__PURE__ */ new Set();
|
|
215400
|
-
const result = [];
|
|
215401
|
-
if (declarative.filterContext) {
|
|
215402
|
-
result.push(declarative.filterContext);
|
|
215403
|
-
seen.add(declarative.filterContext.id);
|
|
215404
|
-
}
|
|
215405
|
-
for (const fc of declarative.tabFilterContexts ?? []) if (!seen.has(fc.id)) {
|
|
215406
|
-
result.push(fc);
|
|
215407
|
-
seen.add(fc.id);
|
|
215408
|
-
}
|
|
215409
|
-
return result;
|
|
215410
|
-
});
|
|
215411
|
-
const pluginEntities = entities.filter((e) => PluginTypes$1.includes(e.type)).map((data) => {
|
|
215412
|
-
data.declarative = yamlPluginToDeclarative(data.data);
|
|
215413
|
-
return data;
|
|
215414
|
-
});
|
|
215415
|
-
ws.analytics.dashboardPlugins = pluginEntities.map((d) => d.declarative);
|
|
215416
|
-
const attributeHierarchyEntities = entities.filter((e) => AttributeHierarchyTypes$1.includes(e.type)).map((data) => {
|
|
215417
|
-
data.declarative = yamlAttributeHierarchyToDeclarative(data.data);
|
|
215418
|
-
return data;
|
|
215419
|
-
});
|
|
215420
|
-
ws.analytics.attributeHierarchies = attributeHierarchyEntities.map((d) => d.declarative);
|
|
215421
|
-
return {
|
|
215422
|
-
ws,
|
|
215423
|
-
entities
|
|
215424
|
-
};
|
|
215425
|
-
}
|
|
215426
215392
|
function getRoots(memNode, mode, related) {
|
|
215427
215393
|
switch (mode) {
|
|
215428
215394
|
case "physical": return [findPhysical(memNode) || createPhysicalNode()];
|
|
@@ -237201,7 +237167,7 @@ const _CONFIG = {
|
|
|
237201
237167
|
common: {
|
|
237202
237168
|
"X-Requested-With": "XMLHttpRequest",
|
|
237203
237169
|
"X-GDC-JS-PACKAGE": "@gooddata/api-client-tiger",
|
|
237204
|
-
"X-GDC-JS-PACKAGE-VERSION": "11.67.0-alpha.
|
|
237170
|
+
"X-GDC-JS-PACKAGE-VERSION": "11.67.0-alpha.2"
|
|
237205
237171
|
},
|
|
237206
237172
|
post: { "Content-Type": "application/json;charset=utf8" },
|
|
237207
237173
|
put: { "Content-Type": "application/json;charset=utf8" }
|
|
@@ -274937,6 +274903,26 @@ async function compileManifest(state) {
|
|
|
274937
274903
|
}
|
|
274938
274904
|
return manifestYaml;
|
|
274939
274905
|
}
|
|
274906
|
+
async function appendPrivateFile(filePath, data) {
|
|
274907
|
+
const { O_APPEND, O_CREAT, O_WRONLY, O_NOFOLLOW, O_NONBLOCK } = constants;
|
|
274908
|
+
if (O_NOFOLLOW === void 0) {
|
|
274909
|
+
if ((await fsPromise.lstat(filePath).catch((e) => {
|
|
274910
|
+
if (e.code === "ENOENT") return;
|
|
274911
|
+
throw e;
|
|
274912
|
+
}))?.isSymbolicLink()) throw new Error(`"${filePath}" is a symbolic link`);
|
|
274913
|
+
}
|
|
274914
|
+
const flags = O_APPEND | O_CREAT | O_WRONLY | (O_NOFOLLOW ?? 0) | (O_NONBLOCK ?? 0);
|
|
274915
|
+
const handle = await fsPromise.open(filePath, flags, 384);
|
|
274916
|
+
try {
|
|
274917
|
+
const stats = await handle.stat();
|
|
274918
|
+
if (!stats.isFile()) throw new Error(`"${filePath}" is not a regular file`);
|
|
274919
|
+
if (typeof process.getuid === "function" && stats.uid !== process.getuid()) throw new Error(`"${filePath}" is not owned by the current user`);
|
|
274920
|
+
if ((stats.mode & 63) !== 0) await handle.chmod(384);
|
|
274921
|
+
await handle.appendFile(data);
|
|
274922
|
+
} finally {
|
|
274923
|
+
await handle.close();
|
|
274924
|
+
}
|
|
274925
|
+
}
|
|
274940
274926
|
async function saveManifest(state, manifestYaml) {
|
|
274941
274927
|
const manifestPath = path$3.resolve(process.cwd(), manifestFileNames[0]);
|
|
274942
274928
|
debug(texts.cmd__init__debug__manifest__path(manifestPath));
|
|
@@ -274946,7 +274932,7 @@ async function saveManifest(state, manifestYaml) {
|
|
|
274946
274932
|
throw new Error([texts.cmd__init__manifest__write__error(manifestPath), e.message].join("\n"));
|
|
274947
274933
|
}
|
|
274948
274934
|
if (state.env?.path && ["created", "updated"].includes(state.env.status)) try {
|
|
274949
|
-
await
|
|
274935
|
+
await appendPrivateFile(state.env.path, `${state.env.status === "updated" ? os$1.EOL : ""}${state.token?.variable}="${state.token?.raw}"`);
|
|
274950
274936
|
} catch (e) {
|
|
274951
274937
|
throw new Error([texts.cmd__init__env__write__error(state.env.path), e.message].join("\n"));
|
|
274952
274938
|
}
|