@firestartr/cli 1.43.2 → 1.44.0-snapshot-1
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 +35 -90
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -282293,91 +282293,44 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
282293
282293
|
|
282294
282294
|
|
282295
282295
|
|
282296
|
-
|
282297
282296
|
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
282298
|
-
|
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
|
-
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
282334
|
-
await checkGrep();
|
282297
|
+
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
282335
282298
|
let result = existingRefs;
|
282336
282299
|
lazy_loader_log(`Load reference ${claimRef}`);
|
282337
282300
|
initVirtualClaims(org);
|
282338
282301
|
lazy_loader_log(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
|
282339
282302
|
// cargas datos con grep
|
282303
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
282304
|
+
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
282305
|
+
//const claim: any = common.io.fromYaml(claimData);
|
282340
282306
|
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
|
-
}
|
282307
|
+
validateClaim(claim, base[`${claim.kind}Schema`]);
|
282308
|
+
await optionalValidation(claim);
|
282372
282309
|
}
|
282373
|
-
catch (
|
282374
|
-
throw `
|
282310
|
+
catch (error) {
|
282311
|
+
throw new Error(`Error when validating claim ${claimRef}: ${error[0].message}`);
|
282312
|
+
}
|
282313
|
+
result[claimRef] = {};
|
282314
|
+
result[claimRef]['claim'] = claim;
|
282315
|
+
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
282316
|
+
if (VisitedClaims[claimRef] === 'virtual') {
|
282317
|
+
result = await setVirtualClaimAdditionalData(result, claim, claimRef);
|
282318
|
+
}
|
282319
|
+
else {
|
282320
|
+
result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
|
282321
|
+
}
|
282322
|
+
const claimKind = claim.kind;
|
282323
|
+
const references = extractAllRefs(catalog_common.io.toYaml(claim));
|
282324
|
+
for (const ref of references) {
|
282325
|
+
if (!result[ref]) {
|
282326
|
+
const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
282327
|
+
result = lodash_default().merge(result, resolvedReferences);
|
282328
|
+
}
|
282375
282329
|
}
|
282376
282330
|
return result;
|
282377
282331
|
}
|
282378
282332
|
const LoadedClaims = {};
|
282379
282333
|
const VisitedClaims = {};
|
282380
|
-
const DuplicatedClaims = {};
|
282381
282334
|
async function lazyGetClaim(kind, name, org, cwd) {
|
282382
282335
|
const indice = `${kind}-${name}`;
|
282383
282336
|
lazy_loader_log(`Lazy loading ${kind}-${name} with index ${indice}`);
|
@@ -282420,14 +282373,14 @@ async function getClaimsByName(name, cwd = '.') {
|
|
282420
282373
|
}
|
282421
282374
|
});
|
282422
282375
|
handler.on('close', () => {
|
282423
|
-
|
282376
|
+
Promise.all(entradas.map((entrada) => {
|
282424
282377
|
return loadRawClaim(entrada);
|
282425
282378
|
}))
|
282426
282379
|
.then(() => {
|
282427
282380
|
ok();
|
282428
282381
|
})
|
282429
|
-
.catch((
|
282430
|
-
ko(
|
282382
|
+
.catch(() => {
|
282383
|
+
ko();
|
282431
282384
|
});
|
282432
282385
|
});
|
282433
282386
|
});
|
@@ -282441,17 +282394,9 @@ async function loadRawClaim(entry) {
|
|
282441
282394
|
if (!('kind' in claim && 'name' in claim)) {
|
282442
282395
|
lazy_loader_log(`Invalid claim file ${entry}`);
|
282443
282396
|
}
|
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
|
-
}
|
282397
|
+
LoadedClaims[`${claim.kind}-${claim.name}`] = data;
|
282398
|
+
VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
|
282399
|
+
ok();
|
282455
282400
|
});
|
282456
282401
|
});
|
282457
282402
|
}
|
@@ -282673,7 +282618,7 @@ async function loadClaims(claimsPath = config_getPath('claims')) {
|
|
282673
282618
|
await crawler_crawl(claimsPath, (entry) => {
|
282674
282619
|
return isYamlFile.test(entry);
|
282675
282620
|
}, async (entry, data) => {
|
282676
|
-
const claim =
|
282621
|
+
const claim = patchClaim(catalog_common.io.fromYaml(data), defaultsClaims);
|
282677
282622
|
if (!('kind' in claim && 'name' in claim)) {
|
282678
282623
|
throw new Error(`Invalid claim file ${entry}`);
|
282679
282624
|
}
|
@@ -282710,7 +282655,7 @@ function loadClaimDefaults() {
|
|
282710
282655
|
* - The patched claim
|
282711
282656
|
*
|
282712
282657
|
*/
|
282713
|
-
function
|
282658
|
+
function patchClaim(claim, defaultsClaims) {
|
282714
282659
|
if (defaultsClaims[claim.kind]) {
|
282715
282660
|
const jsonPatchOps = fast_json_patch.compare(claim, defaultsClaims[claim.kind])
|
282716
282661
|
.filter((jp) => {
|
@@ -282854,7 +282799,7 @@ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims'
|
|
282854
282799
|
};
|
282855
282800
|
const defaults = loadClaimDefaults();
|
282856
282801
|
for (const claimRef of claimRefList) {
|
282857
|
-
const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults,
|
282802
|
+
const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
282858
282803
|
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
282859
282804
|
}
|
282860
282805
|
const crClaimReferences = [];
|
@@ -284434,7 +284379,7 @@ class FeaturesOverrider extends OverriderPatches {
|
|
284434
284379
|
}
|
284435
284380
|
async __patches(claim, _previousCR) {
|
284436
284381
|
const featureName = this.featureName;
|
284437
|
-
const featureVersion = this.featureVersion
|
284382
|
+
const featureVersion = this.featureVersion;
|
284438
284383
|
const featureArgs = this.featureArgs;
|
284439
284384
|
const fSetUpAndRunRenderer = function (cr) {
|
284440
284385
|
return this.setUpAndRunRenderer(cr);
|