@firestartr/cli 1.43.2 → 1.44.0-snapshot-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/build/index.js +31 -85
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -282295,89 +282295,43 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
282295
282295
|
|
282296
282296
|
|
282297
282297
|
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
282298
|
-
// We need to ensure the grep command is a gnu version
|
282299
|
-
let IS_GNU_GREP = false;
|
282300
|
-
let GREP_ON_CHECK = false;
|
282301
|
-
// this loop is for avoid race conditions
|
282302
|
-
// once a check is running no more checks
|
282303
|
-
async function waitForCheck() {
|
282304
|
-
const f_wait = () => new Promise((timeOut) => setTimeout(timeOut, 10));
|
282305
|
-
do {
|
282306
|
-
await f_wait();
|
282307
|
-
} while (GREP_ON_CHECK);
|
282308
|
-
}
|
282309
|
-
function checkGrep() {
|
282310
|
-
return new Promise((ok, ko) => {
|
282311
|
-
// idempotency: already checked
|
282312
|
-
if (IS_GNU_GREP)
|
282313
|
-
return ok();
|
282314
|
-
// a check is already running no new checks
|
282315
|
-
if (GREP_ON_CHECK)
|
282316
|
-
return waitForCheck();
|
282317
|
-
lazy_loader_log('Checking the grep command');
|
282318
|
-
GREP_ON_CHECK = true;
|
282319
|
-
const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['--version']);
|
282320
|
-
handler.on('close', (code) => {
|
282321
|
-
GREP_ON_CHECK = false;
|
282322
|
-
if (code === 0) {
|
282323
|
-
lazy_loader_log('Grep is a gnu grep');
|
282324
|
-
IS_GNU_GREP = true;
|
282325
|
-
ok();
|
282326
|
-
}
|
282327
|
-
else {
|
282328
|
-
ko('Lazy evaluation needs a gnu-grep command');
|
282329
|
-
}
|
282330
|
-
});
|
282331
|
-
});
|
282332
|
-
}
|
282333
282298
|
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
282334
|
-
await checkGrep();
|
282335
282299
|
let result = existingRefs;
|
282336
282300
|
lazy_loader_log(`Load reference ${claimRef}`);
|
282337
282301
|
initVirtualClaims(org);
|
282338
282302
|
lazy_loader_log(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
|
282339
282303
|
// cargas datos con grep
|
282304
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
282305
|
+
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
282306
|
+
//const claim: any = common.io.fromYaml(claimData);
|
282340
282307
|
try {
|
282341
|
-
|
282342
|
-
|
282343
|
-
try {
|
282344
|
-
validateClaim(claim, base[`${claim.kind}Schema`]);
|
282345
|
-
await optionalValidation(claim);
|
282346
|
-
}
|
282347
|
-
catch (error) {
|
282348
|
-
let errorMsg = '';
|
282349
|
-
for (const data of error) {
|
282350
|
-
errorMsg = `${errorMsg}
|
282351
|
-
- ${data.dataPath}: ${data.message}`;
|
282352
|
-
}
|
282353
|
-
throw new Error(`Error when validating claim ${claimRef}: ${errorMsg}`);
|
282354
|
-
}
|
282355
|
-
result[claimRef] = {};
|
282356
|
-
result[claimRef]['claim'] = claim;
|
282357
|
-
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
282358
|
-
if (VisitedClaims[claimRef] === 'virtual') {
|
282359
|
-
result = await setVirtualClaimAdditionalData(result, claim, claimRef);
|
282360
|
-
}
|
282361
|
-
else {
|
282362
|
-
result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
|
282363
|
-
}
|
282364
|
-
const claimKind = claim.kind;
|
282365
|
-
const references = extractAllRefs(catalog_common.io.toYaml(claim));
|
282366
|
-
for (const ref of references) {
|
282367
|
-
if (!result[ref]) {
|
282368
|
-
const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
282369
|
-
result = lodash_default().merge(result, resolvedReferences);
|
282370
|
-
}
|
282371
|
-
}
|
282308
|
+
validateClaim(claim, base[`${claim.kind}Schema`]);
|
282309
|
+
await optionalValidation(claim);
|
282372
282310
|
}
|
282373
|
-
catch (
|
282374
|
-
throw `
|
282311
|
+
catch (error) {
|
282312
|
+
throw new Error(`Error when validating claim ${claimRef}: ${error[0].message}`);
|
282313
|
+
}
|
282314
|
+
result[claimRef] = {};
|
282315
|
+
result[claimRef]['claim'] = claim;
|
282316
|
+
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
282317
|
+
if (VisitedClaims[claimRef] === 'virtual') {
|
282318
|
+
result = await setVirtualClaimAdditionalData(result, claim, claimRef);
|
282319
|
+
}
|
282320
|
+
else {
|
282321
|
+
result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
|
282322
|
+
}
|
282323
|
+
const claimKind = claim.kind;
|
282324
|
+
const references = extractAllRefs(catalog_common.io.toYaml(claim));
|
282325
|
+
for (const ref of references) {
|
282326
|
+
if (!result[ref]) {
|
282327
|
+
const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
282328
|
+
result = lodash_default().merge(result, resolvedReferences);
|
282329
|
+
}
|
282375
282330
|
}
|
282376
282331
|
return result;
|
282377
282332
|
}
|
282378
282333
|
const LoadedClaims = {};
|
282379
282334
|
const VisitedClaims = {};
|
282380
|
-
const DuplicatedClaims = {};
|
282381
282335
|
async function lazyGetClaim(kind, name, org, cwd) {
|
282382
282336
|
const indice = `${kind}-${name}`;
|
282383
282337
|
lazy_loader_log(`Lazy loading ${kind}-${name} with index ${indice}`);
|
@@ -282420,14 +282374,14 @@ async function getClaimsByName(name, cwd = '.') {
|
|
282420
282374
|
}
|
282421
282375
|
});
|
282422
282376
|
handler.on('close', () => {
|
282423
|
-
|
282377
|
+
Promise.all(entradas.map((entrada) => {
|
282424
282378
|
return loadRawClaim(entrada);
|
282425
282379
|
}))
|
282426
282380
|
.then(() => {
|
282427
282381
|
ok();
|
282428
282382
|
})
|
282429
|
-
.catch((
|
282430
|
-
ko(
|
282383
|
+
.catch(() => {
|
282384
|
+
ko();
|
282431
282385
|
});
|
282432
282386
|
});
|
282433
282387
|
});
|
@@ -282441,17 +282395,9 @@ async function loadRawClaim(entry) {
|
|
282441
282395
|
if (!('kind' in claim && 'name' in claim)) {
|
282442
282396
|
lazy_loader_log(`Invalid claim file ${entry}`);
|
282443
282397
|
}
|
282444
|
-
|
282445
|
-
|
282446
|
-
|
282447
|
-
DuplicatedClaims[claimKey] !== entry) {
|
282448
|
-
return ko(`Duplicated claim ${claimKey} found files: ${DuplicatedClaims[claimKey]} and ${entry}`);
|
282449
|
-
}
|
282450
|
-
LoadedClaims[claimKey] = data;
|
282451
|
-
VisitedClaims[claimKey] = entry;
|
282452
|
-
DuplicatedClaims[claimKey] = entry;
|
282453
|
-
ok();
|
282454
|
-
}
|
282398
|
+
LoadedClaims[`${claim.kind}-${claim.name}`] = data;
|
282399
|
+
VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
|
282400
|
+
ok();
|
282455
282401
|
});
|
282456
282402
|
});
|
282457
282403
|
}
|
@@ -284434,7 +284380,7 @@ class FeaturesOverrider extends OverriderPatches {
|
|
284434
284380
|
}
|
284435
284381
|
async __patches(claim, _previousCR) {
|
284436
284382
|
const featureName = this.featureName;
|
284437
|
-
const featureVersion = this.featureVersion
|
284383
|
+
const featureVersion = this.featureVersion;
|
284438
284384
|
const featureArgs = this.featureArgs;
|
284439
284385
|
const fSetUpAndRunRenderer = function (cr) {
|
284440
284386
|
return this.setUpAndRunRenderer(cr);
|