@firestartr/cli 1.50.1-snapshot-25 → 1.50.1-snapshot-26

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
@@ -289786,18 +289786,12 @@ function fromYaml(data) {
289786
289786
  }
289787
289787
  function toYaml(data, opts = {}) {
289788
289788
  src_logger.debug('opts', opts);
289789
- const result = yaml_dist.stringify(data, {
289790
- defaultKeyType: 'PLAIN',
289791
- defaultStringType: 'QUOTE_DOUBLE',
289792
- });
289789
+ const result = yaml_dist.stringify(data);
289793
289790
  return result;
289794
289791
  }
289795
289792
  function dumpYaml(data) {
289796
289793
  src_logger.debug('Dumping object data to YAML %O', data);
289797
- return yaml_dist.stringify(data, {
289798
- defaultKeyType: 'PLAIN',
289799
- defaultStringType: 'QUOTE_DOUBLE',
289800
- });
289794
+ return yaml_dist.stringify(data);
289801
289795
  }
289802
289796
 
289803
289797
  // EXTERNAL MODULE: external "child_process"
@@ -295737,186 +295731,6 @@ function dist_bundle_paginateRest(octokit) {
295737
295731
  dist_bundle_paginateRest.VERSION = _octokit_plugin_paginate_rest_dist_bundle_VERSION;
295738
295732
 
295739
295733
 
295740
- ;// CONCATENATED MODULE: ../github/node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js
295741
- // pkg/dist-src/errors.js
295742
- var generateMessage = (path, cursorValue) => `The cursor at "${path.join(
295743
- ","
295744
- )}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
295745
- var MissingCursorChange = class extends Error {
295746
- constructor(pageInfo, cursorValue) {
295747
- super(generateMessage(pageInfo.pathInQuery, cursorValue));
295748
- this.pageInfo = pageInfo;
295749
- this.cursorValue = cursorValue;
295750
- if (Error.captureStackTrace) {
295751
- Error.captureStackTrace(this, this.constructor);
295752
- }
295753
- }
295754
- name = "MissingCursorChangeError";
295755
- };
295756
- var MissingPageInfo = class extends Error {
295757
- constructor(response) {
295758
- super(
295759
- `No pageInfo property found in response. Please make sure to specify the pageInfo in your query. Response-Data: ${JSON.stringify(
295760
- response,
295761
- null,
295762
- 2
295763
- )}`
295764
- );
295765
- this.response = response;
295766
- if (Error.captureStackTrace) {
295767
- Error.captureStackTrace(this, this.constructor);
295768
- }
295769
- }
295770
- name = "MissingPageInfo";
295771
- };
295772
-
295773
- // pkg/dist-src/object-helpers.js
295774
- var isObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
295775
- function findPaginatedResourcePath(responseData) {
295776
- const paginatedResourcePath = deepFindPathToProperty(
295777
- responseData,
295778
- "pageInfo"
295779
- );
295780
- if (paginatedResourcePath.length === 0) {
295781
- throw new MissingPageInfo(responseData);
295782
- }
295783
- return paginatedResourcePath;
295784
- }
295785
- var deepFindPathToProperty = (object, searchProp, path = []) => {
295786
- for (const key of Object.keys(object)) {
295787
- const currentPath = [...path, key];
295788
- const currentValue = object[key];
295789
- if (isObject(currentValue)) {
295790
- if (currentValue.hasOwnProperty(searchProp)) {
295791
- return currentPath;
295792
- }
295793
- const result = deepFindPathToProperty(
295794
- currentValue,
295795
- searchProp,
295796
- currentPath
295797
- );
295798
- if (result.length > 0) {
295799
- return result;
295800
- }
295801
- }
295802
- }
295803
- return [];
295804
- };
295805
- var dist_bundle_get = (object, path) => {
295806
- return path.reduce((current, nextProperty) => current[nextProperty], object);
295807
- };
295808
- var set = (object, path, mutator) => {
295809
- const lastProperty = path[path.length - 1];
295810
- const parentPath = [...path].slice(0, -1);
295811
- const parent = dist_bundle_get(object, parentPath);
295812
- if (typeof mutator === "function") {
295813
- parent[lastProperty] = mutator(parent[lastProperty]);
295814
- } else {
295815
- parent[lastProperty] = mutator;
295816
- }
295817
- };
295818
-
295819
- // pkg/dist-src/extract-page-info.js
295820
- var extractPageInfos = (responseData) => {
295821
- const pageInfoPath = findPaginatedResourcePath(responseData);
295822
- return {
295823
- pathInQuery: pageInfoPath,
295824
- pageInfo: dist_bundle_get(responseData, [...pageInfoPath, "pageInfo"])
295825
- };
295826
- };
295827
-
295828
- // pkg/dist-src/page-info.js
295829
- var isForwardSearch = (givenPageInfo) => {
295830
- return givenPageInfo.hasOwnProperty("hasNextPage");
295831
- };
295832
- var getCursorFrom = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.endCursor : pageInfo.startCursor;
295833
- var hasAnotherPage = (pageInfo) => isForwardSearch(pageInfo) ? pageInfo.hasNextPage : pageInfo.hasPreviousPage;
295834
-
295835
- // pkg/dist-src/iterator.js
295836
- var createIterator = (octokit) => {
295837
- return (query, initialParameters = {}) => {
295838
- let nextPageExists = true;
295839
- let parameters = { ...initialParameters };
295840
- return {
295841
- [Symbol.asyncIterator]: () => ({
295842
- async next() {
295843
- if (!nextPageExists) return { done: true, value: {} };
295844
- const response = await octokit.graphql(
295845
- query,
295846
- parameters
295847
- );
295848
- const pageInfoContext = extractPageInfos(response);
295849
- const nextCursorValue = getCursorFrom(pageInfoContext.pageInfo);
295850
- nextPageExists = hasAnotherPage(pageInfoContext.pageInfo);
295851
- if (nextPageExists && nextCursorValue === parameters.cursor) {
295852
- throw new MissingCursorChange(pageInfoContext, nextCursorValue);
295853
- }
295854
- parameters = {
295855
- ...parameters,
295856
- cursor: nextCursorValue
295857
- };
295858
- return { done: false, value: response };
295859
- }
295860
- })
295861
- };
295862
- };
295863
- };
295864
-
295865
- // pkg/dist-src/merge-responses.js
295866
- var mergeResponses = (response1, response2) => {
295867
- if (Object.keys(response1).length === 0) {
295868
- return Object.assign(response1, response2);
295869
- }
295870
- const path = findPaginatedResourcePath(response1);
295871
- const nodesPath = [...path, "nodes"];
295872
- const newNodes = dist_bundle_get(response2, nodesPath);
295873
- if (newNodes) {
295874
- set(response1, nodesPath, (values) => {
295875
- return [...values, ...newNodes];
295876
- });
295877
- }
295878
- const edgesPath = [...path, "edges"];
295879
- const newEdges = dist_bundle_get(response2, edgesPath);
295880
- if (newEdges) {
295881
- set(response1, edgesPath, (values) => {
295882
- return [...values, ...newEdges];
295883
- });
295884
- }
295885
- const pageInfoPath = [...path, "pageInfo"];
295886
- set(response1, pageInfoPath, dist_bundle_get(response2, pageInfoPath));
295887
- return response1;
295888
- };
295889
-
295890
- // pkg/dist-src/paginate.js
295891
- var createPaginate = (octokit) => {
295892
- const iterator = createIterator(octokit);
295893
- return async (query, initialParameters = {}) => {
295894
- let mergedResponse = {};
295895
- for await (const response of iterator(
295896
- query,
295897
- initialParameters
295898
- )) {
295899
- mergedResponse = mergeResponses(mergedResponse, response);
295900
- }
295901
- return mergedResponse;
295902
- };
295903
- };
295904
-
295905
- // pkg/dist-src/version.js
295906
- var plugin_paginate_graphql_dist_bundle_VERSION = "0.0.0-development";
295907
-
295908
- // pkg/dist-src/index.js
295909
- function paginateGraphQL(octokit) {
295910
- return {
295911
- graphql: Object.assign(octokit.graphql, {
295912
- paginate: Object.assign(createPaginate(octokit), {
295913
- iterator: createIterator(octokit)
295914
- })
295915
- })
295916
- };
295917
- }
295918
-
295919
-
295920
295734
  ;// CONCATENATED MODULE: ../../node_modules/@octokit/oauth-methods/dist-bundle/index.js
295921
295735
  // pkg/dist-src/version.js
295922
295736
  var oauth_methods_dist_bundle_VERSION = "0.0.0-development";
@@ -297804,7 +297618,7 @@ async function dist_node_get(cache, options) {
297804
297618
  repositorySelection
297805
297619
  };
297806
297620
  }
297807
- async function dist_node_set(cache, options, data) {
297621
+ async function set(cache, options, data) {
297808
297622
  const key = optionsToCacheKey(options);
297809
297623
  const permissionsString = options.permissions ? "" : Object.keys(data.permissions).map(
297810
297624
  (name) => `${name}${data.permissions[name] === "write" ? "!" : ""}`
@@ -297979,7 +297793,7 @@ async function getInstallationAuthenticationImpl(state, options, request) {
297979
297793
  if (singleFileName) {
297980
297794
  Object.assign(payload, { singleFileName });
297981
297795
  }
297982
- await dist_node_set(state.cache, options, cacheOptions);
297796
+ await set(state.cache, options, cacheOptions);
297983
297797
  const cacheData = {
297984
297798
  installationId: options.installationId,
297985
297799
  token,
@@ -298243,7 +298057,6 @@ async function checkIfInstalledForOrg(org = 'default') {
298243
298057
 
298244
298058
 
298245
298059
 
298246
-
298247
298060
  const generateGithubAppToken = async (config) => {
298248
298061
  try {
298249
298062
  const { appId, privateKey, installationOrgId } = config;
@@ -298289,7 +298102,7 @@ async function getOctokitForOrg(org, paginated = false, genGithubAppToken = gene
298289
298102
  });
298290
298103
  const options = { auth: auth };
298291
298104
  if (paginated) {
298292
- options.plugins = [dist_bundle_paginateRest, paginateGraphQL];
298105
+ options.plugins = [dist_bundle_paginateRest];
298293
298106
  }
298294
298107
  return new dist_src_Octokit(options);
298295
298108
  }
@@ -298356,54 +298169,6 @@ async function getOrgInfo(org) {
298356
298169
  const orgInfo = await octokit.orgs.get({ org });
298357
298170
  return orgInfo.data;
298358
298171
  }
298359
- async function getOrgTeamsDirectAccess(org) {
298360
- github_src_logger.info(`Getting teams for org ${org}`);
298361
- const octokit = await getOctokitForOrg(org);
298362
- const response = await octokit.graphql(`{
298363
- organization(login: "${org}") {
298364
- teams(first: 30) {
298365
- nodes {
298366
- id
298367
- name
298368
- repositories {
298369
- edges {
298370
- permission
298371
- node {
298372
- name
298373
- }
298374
- }
298375
- }
298376
- }
298377
- }
298378
- }
298379
- }`);
298380
- return transformGraphQLResponse(response);
298381
- }
298382
- ;
298383
- function transformGraphQLResponse(response) {
298384
- const teams = response?.data?.organization?.teams?.nodes;
298385
- if (!teams)
298386
- return {};
298387
- let result = {
298388
- repositories: {},
298389
- teams: {},
298390
- };
298391
- teams.forEach((team) => {
298392
- const teamName = team.name;
298393
- const teamId = team.id;
298394
- result.teams[teamName] = { id: teamId };
298395
- const repositories = team.repositories.edges;
298396
- repositories.forEach((repoEdge) => {
298397
- const repoName = repoEdge.node.name;
298398
- const permission = repoEdge.permission;
298399
- if (!result.repositories[repoName]) {
298400
- result.repositories[repoName] = {};
298401
- }
298402
- result.repositories[repoName][teamName] = permission;
298403
- });
298404
- });
298405
- return result;
298406
- }
298407
298172
  async function getOrgPlanName(org) {
298408
298173
  github_src_logger.info(`Getting plan for org ${org}`);
298409
298174
  const orgInfo = await getOrgInfo(org);
@@ -298422,7 +298187,6 @@ async function doPaginatedRequest(options) {
298422
298187
  validateMember,
298423
298188
  getUserRoleInOrg,
298424
298189
  getOrgInfo,
298425
- getOrgTeamsDirectAccess,
298426
298190
  getOrgPlanName,
298427
298191
  });
298428
298192
 
@@ -309821,19 +309585,10 @@ class GithubDecanter extends decanter_base {
309821
309585
  }
309822
309586
  }
309823
309587
 
309824
- ;// CONCATENATED MODULE: ../importer/src/logger.ts
309825
-
309826
- /* harmony default export */ const importer_src_logger = (catalog_common.logger);
309827
-
309828
309588
  ;// CONCATENATED MODULE: ../importer/src/decanter/gh/github_group.ts
309829
309589
 
309830
309590
 
309831
309591
 
309832
-
309833
-
309834
-
309835
-
309836
-
309837
309592
  class GroupGithubDecanter extends GithubDecanter {
309838
309593
  constructor() {
309839
309594
  super(...arguments);
@@ -309843,7 +309598,7 @@ class GroupGithubDecanter extends GithubDecanter {
309843
309598
  this.claim = {
309844
309599
  kind: this.claimKind,
309845
309600
  version: this.VERSION(),
309846
- name: this.data.groupDetails.slug,
309601
+ name: this.data.groupDetails.name,
309847
309602
  description: this.data.groupDetails.description,
309848
309603
  type: 'business-unit',
309849
309604
  };
@@ -309867,9 +309622,7 @@ class GroupGithubDecanter extends GithubDecanter {
309867
309622
  __decantProviders() {
309868
309623
  this.__patchClaim({
309869
309624
  op: 'add',
309870
- value: {
309871
- github: { name: `${this.data.groupDetails.name}`, org: this.org },
309872
- },
309625
+ value: { github: { name: this.data.groupDetails.name, org: this.org } },
309873
309626
  path: '/providers',
309874
309627
  });
309875
309628
  }
@@ -309877,13 +309630,13 @@ class GroupGithubDecanter extends GithubDecanter {
309877
309630
  if (this.data.groupDetails.parent) {
309878
309631
  this.__patchClaim({
309879
309632
  op: 'add',
309880
- value: `group:${this.data.groupDetails.parent.slug}`,
309633
+ value: `group:${this.data.groupDetails.parent.name}`,
309881
309634
  path: '/parent',
309882
309635
  });
309883
309636
  }
309884
309637
  }
309885
309638
  async __gatherMembers() {
309886
- this.data['members'] = (await github_0.team.getTeamMembers(this.data.groupDetails.slug, this.org)).map((member) => {
309639
+ this.data['members'] = (await github_0.team.getTeamMembers(this.data.groupDetails.name, this.org)).map((member) => {
309887
309640
  return { name: member.login, role: member.role };
309888
309641
  });
309889
309642
  }
@@ -309892,43 +309645,28 @@ class GroupGithubDecanter extends GithubDecanter {
309892
309645
  return this.__validateEqual(members, this.data.members);
309893
309646
  }
309894
309647
  async __adaptInitializerBase(_claim) {
309895
- let githubGroupDefaultsFilePath;
309896
- try {
309897
- githubGroupDefaultsFilePath = external_path_.join(getConfigPath(), 'resources', 'defaults_github_group.yaml');
309898
- }
309899
- catch (e) {
309900
- importer_src_logger.warn('No config path set, using built-in defaults');
309901
- githubGroupDefaultsFilePath = '';
309902
- }
309903
- let adapter;
309904
- if (githubGroupDefaultsFilePath &&
309905
- external_fs_.existsSync(githubGroupDefaultsFilePath)) {
309906
- adapter = catalog_common.io.fromYaml(external_fs_.readFileSync(githubGroupDefaultsFilePath, 'utf-8'));
309907
- }
309908
- else {
309909
- adapter = {
309910
- name: 'base',
309911
- apiVersion: 'firestartr.dev/v1',
309912
- kind: 'FirestartrGithubGroup',
309913
- defaultValues: {
309914
- context: {
309915
- backend: {
309916
- ref: {
309917
- kind: 'FirestartrProviderConfig',
309918
- name: 'firestartr-terraform-state',
309919
- },
309648
+ const adapterBase = {
309649
+ name: 'base',
309650
+ apiVersion: 'firestartr.dev/v1',
309651
+ kind: 'FirestartrGithubGroup',
309652
+ defaultValues: {
309653
+ context: {
309654
+ backend: {
309655
+ ref: {
309656
+ kind: 'FirestartrProviderConfig',
309657
+ name: 'firestartr-terraform-state',
309920
309658
  },
309921
- provider: {
309922
- ref: {
309923
- kind: 'FirestartrProviderConfig',
309924
- name: 'github-app',
309925
- },
309659
+ },
309660
+ provider: {
309661
+ ref: {
309662
+ kind: 'FirestartrProviderConfig',
309663
+ name: 'github-app',
309926
309664
  },
309927
309665
  },
309928
309666
  },
309929
- };
309930
- }
309931
- return new InitializerDefault(adapter);
309667
+ },
309668
+ };
309669
+ return new InitializerDefault(adapterBase);
309932
309670
  }
309933
309671
  __validateKind(cr) {
309934
309672
  return true;
@@ -310008,9 +309746,9 @@ class GroupCollectionGithubDecanter extends GithubDecanter {
310008
309746
  const groups = [];
310009
309747
  const teamMaps = {};
310010
309748
  teamList.forEach((team) => {
310011
- teamMaps[team.slug] = team;
309749
+ teamMaps[team.name] = team;
310012
309750
  });
310013
- const filteredGroups = await this.filter(GroupCollectionGithubDecanter.collectionKind, filters, teamList.map((team) => team.slug));
309751
+ const filteredGroups = await this.filter(GroupCollectionGithubDecanter.collectionKind, filters, teamList.map((team) => team.name));
310014
309752
  for (const team of filteredGroups) {
310015
309753
  groups.push(new GroupGithubDecanter({ groupDetails: teamMaps[team] }, this.org));
310016
309754
  }
@@ -310025,11 +309763,6 @@ applyCollectionMixins(GroupCollectionGithubDecanter);
310025
309763
 
310026
309764
 
310027
309765
 
310028
-
310029
-
310030
-
310031
-
310032
-
310033
309766
  class MemberGithubDecanter extends GithubDecanter {
310034
309767
  constructor() {
310035
309768
  super(...arguments);
@@ -310067,43 +309800,28 @@ class MemberGithubDecanter extends GithubDecanter {
310067
309800
  });
310068
309801
  }
310069
309802
  async __adaptInitializerBase(_claim) {
310070
- let githubMemberDefaultsFilePath;
310071
- try {
310072
- githubMemberDefaultsFilePath = external_path_.join(getConfigPath(), 'resources', 'defaults_github_membership.yaml');
310073
- }
310074
- catch (e) {
310075
- importer_src_logger.warn('No config path set, using built-in defaults');
310076
- githubMemberDefaultsFilePath = '';
310077
- }
310078
- let adapter;
310079
- if (githubMemberDefaultsFilePath &&
310080
- external_fs_.existsSync(githubMemberDefaultsFilePath)) {
310081
- adapter = catalog_common.io.fromYaml(external_fs_.readFileSync(githubMemberDefaultsFilePath, 'utf-8'));
310082
- }
310083
- else {
310084
- adapter = {
310085
- name: 'base',
310086
- apiVersion: 'firestartr.dev/v1',
310087
- kind: 'FirestartrGithubMembership',
310088
- defaultValues: {
310089
- context: {
310090
- backend: {
310091
- ref: {
310092
- kind: 'FirestartrProviderConfig',
310093
- name: 'firestartr-terraform-state',
310094
- },
309803
+ const adapterBase = {
309804
+ name: 'base',
309805
+ apiVersion: 'firestartr.dev/v1',
309806
+ kind: 'FirestartrGithubMembership',
309807
+ defaultValues: {
309808
+ context: {
309809
+ backend: {
309810
+ ref: {
309811
+ kind: 'FirestartrProviderConfig',
309812
+ name: 'firestartr-terraform-state',
310095
309813
  },
310096
- provider: {
310097
- ref: {
310098
- kind: 'FirestartrProviderConfig',
310099
- name: 'github-app',
310100
- },
309814
+ },
309815
+ provider: {
309816
+ ref: {
309817
+ kind: 'FirestartrProviderConfig',
309818
+ name: 'github-app',
310101
309819
  },
310102
309820
  },
310103
309821
  },
310104
- };
310105
- }
310106
- return new InitializerDefault(adapter);
309822
+ },
309823
+ };
309824
+ return new InitializerDefault(adapterBase);
310107
309825
  }
310108
309826
  }
310109
309827
 
@@ -310136,21 +309854,15 @@ applyCollectionMixins(MemberCollectionGithubDecanter);
310136
309854
 
310137
309855
 
310138
309856
 
310139
-
310140
-
310141
-
310142
-
310143
-
310144
309857
  const TYPE_MAP = {
310145
309858
  User: 'user',
310146
309859
  Team: 'group',
310147
309860
  Organization: 'org',
310148
309861
  };
310149
309862
  class RepoGithubDecanter extends GithubDecanter {
310150
- constructor(data, org, githubTeams = {}) {
310151
- super(data, org);
309863
+ constructor() {
309864
+ super(...arguments);
310152
309865
  this.claimKind = 'ComponentClaim';
310153
- this.githubTeams = githubTeams;
310154
309866
  }
310155
309867
  __decantStart() {
310156
309868
  this.claim = {
@@ -310158,6 +309870,7 @@ class RepoGithubDecanter extends GithubDecanter {
310158
309870
  version: this.VERSION(),
310159
309871
  type: 'service',
310160
309872
  lifecycle: 'production',
309873
+ system: `system:${this.org}-system`,
310161
309874
  name: this.data.repoDetails.name,
310162
309875
  };
310163
309876
  }
@@ -310211,9 +309924,6 @@ class RepoGithubDecanter extends GithubDecanter {
310211
309924
  }
310212
309925
  }
310213
309926
  __decantRelations() {
310214
- importer_src_logger.debug("Decanting repo's relations...");
310215
- console.dir(this.data.teamsAndMembers, { depth: null });
310216
- importer_src_logger.debug("Decanting maintainers...");
310217
309927
  const directMaintainers = this.data.teamsAndMembers.directMembers
310218
309928
  .filter((member) => member.role === 'maintain')
310219
309929
  .map((member) => {
@@ -310239,7 +309949,6 @@ class RepoGithubDecanter extends GithubDecanter {
310239
309949
  path: '/maintainedBy',
310240
309950
  });
310241
309951
  }
310242
- importer_src_logger.debug("Decanting admins...");
310243
309952
  const directAdmins = this.data.teamsAndMembers.directMembers
310244
309953
  .filter((member) => member.role === 'admin')
310245
309954
  .map((member) => {
@@ -310275,7 +309984,6 @@ class RepoGithubDecanter extends GithubDecanter {
310275
309984
  path: '/providers/github/overrides',
310276
309985
  });
310277
309986
  }
310278
- importer_src_logger.debug("Decanting writers...");
310279
309987
  const directWriters = this.data.teamsAndMembers.directMembers
310280
309988
  .filter((member) => member.role === 'push')
310281
309989
  .map((member) => {
@@ -310300,7 +310008,6 @@ class RepoGithubDecanter extends GithubDecanter {
310300
310008
  path: '/providers/github/overrides',
310301
310009
  });
310302
310010
  }
310303
- importer_src_logger.debug("Decanting readers...");
310304
310011
  const directReaders = this.data.teamsAndMembers.directMembers
310305
310012
  .filter((member) => member.role === 'pull')
310306
310013
  .map((member) => {
@@ -310329,18 +310036,13 @@ class RepoGithubDecanter extends GithubDecanter {
310329
310036
  async __gatherRepoTeamsAndMembers() {
310330
310037
  this.data['teamsAndMembers'] = {};
310331
310038
  const directMembers = (await github_0.repo.getCollaborators(this.data.repoDetails.owner.login, this.data.repoDetails.name, 'direct')).map((member) => {
310332
- return { name: member.login, slug: member.slug, role: member.role_name };
310039
+ return { name: member.login, role: member.role_name };
310333
310040
  });
310334
310041
  const outsideMembers = (await github_0.repo.getCollaborators(this.data.repoDetails.owner.login, this.data.repoDetails.name, 'outside')).map((member) => {
310335
310042
  return { name: member.login, role: member.role_name };
310336
310043
  });
310337
- console.debug("--- 🚀 Gathered repo's teams and members:");
310338
- console.dir(this.githubTeams, { depth: null });
310339
- const teams = Object.keys(this.githubTeams).map((teamName) => {
310340
- return {
310341
- name: teamName,
310342
- role: this.githubTeams[teamName].toLowerCase(),
310343
- };
310044
+ const teams = (await github_0.repo.getTeams(this.data.repoDetails.owner.login, this.data.repoDetails.name)).map((team) => {
310045
+ return { name: team.name, role: team.permission, id: team.id };
310344
310046
  });
310345
310047
  this.data['teamsAndMembers']['teams'] = teams;
310346
310048
  this.data['teamsAndMembers']['directMembers'] = directMembers;
@@ -310406,74 +310108,59 @@ class RepoGithubDecanter extends GithubDecanter {
310406
310108
  return null;
310407
310109
  }
310408
310110
  async __adaptInitializerBase(_claim) {
310409
- let githubRepoDefaultsFilePath;
310410
- try {
310411
- githubRepoDefaultsFilePath = external_path_.join(getConfigPath(), 'resources', 'defaults_github_repository.yaml');
310412
- }
310413
- catch (e) {
310414
- importer_src_logger.warn('No config path set, using built-in defaults');
310415
- githubRepoDefaultsFilePath = '';
310416
- }
310417
- let adapter;
310418
- if (githubRepoDefaultsFilePath &&
310419
- external_fs_.existsSync(githubRepoDefaultsFilePath)) {
310420
- adapter = catalog_common.io.fromYaml(external_fs_.readFileSync(githubRepoDefaultsFilePath, 'utf-8'));
310421
- }
310422
- else {
310423
- adapter = {
310424
- name: 'base',
310425
- apiVersion: 'firestartr.dev/v1',
310426
- kind: 'FirestartrGithubRepository',
310427
- defaultValues: {
310428
- context: {
310429
- backend: {
310430
- ref: {
310431
- kind: 'FirestartrProviderConfig',
310432
- name: 'firestartr-terraform-state',
310433
- },
310111
+ const adapterBase = {
310112
+ name: 'base',
310113
+ apiVersion: 'firestartr.dev/v1',
310114
+ kind: 'FirestartrGithubRepository',
310115
+ defaultValues: {
310116
+ context: {
310117
+ backend: {
310118
+ ref: {
310119
+ kind: 'FirestartrProviderConfig',
310120
+ name: 'firestartr-terraform-state',
310434
310121
  },
310435
- provider: {
310436
- ref: {
310437
- kind: 'FirestartrProviderConfig',
310438
- name: 'github-app',
310439
- },
310122
+ },
310123
+ provider: {
310124
+ ref: {
310125
+ kind: 'FirestartrProviderConfig',
310126
+ name: 'github-app',
310440
310127
  },
310441
310128
  },
310442
- name: this.data.repoDetails.name,
310129
+ },
310130
+ name: this.data.repoDetails.name,
310131
+ description: this.data.repoDetails.description,
310132
+ org: this.org,
310133
+ firestartr: {
310134
+ technology: { stack: 'none', version: 'none' },
310135
+ },
310136
+ repo: {
310443
310137
  description: this.data.repoDetails.description,
310444
- org: this.org,
310445
- firestartr: {
310446
- technology: { stack: 'none', version: 'none' },
310447
- },
310448
- repo: {
310449
- description: this.data.repoDetails.description,
310450
- allowMergeCommit: this.data.repoDetails.allow_merge_commit,
310451
- allowSquashMerge: this.data.repoDetails.allow_squash_merge,
310452
- allowRebaseMerge: this.data.repoDetails.allow_rebase_merge,
310453
- allowAutoMerge: this.data.repoDetails.allow_auto_merge,
310454
- deleteBranchOnMerge: this.data.repoDetails.delete_branch_on_merge,
310455
- autoInit: true,
310456
- archiveOnDestroy: true,
310457
- allowUpdateBranch: this.data.repoDetails.allow_update_branch,
310458
- hasIssues: this.data.repoDetails.has_issues,
310459
- visibility: this.data.repoDetails.visibility,
310460
- defaultBranch: this.data.repoDetails.default_branch,
310461
- },
310462
- permissions: [],
310463
- actions: {
310464
- oidc: this.data.oidc.use_default
310465
- ? undefined
310466
- : {
310467
- useDefault: this.data.oidc.use_default,
310468
- includeClaimKeys: this.data.oidc.include_claim_keys
310469
- ? this.data.oidc.include_claim_keys
310470
- : [],
310471
- },
310472
- },
310138
+ allowMergeCommit: this.data.repoDetails.allow_merge_commit,
310139
+ allowSquashMerge: this.data.repoDetails.allow_squash_merge,
310140
+ allowRebaseMerge: this.data.repoDetails.allow_rebase_merge,
310141
+ allowAutoMerge: this.data.repoDetails.allow_auto_merge,
310142
+ deleteBranchOnMerge: this.data.repoDetails.delete_branch_on_merge,
310143
+ autoInit: true,
310144
+ archiveOnDestroy: true,
310145
+ allowUpdateBranch: this.data.repoDetails.allow_update_branch,
310146
+ hasIssues: this.data.repoDetails.has_issues,
310147
+ visibility: this.data.repoDetails.visibility,
310148
+ defaultBranch: this.data.repoDetails.default_branch,
310473
310149
  },
310474
- };
310475
- }
310476
- return new InitializerDefault(adapter);
310150
+ permissions: [],
310151
+ actions: {
310152
+ oidc: this.data.oidc.use_default
310153
+ ? undefined
310154
+ : {
310155
+ useDefault: this.data.oidc.use_default,
310156
+ includeClaimKeys: this.data.oidc.include_claim_keys
310157
+ ? this.data.oidc.include_claim_keys
310158
+ : [],
310159
+ },
310160
+ },
310161
+ },
310162
+ };
310163
+ return new InitializerDefault(adapterBase);
310477
310164
  }
310478
310165
  async __adaptOverriderRepo(_claim) {
310479
310166
  return new GithubRepositoryOverrider();
@@ -310489,7 +310176,6 @@ class RepoCollectionGithubDecanter extends GithubDecanter {
310489
310176
  if (this.IS_SKIP_SET(filters, RepoCollectionGithubDecanter.collectionKind)) {
310490
310177
  return [];
310491
310178
  }
310492
- const { teams, repositories: directAccessRepos } = await this.github.org.getOrgTeamsDirectAccess(this.org);
310493
310179
  let repoList = await this.github.org.getRepositoryList(this.org);
310494
310180
  repoList = repoList.filter((el) => !el.archived);
310495
310181
  const repoMap = {};
@@ -310500,9 +310186,7 @@ class RepoCollectionGithubDecanter extends GithubDecanter {
310500
310186
  const filteredRepos = await this.filter(RepoCollectionGithubDecanter.collectionKind, filters, repoList.map((repo) => repo.name));
310501
310187
  for (const repoName of filteredRepos) {
310502
310188
  const repoInfo = await this.github.repo.getRepoInfo(this.org, repoName);
310503
- console.log(`--- 🚀 Processing repo: ${repoName}`);
310504
- console.dir(directAccessRepos, { depth: null });
310505
- repos.push(new RepoGithubDecanter({ repoDetails: repoInfo }, this.org, directAccessRepos?.[repoName]));
310189
+ repos.push(new RepoGithubDecanter({ repoDetails: repoInfo }, this.org));
310506
310190
  }
310507
310191
  this.data['collection'] = repos;
310508
310192
  return repos;
@@ -310512,6 +310196,10 @@ RepoCollectionGithubDecanter.collectionKind = 'gh-repo';
310512
310196
  applyCollectionMixins(RepoCollectionGithubDecanter);
310513
310197
  /* harmony default export */ const github_repo_collection = (RepoCollectionGithubDecanter);
310514
310198
 
310199
+ ;// CONCATENATED MODULE: ../importer/src/logger.ts
310200
+
310201
+ /* harmony default export */ const importer_src_logger = (catalog_common.logger);
310202
+
310515
310203
  ;// CONCATENATED MODULE: ../importer/src/decanter/index.ts
310516
310204
 
310517
310205
 
@@ -310604,7 +310292,7 @@ function getClaimPathFromCR(claimsBasePath, cr) {
310604
310292
  FirestartrGithubRepository: 'components',
310605
310293
  FirestartrGithubMembership: 'users',
310606
310294
  };
310607
- return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], `${cr.metadata.labels['claim-ref']}.yaml`.toLowerCase());
310295
+ return external_path_.join(claimsBasePath, mapCrsToClaims[cr.kind], `${cr.metadata.annotations[catalog_common.generic.getFirestartrAnnotation('external-name')]}.yaml`.toLowerCase());
310608
310296
  }
310609
310297
  function getCrPath(crsBasePath, cr) {
310610
310298
  return external_path_.join(crsBasePath, `${cr.kind}.${cr.metadata.name}.yaml`);
@@ -9,7 +9,6 @@ declare const _default: {
9
9
  validateMember: typeof import("./src/organization").validateMember;
10
10
  getUserRoleInOrg: typeof import("./src/organization").getUserRoleInOrg;
11
11
  getOrgInfo: typeof import("./src/organization").getOrgInfo;
12
- getOrgTeamsDirectAccess: typeof import("./src/organization").getOrgTeamsDirectAccess;
13
12
  getOrgPlanName: typeof import("./src/organization").getOrgPlanName;
14
13
  };
15
14
  repo: {
@@ -4,8 +4,6 @@ export declare function getUserList(org: string, perPageEntries?: number): Promi
4
4
  export declare function validateMember(username: string, org: string): Promise<any>;
5
5
  export declare function getUserRoleInOrg(username: string, org: string): Promise<"admin" | "member" | "billing_manager">;
6
6
  export declare function getOrgInfo(org: string): Promise<any>;
7
- export declare function getOrgTeamsDirectAccess(org: string): Promise<any>;
8
- export declare function transformGraphQLResponse(response: any): any;
9
7
  export declare function getOrgPlanName(org: string): Promise<any>;
10
8
  declare const _default: {
11
9
  getRepositoryList: typeof getRepositoryList;
@@ -14,7 +12,6 @@ declare const _default: {
14
12
  validateMember: typeof validateMember;
15
13
  getUserRoleInOrg: typeof getUserRoleInOrg;
16
14
  getOrgInfo: typeof getOrgInfo;
17
- getOrgTeamsDirectAccess: typeof getOrgTeamsDirectAccess;
18
15
  getOrgPlanName: typeof getOrgPlanName;
19
16
  };
20
17
  export default _default;
@@ -1,8 +1,6 @@
1
1
  import { BranchStrategiesInitializer, GithubRepositoryOverrider, InitializerDefault } from 'cdk8s_renderer';
2
2
  import { GithubDecanter } from './base';
3
3
  export default class RepoGithubDecanter extends GithubDecanter {
4
- githubTeams: any;
5
- constructor(data: any, org: string, githubTeams?: any);
6
4
  claimKind: string;
7
5
  __decantStart(): void;
8
6
  __decantProviders(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.50.1-snapshot-25",
3
+ "version": "1.50.1-snapshot-26",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",