@firestartr/cli 1.43.2-snapshot2 → 1.43.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
CHANGED
@@ -282292,44 +282292,92 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
282292
282292
|
|
282293
282293
|
|
282294
282294
|
|
282295
|
+
|
282296
|
+
|
282295
282297
|
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
282296
|
-
|
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
|
+
async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
282334
|
+
await checkGrep();
|
282297
282335
|
let result = existingRefs;
|
282298
282336
|
lazy_loader_log(`Load reference ${claimRef}`);
|
282299
282337
|
initVirtualClaims(org);
|
282300
282338
|
lazy_loader_log(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
|
282301
282339
|
// cargas datos con grep
|
282302
|
-
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
282303
|
-
// const claim: any = patchClaim(common.io.fromYaml(claimData), defaults);
|
282304
|
-
const claim = catalog_common.io.fromYaml(claimData);
|
282305
282340
|
try {
|
282306
|
-
|
282307
|
-
|
282308
|
-
|
282309
|
-
|
282310
|
-
|
282311
|
-
}
|
282312
|
-
result[claimRef] = {};
|
282313
|
-
result[claimRef]['claim'] = claim;
|
282314
|
-
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
282315
|
-
if (VisitedClaims[claimRef] === 'virtual') {
|
282316
|
-
result = await setVirtualClaimAdditionalData(result, claim, claimRef);
|
282317
|
-
}
|
282318
|
-
else {
|
282319
|
-
result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
|
282320
|
-
}
|
282321
|
-
const claimKind = claim.kind;
|
282322
|
-
const references = extractAllRefs(catalog_common.io.toYaml(claim));
|
282323
|
-
for (const ref of references) {
|
282324
|
-
if (!result[ref]) {
|
282325
|
-
const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
282326
|
-
result = lodash_default().merge(result, resolvedReferences);
|
282341
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
282342
|
+
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
282343
|
+
try {
|
282344
|
+
validateClaim(claim, base[`${claim.kind}Schema`]);
|
282345
|
+
await optionalValidation(claim);
|
282327
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
|
+
}
|
282372
|
+
}
|
282373
|
+
catch (err) {
|
282374
|
+
throw `Lazy Loading: ${err}`;
|
282328
282375
|
}
|
282329
282376
|
return result;
|
282330
282377
|
}
|
282331
282378
|
const LoadedClaims = {};
|
282332
282379
|
const VisitedClaims = {};
|
282380
|
+
const DuplicatedClaims = {};
|
282333
282381
|
async function lazyGetClaim(kind, name, org, cwd) {
|
282334
282382
|
const indice = `${kind}-${name}`;
|
282335
282383
|
lazy_loader_log(`Lazy loading ${kind}-${name} with index ${indice}`);
|
@@ -282372,14 +282420,14 @@ async function getClaimsByName(name, cwd = '.') {
|
|
282372
282420
|
}
|
282373
282421
|
});
|
282374
282422
|
handler.on('close', () => {
|
282375
|
-
Promise.all(entradas.map((entrada) => {
|
282423
|
+
return Promise.all(entradas.map((entrada) => {
|
282376
282424
|
return loadRawClaim(entrada);
|
282377
282425
|
}))
|
282378
282426
|
.then(() => {
|
282379
282427
|
ok();
|
282380
282428
|
})
|
282381
|
-
.catch(() => {
|
282382
|
-
ko();
|
282429
|
+
.catch((err) => {
|
282430
|
+
ko(err);
|
282383
282431
|
});
|
282384
282432
|
});
|
282385
282433
|
});
|
@@ -282393,9 +282441,17 @@ async function loadRawClaim(entry) {
|
|
282393
282441
|
if (!('kind' in claim && 'name' in claim)) {
|
282394
282442
|
lazy_loader_log(`Invalid claim file ${entry}`);
|
282395
282443
|
}
|
282396
|
-
|
282397
|
-
|
282398
|
-
|
282444
|
+
else {
|
282445
|
+
const claimKey = `${claim.kind}-${claim.name}`;
|
282446
|
+
if (Object.keys(DuplicatedClaims).includes(claimKey) &&
|
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
|
+
}
|
282399
282455
|
});
|
282400
282456
|
});
|
282401
282457
|
}
|
@@ -282617,7 +282673,7 @@ async function loadClaims(claimsPath = config_getPath('claims')) {
|
|
282617
282673
|
await crawler_crawl(claimsPath, (entry) => {
|
282618
282674
|
return isYamlFile.test(entry);
|
282619
282675
|
}, async (entry, data) => {
|
282620
|
-
const claim =
|
282676
|
+
const claim = loader_patchClaim(catalog_common.io.fromYaml(data), defaultsClaims);
|
282621
282677
|
if (!('kind' in claim && 'name' in claim)) {
|
282622
282678
|
throw new Error(`Invalid claim file ${entry}`);
|
282623
282679
|
}
|
@@ -282654,7 +282710,7 @@ function loadClaimDefaults() {
|
|
282654
282710
|
* - The patched claim
|
282655
282711
|
*
|
282656
282712
|
*/
|
282657
|
-
function
|
282713
|
+
function loader_patchClaim(claim, defaultsClaims) {
|
282658
282714
|
if (defaultsClaims[claim.kind]) {
|
282659
282715
|
const jsonPatchOps = fast_json_patch.compare(claim, defaultsClaims[claim.kind])
|
282660
282716
|
.filter((jp) => {
|
@@ -282798,7 +282854,7 @@ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims'
|
|
282798
282854
|
};
|
282799
282855
|
const defaults = loadClaimDefaults();
|
282800
282856
|
for (const claimRef of claimRefList) {
|
282801
|
-
const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults,
|
282857
|
+
const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
282802
282858
|
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
282803
282859
|
}
|
282804
282860
|
const crClaimReferences = [];
|
@@ -284378,7 +284434,7 @@ class FeaturesOverrider extends OverriderPatches {
|
|
284378
284434
|
}
|
284379
284435
|
async __patches(claim, _previousCR) {
|
284380
284436
|
const featureName = this.featureName;
|
284381
|
-
const featureVersion = this.featureVersion;
|
284437
|
+
const featureVersion = this.featureVersion || this.featureRef;
|
284382
284438
|
const featureArgs = this.featureArgs;
|
284383
284439
|
const fSetUpAndRunRenderer = function (cr) {
|
284384
284440
|
return this.setUpAndRunRenderer(cr);
|
@@ -428,7 +428,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
|
|
428
428
|
verified_at: string;
|
429
429
|
};
|
430
430
|
};
|
431
|
-
author:
|
431
|
+
author: {
|
432
432
|
name?: string;
|
433
433
|
email?: string;
|
434
434
|
login: string;
|
@@ -451,8 +451,8 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
|
|
451
451
|
site_admin: boolean;
|
452
452
|
starred_at?: string;
|
453
453
|
user_view_type?: string;
|
454
|
-
}
|
455
|
-
committer:
|
454
|
+
} | Record<string, never>;
|
455
|
+
committer: {
|
456
456
|
name?: string;
|
457
457
|
email?: string;
|
458
458
|
login: string;
|
@@ -475,7 +475,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
|
|
475
475
|
site_admin: boolean;
|
476
476
|
starred_at?: string;
|
477
477
|
user_view_type?: string;
|
478
|
-
}
|
478
|
+
} | Record<string, never>;
|
479
479
|
parents: {
|
480
480
|
sha: string;
|
481
481
|
url: string;
|