@firestartr/cli 1.56.1-snapshot-6 → 1.56.1-snapshot-7

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
@@ -366279,15 +366279,11 @@ class Decanter {
366279
366279
  get github() {
366280
366280
  return this._github;
366281
366281
  }
366282
- get postRenderFunctions() {
366283
- return this._postRenderFunctions;
366284
- }
366285
366282
  constructor(data) {
366286
366283
  this.data = {};
366287
366284
  this.initializerInstances = [];
366288
366285
  this.claim = {};
366289
366286
  this.deps = {};
366290
- this._postRenderFunctions = [];
366291
366287
  this._github = github_0;
366292
366288
  this.data = data;
366293
366289
  }
@@ -366301,14 +366297,10 @@ class Decanter {
366301
366297
  return new ImportInitializer();
366302
366298
  }
366303
366299
  __patchClaim(patch) {
366304
- this.claim = fast_json_patch_default().applyPatch(this.claim, [patch]).newDocument;
366305
- }
366306
- __patchCr(cr, patches) {
366307
- patches = Array.isArray(patches) ? patches : [patches];
366308
- return fast_json_patch_default().applyPatch(cr, patches).newDocument;
366300
+ this.claim = fast_json_patch.applyPatch(this.claim, [patch]).newDocument;
366309
366301
  }
366310
366302
  __validateEqual(a, b) {
366311
- return fast_json_patch_default().compare(a, b).length === 0;
366303
+ return fast_json_patch.compare(a, b).length === 0;
366312
366304
  }
366313
366305
  __decantStart() { }
366314
366306
  __getMethods(check) {
@@ -366358,14 +366350,6 @@ class Decanter {
366358
366350
  catalog_common.io.writeClaim(this.claim, claimsPath);
366359
366351
  return yaml;
366360
366352
  }
366361
- postRender() {
366362
- for (const method of this.__getMethods(this)) {
366363
- if (method.match(/^__postRender/) &&
366364
- typeof this[method] === 'function') {
366365
- this[method]();
366366
- }
366367
- }
366368
- }
366369
366353
  async _adapt() {
366370
366354
  const initializers = [];
366371
366355
  const overrides = [];
@@ -366386,7 +366370,6 @@ class Decanter {
366386
366370
  }
366387
366371
  const adapted = {
366388
366372
  deps: this.getDeps(),
366389
- postRenderFunctions: this.postRenderFunctions,
366390
366373
  renderClaim: {
366391
366374
  claim: this.claim,
366392
366375
  initializers,
@@ -366401,9 +366384,6 @@ class Decanter {
366401
366384
  if (!this.deps[key])
366402
366385
  this.deps[key] = { cr, secret };
366403
366386
  }
366404
- setPostRenderF(f) {
366405
- this._postRenderFunctions.push(f);
366406
- }
366407
366387
  getDeps() {
366408
366388
  return this.deps;
366409
366389
  }
@@ -366465,7 +366445,7 @@ class GroupGithubDecanter extends GithubDecanter {
366465
366445
  kind: this.claimKind,
366466
366446
  version: this.VERSION(),
366467
366447
  name: this.data.groupDetails.slug,
366468
- description: this.data.groupDetails.description || '',
366448
+ description: this.data.groupDetails.description,
366469
366449
  type: 'business-unit',
366470
366450
  };
366471
366451
  }
@@ -366520,15 +366500,6 @@ class GroupGithubDecanter extends GithubDecanter {
366520
366500
  async __adaptInitializerBase(_claim) {
366521
366501
  return await this.__loadInitializer('defaults_github_group.yaml');
366522
366502
  }
366523
- __postRenderAnnotateGithubId() {
366524
- this.setPostRenderF((cr) => {
366525
- return this.__patchCr(cr, {
366526
- op: 'add',
366527
- path: '/metadata/annotations/firestartr.dev~1github-id',
366528
- value: `${this.data.groupDetails.id}`,
366529
- });
366530
- });
366531
- }
366532
366503
  __validateKind(cr) {
366533
366504
  return true;
366534
366505
  }
@@ -367034,21 +367005,6 @@ async function importGithubGitopsRepository(org, skipPlan, claimsPath, resources
367034
367005
  previousCRs[k];
367035
367006
  }
367036
367007
  const crs = await renderCRs(data);
367037
- for (const key in crs) {
367038
- let cr = crs[key];
367039
- const claimName = cr.metadata?.annotations?.[catalog_common.generic.getFirestartrAnnotation('claim-ref')]?.split('/')[1];
367040
- const postRenderFunctions = data.postRender[`${cr.kind}-${claimName}`] || [];
367041
- let crModified = false;
367042
- for (const postRenderFunction of postRenderFunctions) {
367043
- cr = postRenderFunction(cr);
367044
- crModified = true;
367045
- }
367046
- if (crModified) {
367047
- const crPath = getCrPath(tmpRenderedCrsPath, cr);
367048
- catalog_common.io.writeYamlFile(external_path_.basename(crPath), cr, external_path_.dirname(crPath));
367049
- crs[key] = cr;
367050
- }
367051
- }
367052
367008
  await moveCRsAndClaims(crs, org, claimsPath, resourcesPath);
367053
367009
  }
367054
367010
  async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
@@ -367090,7 +367046,7 @@ function getClaimPathFromCR(claimsBasePath, cr) {
367090
367046
  FirestartrGithubRepository: 'components',
367091
367047
  FirestartrGithubMembership: 'users',
367092
367048
  };
367093
- return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], `${cr.metadata.annotations[catalog_common.generic.getFirestartrAnnotation('external-name')]}.yaml`.toLowerCase());
367049
+ return external_path_.join(claimsBasePath, `${cr.metadata.annotations[catalog_common.generic.getFirestartrAnnotation('claim-ref')]}.yaml`.toLowerCase());
367094
367050
  }
367095
367051
  function getCrPath(crsBasePath, cr) {
367096
367052
  return external_path_.join(crsBasePath, `${cr.kind}.${cr.metadata.name}.yaml`);
@@ -367104,30 +367060,24 @@ async function getDataFromKinds(org, filters = []) {
367104
367060
  ]);
367105
367061
  const renderClaims = {};
367106
367062
  const deps = {};
367107
- const postRender = {};
367108
367063
  for (const repo of data['repos']) {
367109
367064
  renderClaims[`ComponentClaim-${repo.renderClaim.claim.name}`] =
367110
367065
  repo.renderClaim;
367111
367066
  deps[`FirestartrGithubRepository-${repo.renderClaim.claim.name}`] =
367112
367067
  repo.deps;
367113
- postRender[`FirestartrGithubRepository-${repo.renderClaim.claim.name}`] =
367114
- repo.postRenderFunctions;
367115
367068
  }
367116
367069
  for (const group of data['groups']) {
367117
367070
  renderClaims[`GroupClaim-${group.renderClaim.claim.name}`] =
367118
367071
  group.renderClaim;
367119
367072
  deps[`FirestartrGithubGroup-${group.renderClaim.claim.name}`] = group.deps;
367120
- postRender[`FirestartrGithubGroup-${group.renderClaim.claim.name}`] =
367121
- group.postRenderFunctions;
367122
367073
  }
367123
367074
  for (const membership of data['memberships']) {
367124
367075
  renderClaims[`UserClaim-${membership.renderClaim.claim.name}`] =
367125
367076
  membership.renderClaim;
367126
367077
  deps[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] =
367127
367078
  membership.deps;
367128
- postRender[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] = membership.postRenderFunctions;
367129
367079
  }
367130
- return { renderClaims, deps: deps, postRender: postRender };
367080
+ return { renderClaims, deps: deps };
367131
367081
  }
367132
367082
  async function importGithubGroups(org, filters = []) {
367133
367083
  const groups = [];
@@ -367136,9 +367086,8 @@ async function importGithubGroups(org, filters = []) {
367136
367086
  for (const group of collection) {
367137
367087
  await group.gather();
367138
367088
  await group.decant();
367139
- group.render();
367140
- group.postRender();
367141
367089
  groups.push(await group.adapt());
367090
+ group.render();
367142
367091
  }
367143
367092
  return groups;
367144
367093
  }
@@ -368906,7 +368855,6 @@ var WorkStatus;
368906
368855
 
368907
368856
 
368908
368857
 
368909
-
368910
368858
  const kindsWithFinalizer = [
368911
368859
  'FirestartrDummyA',
368912
368860
  'FirestartrDummyB',
@@ -369031,9 +368979,6 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
369031
368979
  writeTerraformOutputInTfResult: writeTerraformOuputInTFResult,
369032
368980
  writeConnectionSecret: writeConnectionSecret,
369033
368981
  resolveReferences: () => resolve(workItem.item, getItemByItemPath, getSecret),
369034
- resolveOwnOutputs: () => {
369035
- return resolveSecretRef(workItem.item.metadata.namespace, workItem.item, getSecret);
369036
- },
369037
368982
  deleteSecret: () => deleteSecret(workItem.item.spec.writeConnectionSecretToRef.name, workItem.item.metadata.namespace),
369038
368983
  itemPath: () => informer_itemPath(pluralKind, workItem.item),
369039
368984
  error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
@@ -370047,12 +369992,10 @@ var lib_provider = __nccwpck_require__(85791);
370047
369992
  ;// CONCATENATED MODULE: ../provisioner/src/entities/base/Entity.ts
370048
369993
 
370049
369994
  const EXTERNAL_NAME_ANNOTATION = 'firestartr.dev/external-name';
370050
- const IMPORT_ID_ANNOTATION = 'firestartr.dev/github-id';
370051
369995
 
370052
369996
  class Metadata {
370053
- constructor(metadata, resolveOutputs) {
369997
+ constructor(metadata) {
370054
369998
  this._metadata = metadata;
370055
- this._resolveOutputs = resolveOutputs;
370056
369999
  }
370057
370000
  get name() {
370058
370001
  if (EXTERNAL_NAME_ANNOTATION in this.annotations) {
@@ -370062,56 +370005,19 @@ class Metadata {
370062
370005
  return this._metadata.name;
370063
370006
  }
370064
370007
  }
370065
- get slug() {
370066
- // we search the slug in the outputs
370067
- const slug = this._resolveOutputs('slug');
370068
- if (slug) {
370069
- // is the slug in the outputs?
370070
- return slug;
370071
- }
370072
- else {
370073
- return undefined;
370074
- }
370075
- }
370076
370008
  get annotations() {
370077
370009
  return this._metadata.annotations || {};
370078
370010
  }
370079
370011
  get labels() {
370080
370012
  return this._metadata.labels || {};
370081
370013
  }
370082
- get id() {
370083
- // we search the id in the outputs
370084
- const id = this._resolveOutputs('id');
370085
- // if we are in an import process
370086
- // there should be an id annotation
370087
- // it takes always precedence
370088
- if (IMPORT_ID_ANNOTATION in this.annotations) {
370089
- return this.annotations[IMPORT_ID_ANNOTATION];
370090
- }
370091
- else if (id) {
370092
- // is the ID in the outputs?
370093
- return id;
370094
- }
370095
- else {
370096
- return undefined;
370097
- }
370098
- }
370099
370014
  }
370100
370015
  class Entity {
370101
370016
  constructor(artifact, deps) {
370102
370017
  this.importStack = [];
370103
370018
  this.kind = artifact.kind;
370104
370019
  this.apiVersion = artifact.apiVersion;
370105
- this.metadata = new Metadata(artifact.metadata, (key) => {
370106
- if (this.deps && 'self-outputs' in this.deps) {
370107
- const cr = this.deps['self-outputs'].cr;
370108
- if (cr && typeof cr.data === 'object') {
370109
- if (key in cr.data) {
370110
- return Buffer.from(cr.data[key], 'base64').toString('utf-8');
370111
- }
370112
- }
370113
- }
370114
- });
370020
+ this.metadata = new Metadata(artifact.metadata);
370115
370021
  this.spec = artifact.spec;
370116
370022
  if (deps) {
370117
370023
  this.deps = deps;
@@ -370261,15 +370167,14 @@ function provisionPermissions(scope, repo, fsGithubRepository) {
370261
370167
  if ('ref' in permission) {
370262
370168
  const tfStateKey = `_${fsGithubRepository.getTfStateKey()}-${permission.ref.kind}-${permission.ref.name}-tr`;
370263
370169
  if (permission.ref.kind === 'FirestartrGithubGroup') {
370264
- const teamSlug = fsGithubRepository.resolveRef(permission.ref, 'slug');
370265
370170
  const teamId = fsGithubRepository.resolveRef(permission.ref, 'id');
370266
370171
  const config = {
370267
370172
  repository: repo.name,
370268
- teamId: teamId,
370173
+ teamId,
370269
370174
  permission: permission.role,
370270
370175
  };
370271
370176
  const teamsRepository = new team_repository/* TeamRepository */.C(scope, tfStateKey, config);
370272
- fsGithubRepository.addResourceToStack(`${teamSlug}:${fsGithubRepository.metadata.name}`, teamsRepository);
370177
+ fsGithubRepository.addResourceToStack(`${teamId}:${fsGithubRepository.metadata.name}`, teamsRepository);
370273
370178
  }
370274
370179
  else if (permission.ref.kind === 'FirestartrGithubMembership') {
370275
370180
  const username = fsGithubRepository.resolveRef(permission.ref);
@@ -370629,7 +370534,7 @@ function provisionGroup(scope, fsGithubGroup) {
370629
370534
  };
370630
370535
  const tfStateKey = `_${fsGithubGroup.getTfStateKey()}`;
370631
370536
  const group = new lib_team/* Team */.S(scope, tfStateKey, config);
370632
- fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.id || fsGithubGroup.metadata.name, group);
370537
+ fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.name, group);
370633
370538
  return group;
370634
370539
  }
370635
370540
 
@@ -370641,17 +370546,16 @@ function provisionMembers(scope, team, fsGithubGroup) {
370641
370546
  for (const member of fsGithubGroup.spec.members) {
370642
370547
  provisioner_src_logger.info(`Provisioning user ${member.ref.name} for group ${fsGithubGroup.metadata.name}`);
370643
370548
  const tfStateKey = `_${fsGithubGroup.getTfStateKey()}-${member.ref.kind}-${member.ref.name}-tr`;
370644
- const teamId = team.id || fsGithubGroup.metadata.id;
370645
370549
  if (member.ref.kind === 'FirestartrGithubMembership') {
370646
370550
  const username = fsGithubGroup.resolveRef(member.ref);
370647
370551
  const config = {
370648
370552
  dependsOn: [team],
370649
370553
  username,
370650
- teamId: teamId,
370554
+ teamId: team.id,
370651
370555
  role: member.role,
370652
370556
  };
370653
370557
  const membership = new team_membership/* TeamMembership */.E(scope, tfStateKey, config);
370654
- fsGithubGroup.addResourceToStack(`${teamId}:${username}`, membership);
370558
+ fsGithubGroup.addResourceToStack(`${team.id}:${username}`, membership);
370655
370559
  }
370656
370560
  }
370657
370561
  }
@@ -372532,10 +372436,7 @@ async function* doApply(item, op, handler) {
372532
372436
  opts['create'] = true;
372533
372437
  }
372534
372438
  const deps = await handler.resolveReferences();
372535
- deps['self-outputs'] = {
372536
- cr: await handler.resolveOwnOutputs(),
372537
- };
372538
- operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${Object.keys(deps)}`);
372439
+ operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${deps}`);
372539
372440
  const annotation = 'firestartr.dev/last-state-pr';
372540
372441
  const statePr = item?.metadata?.annotations?.[annotation];
372541
372442
  const hasStatePr = typeof statePr === 'string' && statePr.trim().length > 0;
@@ -376451,7 +376352,7 @@ const crs_analyzerSubcommand = {
376451
376352
  };
376452
376353
 
376453
376354
  ;// CONCATENATED MODULE: ./package.json
376454
- const package_namespaceObject = JSON.parse('{"i8":"1.56.1-snapshot-6"}');
376355
+ const package_namespaceObject = JSON.parse('{"i8":"1.56.1-snapshot-7"}');
376455
376356
  ;// CONCATENATED MODULE: ../../package.json
376456
376357
  const package_namespaceObject_1 = {"i8":"1.56.0"};
376457
376358
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
@@ -1,6 +1,6 @@
1
1
  import { importGithubGitopsRepository } from './src/decanter';
2
- import type { CollectionFilter } from './src/decanter/collections';
3
- export type { CollectionFilter };
2
+ import { CollectionFilter } from './src/decanter/collections';
3
+ export { CollectionFilter };
4
4
  declare const _default: {
5
5
  importGithubGitopsRepository: typeof importGithubGitopsRepository;
6
6
  };
@@ -11,17 +11,14 @@ export default class Decanter {
11
11
  secret: any;
12
12
  };
13
13
  };
14
- _postRenderFunctions: Function[];
15
14
  _github: any;
16
15
  set github(githubInstance: any);
17
16
  get github(): any;
18
- get postRenderFunctions(): Function[];
19
17
  constructor(data: any);
20
18
  __adaptInitializerTfStateKey(): Promise<UUIDInitializer>;
21
19
  __adaptInitializerClaimRef(): Promise<InitializerClaimRef>;
22
20
  __adaptInitializerImport(): Promise<ImportInitializer>;
23
21
  __patchClaim(patch: any): void;
24
- __patchCr(cr: any, patches: any): any;
25
22
  __validateEqual(a: any, b: any): boolean;
26
23
  __decantStart(): void;
27
24
  __getMethods(check: any): any[];
@@ -33,7 +30,6 @@ export default class Decanter {
33
30
  secret: any;
34
31
  };
35
32
  };
36
- postRenderFunctions: Function[];
37
33
  renderClaim: {
38
34
  claim: any;
39
35
  initializers: any[];
@@ -44,7 +40,6 @@ export default class Decanter {
44
40
  }>;
45
41
  validateCR(cr: any): boolean;
46
42
  render(): string;
47
- postRender(): void;
48
43
  _adapt(): Promise<{
49
44
  deps: {
50
45
  [key: string]: {
@@ -52,7 +47,6 @@ export default class Decanter {
52
47
  secret: any;
53
48
  };
54
49
  };
55
- postRenderFunctions: Function[];
56
50
  renderClaim: {
57
51
  claim: any;
58
52
  initializers: any[];
@@ -62,7 +56,6 @@ export default class Decanter {
62
56
  };
63
57
  }>;
64
58
  setDep(key: string, cr: any, secret: any): void;
65
- setPostRenderF(f: Function): void;
66
59
  getDeps(): {
67
60
  [key: string]: {
68
61
  cr: any;
@@ -77,7 +70,6 @@ export default class Decanter {
77
70
  secret: any;
78
71
  };
79
72
  };
80
- postRenderFunctions: Function[];
81
73
  renderClaim: {
82
74
  claim: any;
83
75
  initializers: any[];
@@ -1,5 +1,5 @@
1
- export type { CollectionFilter } from './filters';
2
1
  export declare function applyCollectionMixins(derivedCtor: any): void;
2
+ export { CollectionFilter } from './filters';
3
3
  export declare class CollectionMixins {
4
4
  IS_FILTER_BY_NAME_SET(filters: any[], kind: string): boolean;
5
5
  IS_SKIP_SET(filters: any[], kind: string): boolean;
@@ -10,7 +10,6 @@ export default class GroupGithubDecanter extends GithubDecanter {
10
10
  __gatherMembers(): Promise<void>;
11
11
  __validateMembers(cr: any): Promise<boolean>;
12
12
  __adaptInitializerBase(_claim: any): Promise<InitializerDefault>;
13
- __postRenderAnnotateGithubId(): void;
14
13
  __validateKind(cr: any): boolean;
15
14
  KO__validateKind(): void;
16
15
  }
@@ -1,5 +1,5 @@
1
- export type { CollectionFilter } from './collections';
2
- import type { CollectionFilter } from './collections';
1
+ export { CollectionFilter } from './collections';
2
+ import { CollectionFilter } from './collections';
3
3
  import GroupCollectionGithubDecanter from './gh/github_group_collection';
4
4
  import MemberCollectionGithubDecanter from './gh/github_member_collection';
5
5
  import RepoCollectionGithubDecanter from './gh/github_repo_collection';
@@ -42,7 +42,6 @@ export type WorkItemHandler = {
42
42
  writeTerraformOutputInTfResult: WriteTerraformOutputInTfResultFn;
43
43
  writeConnectionSecret: WriteConnectionSecretFn;
44
44
  resolveReferences: ResolveReferencesFn;
45
- resolveOwnOutputs: () => Promise<any | undefined>;
46
45
  deleteSecret: DeleteSecretFn;
47
46
  itemPath: ItemPathFn;
48
47
  error: ErrorFn;
@@ -2,13 +2,10 @@ import { Construct } from 'constructs';
2
2
  import { TerraformModule, TerraformResource } from 'cdktf';
3
3
  declare class Metadata {
4
4
  _metadata: any;
5
- _resolveOutputs: Function;
6
- constructor(metadata: any, resolveOutputs: Function);
5
+ constructor(metadata: any);
7
6
  get name(): any;
8
- get slug(): any;
9
7
  get annotations(): any;
10
8
  get labels(): any;
11
- get id(): any;
12
9
  }
13
10
  export declare abstract class Entity {
14
11
  kind: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.56.1-snapshot-6",
3
+ "version": "1.56.1-snapshot-7",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",