@firestartr/cli 1.55.1-snapshot-5 → 1.56.0

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
@@ -366252,15 +366252,11 @@ class Decanter {
366252
366252
  get github() {
366253
366253
  return this._github;
366254
366254
  }
366255
- get postRenderFunctions() {
366256
- return this._postRenderFunctions;
366257
- }
366258
366255
  constructor(data) {
366259
366256
  this.data = {};
366260
366257
  this.initializerInstances = [];
366261
366258
  this.claim = {};
366262
366259
  this.deps = {};
366263
- this._postRenderFunctions = [];
366264
366260
  this._github = github_0;
366265
366261
  this.data = data;
366266
366262
  }
@@ -366274,14 +366270,10 @@ class Decanter {
366274
366270
  return new ImportInitializer();
366275
366271
  }
366276
366272
  __patchClaim(patch) {
366277
- this.claim = fast_json_patch_default().applyPatch(this.claim, [patch]).newDocument;
366278
- }
366279
- __patchCr(cr, patches) {
366280
- patches = Array.isArray(patches) ? patches : [patches];
366281
- return fast_json_patch_default().applyPatch(cr, patches).newDocument;
366273
+ this.claim = fast_json_patch.applyPatch(this.claim, [patch]).newDocument;
366282
366274
  }
366283
366275
  __validateEqual(a, b) {
366284
- return fast_json_patch_default().compare(a, b).length === 0;
366276
+ return fast_json_patch.compare(a, b).length === 0;
366285
366277
  }
366286
366278
  __decantStart() { }
366287
366279
  __getMethods(check) {
@@ -366331,14 +366323,6 @@ class Decanter {
366331
366323
  catalog_common.io.writeClaim(this.claim, claimsPath);
366332
366324
  return yaml;
366333
366325
  }
366334
- postRender() {
366335
- for (const method of this.__getMethods(this)) {
366336
- if (method.match(/^__postRender/) &&
366337
- typeof this[method] === 'function') {
366338
- this[method]();
366339
- }
366340
- }
366341
- }
366342
366326
  async _adapt() {
366343
366327
  const initializers = [];
366344
366328
  const overrides = [];
@@ -366359,7 +366343,6 @@ class Decanter {
366359
366343
  }
366360
366344
  const adapted = {
366361
366345
  deps: this.getDeps(),
366362
- postRenderFunctions: this.postRenderFunctions,
366363
366346
  renderClaim: {
366364
366347
  claim: this.claim,
366365
366348
  initializers,
@@ -366374,9 +366357,6 @@ class Decanter {
366374
366357
  if (!this.deps[key])
366375
366358
  this.deps[key] = { cr, secret };
366376
366359
  }
366377
- setPostRenderF(f) {
366378
- this._postRenderFunctions.push(f);
366379
- }
366380
366360
  getDeps() {
366381
366361
  return this.deps;
366382
366362
  }
@@ -366493,15 +366473,6 @@ class GroupGithubDecanter extends GithubDecanter {
366493
366473
  async __adaptInitializerBase(_claim) {
366494
366474
  return await this.__loadInitializer('defaults_github_group.yaml');
366495
366475
  }
366496
- __postRenderAnnotateGithubId() {
366497
- this.setPostRenderF((cr) => {
366498
- return this.__patchCr(cr, {
366499
- op: 'add',
366500
- path: '/metadata/annotations/firestartr.dev~1github-id',
366501
- value: `${this.data.groupDetails.id}`,
366502
- });
366503
- });
366504
- }
366505
366476
  __validateKind(cr) {
366506
366477
  return true;
366507
366478
  }
@@ -367007,12 +366978,6 @@ async function importGithubGitopsRepository(org, skipPlan, claimsPath, resources
367007
366978
  previousCRs[k];
367008
366979
  }
367009
366980
  const crs = await renderCRs(data);
367010
- Object.values(crs).forEach((cr) => {
367011
- const claimName = cr.metadata.labels['claim-ref'];
367012
- for (const postRenderFunction of data.postRender[`${cr.kind}-${claimName}`]) {
367013
- cr = postRenderFunction(cr);
367014
- }
367015
- });
367016
366981
  await moveCRsAndClaims(crs, org, claimsPath, resourcesPath);
367017
366982
  }
367018
366983
  async function moveCRsAndClaims(crs, org, claimsPath, resourcesPath) {
@@ -367068,30 +367033,24 @@ async function getDataFromKinds(org, filters = []) {
367068
367033
  ]);
367069
367034
  const renderClaims = {};
367070
367035
  const deps = {};
367071
- const postRender = {};
367072
367036
  for (const repo of data['repos']) {
367073
367037
  renderClaims[`ComponentClaim-${repo.renderClaim.claim.name}`] =
367074
367038
  repo.renderClaim;
367075
367039
  deps[`FirestartrGithubRepository-${repo.renderClaim.claim.name}`] =
367076
367040
  repo.deps;
367077
- postRender[`FirestartrGithubRepository-${repo.renderClaim.claim.name}`] =
367078
- repo.postRenderFunctions;
367079
367041
  }
367080
367042
  for (const group of data['groups']) {
367081
367043
  renderClaims[`GroupClaim-${group.renderClaim.claim.name}`] =
367082
367044
  group.renderClaim;
367083
367045
  deps[`FirestartrGithubGroup-${group.renderClaim.claim.name}`] = group.deps;
367084
- postRender[`FirestartrGithubGroup-${group.renderClaim.claim.name}`] =
367085
- group.postRenderFunctions;
367086
367046
  }
367087
367047
  for (const membership of data['memberships']) {
367088
367048
  renderClaims[`UserClaim-${membership.renderClaim.claim.name}`] =
367089
367049
  membership.renderClaim;
367090
367050
  deps[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] =
367091
367051
  membership.deps;
367092
- postRender[`FirestartrGithubMembership-${membership.renderClaim.claim.name}`] = membership.postRenderFunctions;
367093
367052
  }
367094
- return { renderClaims, deps: deps, postRender: postRender };
367053
+ return { renderClaims, deps: deps };
367095
367054
  }
367096
367055
  async function importGithubGroups(org, filters = []) {
367097
367056
  const groups = [];
@@ -367102,7 +367061,6 @@ async function importGithubGroups(org, filters = []) {
367102
367061
  await group.decant();
367103
367062
  groups.push(await group.adapt());
367104
367063
  group.render();
367105
- group.postRender();
367106
367064
  }
367107
367065
  return groups;
367108
367066
  }
@@ -368870,7 +368828,6 @@ var WorkStatus;
368870
368828
 
368871
368829
 
368872
368830
 
368873
-
368874
368831
  const kindsWithFinalizer = [
368875
368832
  'FirestartrDummyA',
368876
368833
  'FirestartrDummyB',
@@ -368995,9 +368952,6 @@ function enqueue(pluralKind, workItem, queue, compute, syncCtl, retryCtl) {
368995
368952
  writeTerraformOutputInTfResult: writeTerraformOuputInTFResult,
368996
368953
  writeConnectionSecret: writeConnectionSecret,
368997
368954
  resolveReferences: () => resolve(workItem.item, getItemByItemPath, getSecret),
368998
- resolveOwnOutputs: () => {
368999
- return resolveSecretRef(workItem.item.metadata.namespace, workItem.item, getSecret);
369000
- },
369001
368955
  deleteSecret: () => deleteSecret(workItem.item.spec.writeConnectionSecretToRef.name, workItem.item.metadata.namespace),
369002
368956
  itemPath: () => informer_itemPath(pluralKind, workItem.item),
369003
368957
  error: () => retryCtl.errorReconciling(informer_itemPath(pluralKind, workItem.item)),
@@ -370011,13 +369965,10 @@ var lib_provider = __nccwpck_require__(85791);
370011
369965
  ;// CONCATENATED MODULE: ../provisioner/src/entities/base/Entity.ts
370012
369966
 
370013
369967
  const EXTERNAL_NAME_ANNOTATION = 'firestartr.dev/external-name';
370014
- const IMPORT_SLUG_ANNOTATION = 'firestartr.dev/github-slug';
370015
- const IMPORT_ID_ANNOTATION = 'firestartr.dev/github-id';
370016
369968
 
370017
369969
  class Metadata {
370018
- constructor(metadata, resolveOutputs) {
369970
+ constructor(metadata) {
370019
369971
  this._metadata = metadata;
370020
- this._resolveOutputs = resolveOutputs;
370021
369972
  }
370022
369973
  get name() {
370023
369974
  if (EXTERNAL_NAME_ANNOTATION in this.annotations) {
@@ -370027,56 +369978,19 @@ class Metadata {
370027
369978
  return this._metadata.name;
370028
369979
  }
370029
369980
  }
370030
- get slug() {
370031
- // buscar el slug en los outputs
370032
- const slug = this._resolveOutputs('slug');
370033
- if (IMPORT_SLUG_ANNOTATION in this.annotations) {
370034
- return this.annotations[IMPORT_SLUG_ANNOTATION];
370035
- }
370036
- else if (slug) {
370037
- // hay outputs?
370038
- return slug;
370039
- }
370040
- else {
370041
- return undefined;
370042
- }
370043
- }
370044
369981
  get annotations() {
370045
369982
  return this._metadata.annotations || {};
370046
369983
  }
370047
369984
  get labels() {
370048
369985
  return this._metadata.labels || {};
370049
369986
  }
370050
- get id() {
370051
- // buscar el id en los outputs
370052
- const id = this._resolveOutputs('id');
370053
- if (IMPORT_ID_ANNOTATION in this.annotations) {
370054
- return this.annotations[IMPORT_ID_ANNOTATION];
370055
- }
370056
- else if (id) {
370057
- // hay outputs?
370058
- return id;
370059
- }
370060
- else {
370061
- return undefined;
370062
- }
370063
- }
370064
369987
  }
370065
369988
  class Entity {
370066
369989
  constructor(artifact, deps) {
370067
369990
  this.importStack = [];
370068
369991
  this.kind = artifact.kind;
370069
369992
  this.apiVersion = artifact.apiVersion;
370070
- this.metadata = new Metadata(artifact.metadata, (key) => {
370071
- if (this.deps && 'self-outputs' in this.deps) {
370072
- const cr = this.deps['self-outputs'].cr;
370073
- if (cr && typeof cr.data === 'object') {
370074
- if (key in cr.data) {
370075
- return Buffer.from(cr.data[key], 'base64').toString('utf-8');
370076
- }
370077
- }
370078
- }
370079
- });
369993
+ this.metadata = new Metadata(artifact.metadata);
370080
369994
  this.spec = artifact.spec;
370081
369995
  if (deps) {
370082
369996
  this.deps = deps;
@@ -370226,14 +370140,14 @@ function provisionPermissions(scope, repo, fsGithubRepository) {
370226
370140
  if ('ref' in permission) {
370227
370141
  const tfStateKey = `_${fsGithubRepository.getTfStateKey()}-${permission.ref.kind}-${permission.ref.name}-tr`;
370228
370142
  if (permission.ref.kind === 'FirestartrGithubGroup') {
370229
- const teamSlug = fsGithubRepository.resolveRef(permission.ref, 'slug');
370143
+ const teamId = fsGithubRepository.resolveRef(permission.ref, 'id');
370230
370144
  const config = {
370231
370145
  repository: repo.name,
370232
- teamId: teamSlug,
370146
+ teamId,
370233
370147
  permission: permission.role,
370234
370148
  };
370235
370149
  const teamsRepository = new team_repository/* TeamRepository */.C(scope, tfStateKey, config);
370236
- fsGithubRepository.addResourceToStack(`${teamSlug}:${fsGithubRepository.metadata.name}`, teamsRepository);
370150
+ fsGithubRepository.addResourceToStack(`${teamId}:${fsGithubRepository.metadata.name}`, teamsRepository);
370237
370151
  }
370238
370152
  else if (permission.ref.kind === 'FirestartrGithubMembership') {
370239
370153
  const username = fsGithubRepository.resolveRef(permission.ref);
@@ -370593,7 +370507,7 @@ function provisionGroup(scope, fsGithubGroup) {
370593
370507
  };
370594
370508
  const tfStateKey = `_${fsGithubGroup.getTfStateKey()}`;
370595
370509
  const group = new lib_team/* Team */.S(scope, tfStateKey, config);
370596
- fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.id || fsGithubGroup.metadata.name, group);
370510
+ fsGithubGroup.addResourceToStack(fsGithubGroup.metadata.name, group);
370597
370511
  return group;
370598
370512
  }
370599
370513
 
@@ -370610,11 +370524,11 @@ function provisionMembers(scope, team, fsGithubGroup) {
370610
370524
  const config = {
370611
370525
  dependsOn: [team],
370612
370526
  username,
370613
- teamId: fsGithubGroup.metadata.slug || team.id,
370527
+ teamId: team.id,
370614
370528
  role: member.role,
370615
370529
  };
370616
370530
  const membership = new team_membership/* TeamMembership */.E(scope, tfStateKey, config);
370617
- fsGithubGroup.addResourceToStack(`${fsGithubGroup.metadata.slug || team.id}:${username}`, membership);
370531
+ fsGithubGroup.addResourceToStack(`${team.id}:${username}`, membership);
370618
370532
  }
370619
370533
  }
370620
370534
  }
@@ -372490,10 +372404,7 @@ async function* doApply(item, op, handler) {
372490
372404
  opts['create'] = true;
372491
372405
  }
372492
372406
  const deps = await handler.resolveReferences();
372493
- deps['self-outputs'] = {
372494
- cr: await handler.resolveOwnOutputs(),
372495
- };
372496
- operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${Object.keys(deps)}`);
372407
+ operator_src_logger.info(`Item ${item.metadata.name} has the following dependencies: ${deps}`);
372497
372408
  const annotation = 'firestartr.dev/last-state-pr';
372498
372409
  const statePr = item?.metadata?.annotations?.[annotation];
372499
372410
  const hasStatePr = typeof statePr === 'string' && statePr.trim().length > 0;
@@ -376409,9 +376320,9 @@ const crs_analyzerSubcommand = {
376409
376320
  };
376410
376321
 
376411
376322
  ;// CONCATENATED MODULE: ./package.json
376412
- const package_namespaceObject = JSON.parse('{"i8":"1.55.1-snapshot-5"}');
376323
+ const package_namespaceObject = {"i8":"1.56.0"};
376413
376324
  ;// CONCATENATED MODULE: ../../package.json
376414
- const package_namespaceObject_1 = {"i8":"1.55.0"};
376325
+ const package_namespaceObject_1 = {"i8":"1.56.0"};
376415
376326
  ;// CONCATENATED MODULE: ./src/subcommands/index.ts
376416
376327
 
376417
376328
 
@@ -1,5 +1,5 @@
1
1
  import { importGithubGitopsRepository } from './src/decanter';
2
- import type { CollectionFilter } from './src/decanter/collections';
2
+ import { CollectionFilter } from './src/decanter/collections';
3
3
  export { CollectionFilter };
4
4
  declare const _default: {
5
5
  importGithubGitopsRepository: typeof importGithubGitopsRepository;
@@ -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: Function;
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.55.1-snapshot-5",
3
+ "version": "1.56.0",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",