@firestartr/cli 1.41.0 → 1.41.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
CHANGED
@@ -285862,8 +285862,44 @@ const SCHEMAS_BY_INITIALIZER_NAME = {
|
|
285862
285862
|
};
|
285863
285863
|
|
285864
285864
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/virtual/index.ts
|
285865
|
+
const PRECALCULATED_VIRTUAL_CLAIMS = {};
|
285866
|
+
function initVirtualClaims(org) {
|
285867
|
+
if (Object.keys(PRECALCULATED_VIRTUAL_CLAIMS).length !== 0)
|
285868
|
+
return;
|
285869
|
+
PRECALCULATED_VIRTUAL_CLAIMS[`GroupClaim-${org}-all`] = FirestartrAllClaim;
|
285870
|
+
}
|
285871
|
+
function isVirtualClaim(kind, name) {
|
285872
|
+
return (Object.keys(PRECALCULATED_VIRTUAL_CLAIMS).indexOf(`${kind}-${name}`) !== -1);
|
285873
|
+
}
|
285874
|
+
function getVirtualClaim(kind, name) {
|
285875
|
+
if (Object.keys(PRECALCULATED_VIRTUAL_CLAIMS).indexOf(`${kind}-${name}`) !== -1) {
|
285876
|
+
return new PRECALCULATED_VIRTUAL_CLAIMS[`${kind}-${name}`]();
|
285877
|
+
}
|
285878
|
+
return null;
|
285879
|
+
}
|
285865
285880
|
class FirestartrAllClaim {
|
285866
|
-
|
285881
|
+
constructor() {
|
285882
|
+
this.DEFAULT_CONFIG = {
|
285883
|
+
kind: 'FirestartrGithubGroup',
|
285884
|
+
defaultValues: {
|
285885
|
+
context: {
|
285886
|
+
backend: {
|
285887
|
+
ref: {
|
285888
|
+
kind: 'FirestartrProviderConfig',
|
285889
|
+
name: 'firestartr-terraform-state',
|
285890
|
+
},
|
285891
|
+
},
|
285892
|
+
provider: {
|
285893
|
+
ref: {
|
285894
|
+
kind: 'FirestartrProviderConfig',
|
285895
|
+
name: 'github-app',
|
285896
|
+
},
|
285897
|
+
},
|
285898
|
+
},
|
285899
|
+
},
|
285900
|
+
};
|
285901
|
+
}
|
285902
|
+
async expand(config = {}) {
|
285867
285903
|
const { org } = config;
|
285868
285904
|
const groupClaim = {
|
285869
285905
|
kind: 'GroupClaim',
|
@@ -285908,6 +285944,9 @@ class FirestartrAllClaim {
|
|
285908
285944
|
return `user:${renderClaimData.claim.name}`;
|
285909
285945
|
});
|
285910
285946
|
}
|
285947
|
+
getDefaultConfig() {
|
285948
|
+
return this.DEFAULT_CONFIG;
|
285949
|
+
}
|
285911
285950
|
}
|
285912
285951
|
|
285913
285952
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/schemas/root.schema.ts
|
@@ -287268,24 +287307,32 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
|
|
287268
287307
|
|
287269
287308
|
|
287270
287309
|
|
287310
|
+
|
287311
|
+
|
287312
|
+
|
287313
|
+
|
287314
|
+
|
287271
287315
|
const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
|
287272
|
-
async function loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
287316
|
+
async function loadClaim(claimRef, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
|
287273
287317
|
let result = existingRefs;
|
287318
|
+
initVirtualClaims(org);
|
287274
287319
|
// cargas datos con grep
|
287275
|
-
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), cwd);
|
287320
|
+
const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
|
287276
287321
|
const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
|
287277
287322
|
result[claimRef] = {};
|
287278
287323
|
result[claimRef]['claim'] = claim;
|
287279
287324
|
result[claimRef]['claimPath'] = VisitedClaims[claimRef];
|
287280
|
-
|
287281
|
-
|
287282
|
-
|
287283
|
-
|
287325
|
+
if (VisitedClaims[claimRef] === 'virtual') {
|
287326
|
+
result = await setVirtualClaimAdditionalData(result, claim, claimRef);
|
287327
|
+
}
|
287328
|
+
else {
|
287329
|
+
result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
|
287330
|
+
}
|
287284
287331
|
const claimKind = claim.kind;
|
287285
|
-
const references = extractAllRefs(
|
287332
|
+
const references = extractAllRefs(catalog_common.io.toYaml(claim));
|
287286
287333
|
for (const ref of references) {
|
287287
287334
|
if (!result[ref]) {
|
287288
|
-
const resolvedReferences = await loadClaim(ref, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
287335
|
+
const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
|
287289
287336
|
result = lodash_default().merge(result, resolvedReferences);
|
287290
287337
|
}
|
287291
287338
|
}
|
@@ -287293,11 +287340,16 @@ async function loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadG
|
|
287293
287340
|
}
|
287294
287341
|
const LoadedClaims = {};
|
287295
287342
|
const VisitedClaims = {};
|
287296
|
-
async function lazyGetClaim(kind, name, cwd) {
|
287343
|
+
async function lazyGetClaim(kind, name, org, cwd) {
|
287297
287344
|
const indice = `${kind}-${name}`;
|
287298
287345
|
if (indice in LoadedClaims)
|
287299
287346
|
return LoadedClaims[indice];
|
287300
|
-
|
287347
|
+
if (isVirtualClaim(kind, name)) {
|
287348
|
+
await loadVirtualClaim(kind, name, org);
|
287349
|
+
}
|
287350
|
+
else {
|
287351
|
+
await getClaimsByName(name, cwd);
|
287352
|
+
}
|
287301
287353
|
if (indice in LoadedClaims) {
|
287302
287354
|
return LoadedClaims[indice];
|
287303
287355
|
}
|
@@ -287356,6 +287408,31 @@ async function loadRawClaim(entry) {
|
|
287356
287408
|
});
|
287357
287409
|
});
|
287358
287410
|
}
|
287411
|
+
async function setVirtualClaimAdditionalData(renderedData, claim, claimRef) {
|
287412
|
+
const virtualClaim = getVirtualClaim(claim.kind, claim.name);
|
287413
|
+
renderedData[claimRef]['initializers'] = [
|
287414
|
+
new UUIDInitializer(claim),
|
287415
|
+
new InitializerClaimRef(),
|
287416
|
+
new InitializerDefault(virtualClaim.getDefaultConfig()),
|
287417
|
+
];
|
287418
|
+
renderedData[claimRef]['globals'] = [];
|
287419
|
+
renderedData[claimRef]['overrides'] = [];
|
287420
|
+
renderedData[claimRef]['normalizers'] = [new NameNormalizer()];
|
287421
|
+
return renderedData;
|
287422
|
+
}
|
287423
|
+
async function setNonVirtualClaimAdditionalData(renderedData, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers) {
|
287424
|
+
renderedData[claimRef]['initializers'] = await loadInitializers(claim);
|
287425
|
+
renderedData[claimRef]['globals'] = await loadGlobals(claim);
|
287426
|
+
renderedData[claimRef]['overrides'] = loadOverrides(claim);
|
287427
|
+
renderedData[claimRef]['normalizers'] = await loadNormalizers(claim, renderedData[claimRef]['claimPath']);
|
287428
|
+
return renderedData;
|
287429
|
+
}
|
287430
|
+
async function loadVirtualClaim(kind, name, org) {
|
287431
|
+
const virtualClaim = getVirtualClaim(kind, name);
|
287432
|
+
const expandedClaim = await virtualClaim.expand({ org });
|
287433
|
+
LoadedClaims[`${kind}-${name}`] = catalog_common.io.toYaml(expandedClaim);
|
287434
|
+
VisitedClaims[`${kind}-${name}`] = 'virtual';
|
287435
|
+
}
|
287359
287436
|
|
287360
287437
|
;// CONCATENATED MODULE: ../cdk8s_renderer/src/loader/loader.ts
|
287361
287438
|
|
@@ -287697,26 +287774,10 @@ async function loadAll() {
|
|
287697
287774
|
})
|
287698
287775
|
.then(async () => {
|
287699
287776
|
for (const virtualClaim of virtualClaims) {
|
287700
|
-
const expandedClaim = await virtualClaim.expand(
|
287701
|
-
|
287702
|
-
|
287703
|
-
|
287704
|
-
context: {
|
287705
|
-
backend: {
|
287706
|
-
ref: {
|
287707
|
-
kind: 'FirestartrProviderConfig',
|
287708
|
-
name: 'firestartr-terraform-state',
|
287709
|
-
},
|
287710
|
-
},
|
287711
|
-
provider: {
|
287712
|
-
ref: {
|
287713
|
-
kind: 'FirestartrProviderConfig',
|
287714
|
-
name: 'github-app',
|
287715
|
-
},
|
287716
|
-
},
|
287717
|
-
},
|
287718
|
-
},
|
287719
|
-
};
|
287777
|
+
const expandedClaim = await virtualClaim.expand({
|
287778
|
+
org: getOrg(),
|
287779
|
+
});
|
287780
|
+
const defaultConfig = virtualClaim.getDefaultConfig();
|
287720
287781
|
const renderClaim = {
|
287721
287782
|
claim: expandedClaim,
|
287722
287783
|
claimPath: 'virtual',
|
@@ -287745,7 +287806,7 @@ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims'
|
|
287745
287806
|
};
|
287746
287807
|
const defaults = loadClaimDefaults();
|
287747
287808
|
for (const claimRef of claimRefList) {
|
287748
|
-
const renderedClaimData = await loadClaim(claimRef, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
287809
|
+
const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
|
287749
287810
|
data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
|
287750
287811
|
}
|
287751
287812
|
const crClaimReferences = [];
|
@@ -1,9 +1,15 @@
|
|
1
1
|
import { RenderClaims } from '../../renderer/types';
|
2
2
|
import { IClaim } from '../base';
|
3
|
+
export declare function initVirtualClaims(org: string): void;
|
4
|
+
export declare function isVirtualClaim(kind: string, name: string): boolean;
|
5
|
+
export declare function getVirtualClaim(kind: string, name: string): any;
|
3
6
|
export interface IVirtualClaim {
|
4
|
-
expand(
|
7
|
+
expand(config?: any): Promise<IClaim>;
|
8
|
+
getDefaultConfig(): any;
|
5
9
|
}
|
6
10
|
export declare class FirestartrAllClaim implements IVirtualClaim {
|
7
|
-
|
11
|
+
DEFAULT_CONFIG: any;
|
12
|
+
expand(config?: any): Promise<IClaim>;
|
8
13
|
expandMembers(renderClaims: RenderClaims): string[];
|
14
|
+
getDefaultConfig(): any;
|
9
15
|
}
|
@@ -2,4 +2,4 @@ import { InitializerPatches } from '../initializers/base';
|
|
2
2
|
import { GlobalSection } from '../globals/base';
|
3
3
|
import { OverriderPatches } from '../overriders/base';
|
4
4
|
import { Normalizer } from '../normalizers/base';
|
5
|
-
export declare function loadClaim(claimRef: string, defaults: any, patchClaim: (claim: any, defaults: any) => any, loadInitializers: (claim: any) => Promise<InitializerPatches[]>, loadGlobals: (claim: any) => Promise<GlobalSection[]>, loadOverrides: (claim: any) => OverriderPatches[], loadNormalizers: (claim: any, path: string) => Promise<Normalizer[]>, cwd?: string, existingRefs?: any): Promise<any>;
|
5
|
+
export declare function loadClaim(claimRef: string, org: string, defaults: any, patchClaim: (claim: any, defaults: any) => any, loadInitializers: (claim: any) => Promise<InitializerPatches[]>, loadGlobals: (claim: any) => Promise<GlobalSection[]>, loadOverrides: (claim: any) => OverriderPatches[], loadNormalizers: (claim: any, path: string) => Promise<Normalizer[]>, cwd?: string, existingRefs?: any): Promise<any>;
|
@@ -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;
|