@firestartr/cli 1.43.1-snapshot-3 → 1.43.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
@@ -271394,7 +271394,7 @@ function fromYaml(data) {
271394
271394
  return result;
271395
271395
  }
271396
271396
  function toYaml(data, opts = {}) {
271397
- console.log('opts', opts);
271397
+ messageLog('opts', opts);
271398
271398
  const result = yaml_dist.stringify(data);
271399
271399
  return result;
271400
271400
  }
@@ -273032,20 +273032,20 @@ const fullMembersTeam = getFromEnvironmentWithDefault(envVars.fullOrgGroup, `${o
273032
273032
 
273033
273033
  const tarballs_messageLog = src_default()('firestartr:catalog_common:features:tarballs');
273034
273034
  function getFeatureZipDownloadPath(featureName, version) {
273035
- const featureTarballDownloadPath = `/tmp/${featureName}-${version}-zipball.zip`;
273036
- tarballs_messageLog('Feature tarball download path %s', featureTarballDownloadPath);
273037
- return featureTarballDownloadPath;
273035
+ const featureDownloadPath = `/tmp/${featureName}-${version}-zipball.zip`;
273036
+ tarballs_messageLog('Feature tarball download path %s', featureDownloadPath);
273037
+ return featureDownloadPath;
273038
273038
  }
273039
273039
  function removeFeatureTarball(featureName, version) {
273040
- const tarballPath = getFeatureZipDownloadPath(featureName, version);
273041
- tarballs_messageLog('Removing feature tarball %s', tarballPath);
273042
- external_fs_.unlinkSync(tarballPath);
273043
- tarballs_messageLog(`Removed tarball for feature ${featureName} and version ${version}: ${tarballPath}`);
273040
+ const featurePath = getFeatureZipDownloadPath(featureName, version);
273041
+ tarballs_messageLog('Removing feature tarball %s', featurePath);
273042
+ external_fs_.unlinkSync(featurePath);
273043
+ tarballs_messageLog(`Removed tarball for feature ${featureName} and version ${version}: ${featurePath}`);
273044
273044
  }
273045
273045
  function featureTarballExists(featureName, version) {
273046
- const tarballPath = getFeatureZipDownloadPath(featureName, version);
273047
- const exists = external_fs_.existsSync(tarballPath);
273048
- tarballs_messageLog(`Tarball ${tarballPath} exists? ${exists}`);
273046
+ const featurePath = getFeatureZipDownloadPath(featureName, version);
273047
+ const exists = external_fs_.existsSync(featurePath);
273048
+ tarballs_messageLog(`Tarball ${featurePath} exists? ${exists}`);
273049
273049
  return exists;
273050
273050
  }
273051
273051
  function getFeaturesExtractPath(featureName, version, options = {}) {
@@ -281289,6 +281289,12 @@ class FirestartrAllClaim {
281289
281289
  type: 'string',
281290
281290
  enum: ['private', 'public', 'internal'],
281291
281291
  },
281292
+ features: {
281293
+ type: 'array',
281294
+ items: {
281295
+ $ref: 'firestartr.dev://github/GithubComponentFeatureClaim',
281296
+ },
281297
+ },
281292
281298
  },
281293
281299
  required: ['visibility', 'org'],
281294
281300
  },
@@ -281349,14 +281355,58 @@ class FirestartrAllClaim {
281349
281355
  },
281350
281356
  });
281351
281357
 
281358
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/feature.schema.ts
281359
+ /* harmony default export */ const feature_schema = ({
281360
+ $schema: 'http://json-schema.org/draft-07/schema#',
281361
+ $id: 'GithubComponentFeatureClaim',
281362
+ definitions: {
281363
+ GithubComponentFeatureClaim: {
281364
+ $id: 'firestartr.dev://github/GithubComponentFeatureClaim',
281365
+ description: 'A feature for a GithubComponentClaim',
281366
+ properties: {
281367
+ name: {
281368
+ type: 'string',
281369
+ description: 'The name of the feature',
281370
+ },
281371
+ version: {
281372
+ type: 'string',
281373
+ description: 'The semver of the feature',
281374
+ },
281375
+ ref: {
281376
+ type: 'string',
281377
+ description: 'A github reference (commit, tag, branch)',
281378
+ },
281379
+ args: {
281380
+ type: 'object',
281381
+ properties: {},
281382
+ additionalProperties: true,
281383
+ },
281384
+ repo: {
281385
+ type: 'string',
281386
+ description: 'A repo where the feature exists, format: owner/repository',
281387
+ pattern: '^[a-zA-Z0-9-._]+/[a-zA-Z0-9-._]+$',
281388
+ },
281389
+ },
281390
+ required: ['name'],
281391
+ oneOf: [
281392
+ { required: ['ref'], not: { required: ['version'] } },
281393
+ { required: ['version'], not: { required: ['ref'] } },
281394
+ ],
281395
+ additionalProperties: false,
281396
+ },
281397
+ },
281398
+ });
281399
+
281352
281400
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/github/index.ts
281353
281401
 
281354
281402
 
281355
281403
 
281356
281404
 
281405
+
281357
281406
  const GithubSchemas = [
281358
281407
  github_group_schema,
281359
281408
  github_user_schema,
281409
+ feature_schema,
281360
281410
  github_component_schema,
281361
281411
  github_orgwebhook_schema,
281362
281412
  ];
@@ -281808,6 +281858,9 @@ const deploy_schema = 'firestartr.dev://common/ArgoDeployClaim';
281808
281858
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/orgWebhook.ts
281809
281859
  const orgWebhook_schema = 'firestartr.dev://common/OrgWebhookClaim';
281810
281860
 
281861
+ ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/secrets.ts
281862
+ const base_secrets_schema = 'firestartr.dev://common/SecretsClaim';
281863
+
281811
281864
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/claims/base/index.ts
281812
281865
 
281813
281866
 
@@ -281817,6 +281870,7 @@ const orgWebhook_schema = 'firestartr.dev://common/OrgWebhookClaim';
281817
281870
 
281818
281871
 
281819
281872
 
281873
+
281820
281874
  /* harmony default export */ const base = ({
281821
281875
  UserClaimSchema: schema,
281822
281876
  GroupClaimSchema: base_group_schema,
@@ -281826,6 +281880,7 @@ const orgWebhook_schema = 'firestartr.dev://common/OrgWebhookClaim';
281826
281880
  TFWorkspaceClaimSchema: workspace_schema,
281827
281881
  ArgoDeployClaimSchema: deploy_schema,
281828
281882
  OrgWebhookClaimSchema: orgWebhook_schema,
281883
+ SecretsClaimSchema: base_secrets_schema,
281829
281884
  });
281830
281885
 
281831
281886
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/normalizers/refValues.ts
@@ -282235,36 +282290,58 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
282235
282290
 
282236
282291
 
282237
282292
 
282293
+
282294
+
282295
+
282296
+
282238
282297
  const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
282239
- async function loadClaim(claimRef, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
282298
+ async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
282240
282299
  let result = existingRefs;
282241
282300
  lazy_loader_log(`Load reference ${claimRef}`);
282242
282301
  initVirtualClaims(org);
282243
282302
  lazy_loader_log(`Load reference (parts) ${claimRef.split(/-/)[0]} ${claimRef.replace(/^[^-]+-/, '')}`);
282244
282303
  // cargas datos con grep
282245
- const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
282246
- const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
282247
- result[claimRef] = {};
282248
- result[claimRef]['claim'] = claim;
282249
- result[claimRef]['claimPath'] = VisitedClaims[claimRef];
282250
- if (VisitedClaims[claimRef] === 'virtual') {
282251
- result = await setVirtualClaimAdditionalData(result, claim, claimRef);
282252
- }
282253
- else {
282254
- result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
282255
- }
282256
- const claimKind = claim.kind;
282257
- const references = extractAllRefs(catalog_common.io.toYaml(claim));
282258
- for (const ref of references) {
282259
- if (!result[ref]) {
282260
- const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
282261
- result = lodash_default().merge(result, resolvedReferences);
282304
+ try {
282305
+ const claimData = await lazyGetClaim(claimRef.split(/-/)[0], claimRef.replace(/^[^-]+-/, ''), org, cwd);
282306
+ const claim = patchClaim(catalog_common.io.fromYaml(claimData), defaults);
282307
+ try {
282308
+ validateClaim(claim, base[`${claim.kind}Schema`]);
282309
+ await optionalValidation(claim);
282310
+ }
282311
+ catch (error) {
282312
+ let errorMsg = '';
282313
+ for (const data of error) {
282314
+ errorMsg = `${errorMsg}
282315
+ - ${data.dataPath}: ${data.message}`;
282316
+ }
282317
+ throw new Error(`Error when validating claim ${claimRef}: ${errorMsg}`);
282318
+ }
282319
+ result[claimRef] = {};
282320
+ result[claimRef]['claim'] = claim;
282321
+ result[claimRef]['claimPath'] = VisitedClaims[claimRef];
282322
+ if (VisitedClaims[claimRef] === 'virtual') {
282323
+ result = await setVirtualClaimAdditionalData(result, claim, claimRef);
282324
+ }
282325
+ else {
282326
+ result = await setNonVirtualClaimAdditionalData(result, claim, claimRef, loadInitializers, loadGlobals, loadOverrides, loadNormalizers);
282327
+ }
282328
+ const claimKind = claim.kind;
282329
+ const references = extractAllRefs(catalog_common.io.toYaml(claim));
282330
+ for (const ref of references) {
282331
+ if (!result[ref]) {
282332
+ const resolvedReferences = await loadClaim(ref, org, defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, result);
282333
+ result = lodash_default().merge(result, resolvedReferences);
282334
+ }
282262
282335
  }
282263
282336
  }
282337
+ catch (err) {
282338
+ throw `Lazy Loading: ${err}`;
282339
+ }
282264
282340
  return result;
282265
282341
  }
282266
282342
  const LoadedClaims = {};
282267
282343
  const VisitedClaims = {};
282344
+ const DuplicatedClaims = {};
282268
282345
  async function lazyGetClaim(kind, name, org, cwd) {
282269
282346
  const indice = `${kind}-${name}`;
282270
282347
  lazy_loader_log(`Lazy loading ${kind}-${name} with index ${indice}`);
@@ -282307,14 +282384,14 @@ async function getClaimsByName(name, cwd = '.') {
282307
282384
  }
282308
282385
  });
282309
282386
  handler.on('close', () => {
282310
- Promise.all(entradas.map((entrada) => {
282387
+ return Promise.all(entradas.map((entrada) => {
282311
282388
  return loadRawClaim(entrada);
282312
282389
  }))
282313
282390
  .then(() => {
282314
282391
  ok();
282315
282392
  })
282316
- .catch(() => {
282317
- ko();
282393
+ .catch((err) => {
282394
+ ko(err);
282318
282395
  });
282319
282396
  });
282320
282397
  });
@@ -282328,9 +282405,17 @@ async function loadRawClaim(entry) {
282328
282405
  if (!('kind' in claim && 'name' in claim)) {
282329
282406
  lazy_loader_log(`Invalid claim file ${entry}`);
282330
282407
  }
282331
- LoadedClaims[`${claim.kind}-${claim.name}`] = data;
282332
- VisitedClaims[`${claim.kind}-${claim.name}`] = entry;
282333
- ok();
282408
+ else {
282409
+ const claimKey = `${claim.kind}-${claim.name}`;
282410
+ if (Object.keys(DuplicatedClaims).includes(claimKey) &&
282411
+ DuplicatedClaims[claimKey] !== entry) {
282412
+ return ko(`Duplicated claim ${claimKey} found files: ${DuplicatedClaims[claimKey]} and ${entry}`);
282413
+ }
282414
+ LoadedClaims[claimKey] = data;
282415
+ VisitedClaims[claimKey] = entry;
282416
+ DuplicatedClaims[claimKey] = entry;
282417
+ ok();
282418
+ }
282334
282419
  });
282335
282420
  });
282336
282421
  }
@@ -282552,7 +282637,7 @@ async function loadClaims(claimsPath = config_getPath('claims')) {
282552
282637
  await crawler_crawl(claimsPath, (entry) => {
282553
282638
  return isYamlFile.test(entry);
282554
282639
  }, async (entry, data) => {
282555
- const claim = patchClaim(catalog_common.io.fromYaml(data), defaultsClaims);
282640
+ const claim = loader_patchClaim(catalog_common.io.fromYaml(data), defaultsClaims);
282556
282641
  if (!('kind' in claim && 'name' in claim)) {
282557
282642
  throw new Error(`Invalid claim file ${entry}`);
282558
282643
  }
@@ -282589,7 +282674,7 @@ function loadClaimDefaults() {
282589
282674
  * - The patched claim
282590
282675
  *
282591
282676
  */
282592
- function patchClaim(claim, defaultsClaims) {
282677
+ function loader_patchClaim(claim, defaultsClaims) {
282593
282678
  if (defaultsClaims[claim.kind]) {
282594
282679
  const jsonPatchOps = fast_json_patch.compare(claim, defaultsClaims[claim.kind])
282595
282680
  .filter((jp) => {
@@ -282733,7 +282818,7 @@ async function loadClaimsList(claimRefList, claimsPath = config_getPath('claims'
282733
282818
  };
282734
282819
  const defaults = loadClaimDefaults();
282735
282820
  for (const claimRef of claimRefList) {
282736
- const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
282821
+ const renderedClaimData = await loadClaim(claimRef, getOrg(), defaults, loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, claimsPath);
282737
282822
  data.renderClaims = lodash_default().merge(data.renderClaims, renderedClaimData);
282738
282823
  }
282739
282824
  const crClaimReferences = [];
@@ -284110,59 +284195,91 @@ function renderFeature(featureName, version, featureOwner, renderPath = '/tmp',
284110
284195
  // EXTERNAL MODULE: ../../node_modules/adm-zip/adm-zip.js
284111
284196
  var adm_zip = __nccwpck_require__(7993);
284112
284197
  var adm_zip_default = /*#__PURE__*/__nccwpck_require__.n(adm_zip);
284198
+ // EXTERNAL MODULE: external "node:stream"
284199
+ var external_node_stream_ = __nccwpck_require__(84492);
284200
+ ;// CONCATENATED MODULE: external "node:stream/promises"
284201
+ const external_node_stream_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream/promises");
284202
+ ;// CONCATENATED MODULE: ../features_preparer/src/zip.ts
284203
+
284204
+
284205
+
284206
+ async function downloadZipBall(url, filePath) {
284207
+ try {
284208
+ const zipResponse = await fetch(url);
284209
+ if (!zipResponse.ok) {
284210
+ throw new Error(`Failed to download ZIP: ${zipResponse.statusText}`);
284211
+ }
284212
+ const webStream = zipResponse.body;
284213
+ const stream = external_node_stream_.Readable.fromWeb(webStream);
284214
+ const writableStream = external_fs_.createWriteStream(filePath);
284215
+ await (0,external_node_stream_promises_namespaceObject.pipeline)(stream, writableStream);
284216
+ }
284217
+ catch (err) {
284218
+ throw new Error(`Downloading feature's zip: ${err.message}`);
284219
+ }
284220
+ }
284221
+
284113
284222
  ;// CONCATENATED MODULE: ../features_preparer/src/installer.ts
284114
284223
 
284115
284224
 
284116
284225
 
284117
284226
 
284118
284227
 
284119
- //const IS_COMMIT_REF = new RegExp(/\b[0-9a-f]{40}/g);
284120
- const IS_SEMVER_REF = new RegExp(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*))?(?:\+([\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*))?$/);
284228
+
284229
+ async function getFeatureConfigFromRef(featureName, featureRef, featureOwner, // -> cr
284230
+ featureArgs = {}, repo = 'features', owner = 'prefapp') {
284231
+ // reference is the featureRef directly
284232
+ const reference = `${featureRef}`;
284233
+ return processFeature(featureName, reference, featureOwner, featureArgs, repo, owner);
284234
+ }
284121
284235
  async function getFeatureConfig(featureName, version, featureOwner, // -> cr
284122
284236
  featureArgs = {}, repo = 'features', owner = 'prefapp') {
284123
- await downloadFeatureZip(repo, featureName, version, owner);
284124
- const ref = buildRef(featureName, version);
284237
+ const reference = `${featureName}-v${version}`;
284238
+ return processFeature(featureName, reference, featureOwner, featureArgs, repo, owner);
284239
+ }
284240
+ async function processFeature(featureName, reference, featureOwner, // -> cr
284241
+ featureArgs = {}, repo = 'features', owner = 'prefapp') {
284242
+ await downloadFeatureZip(repo, featureName, reference, owner);
284125
284243
  featureArgs['traceability'] = {
284126
- version,
284244
+ version: reference,
284127
284245
  owner,
284128
284246
  repo,
284129
284247
  name: featureName,
284130
- ref,
284131
- url: `https://github.com/${owner}/${repo}/tree/${ref}/packages/${featureName}`,
284248
+ ref: reference,
284249
+ url: `https://github.com/${owner}/${repo}/tree/${reference}/packages/${featureName}`,
284132
284250
  };
284133
- return renderFeature(featureName, version, featureOwner, '/tmp', featureArgs);
284251
+ return renderFeature(featureName, reference, featureOwner, '/tmp', featureArgs);
284134
284252
  }
284135
284253
  async function prepareFeature(featureName, version, repo = 'features', owner = 'prefapp') {
284136
284254
  await downloadFeatureZip(repo, featureName, version, owner);
284137
284255
  }
284138
- async function downloadFeatureZip(repo, featureName, version, owner = 'prefapp') {
284256
+ async function downloadFeatureZip(repo, featureName, reference, owner = 'prefapp') {
284139
284257
  try {
284140
- const ref = buildRef(featureName, version);
284141
284258
  const octokit = await github_0.getOctokitForOrg(owner);
284142
- const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version, { createIfNotExists: true });
284259
+ const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, reference, { createIfNotExists: true });
284143
284260
  console.log(`Zipball extract path: ${zipballExtractPath}`);
284144
284261
  if (external_fs_.existsSync(zipballExtractPath)) {
284145
284262
  console.log(`Zipball extract path ${zipballExtractPath} already exists, removing it.`);
284146
284263
  external_fs_.rmSync(zipballExtractPath, { recursive: true });
284147
284264
  }
284148
- const response = await octokit.request('GET /repos/{owner}/{repo}/zipball/{ref}', {
284265
+ const response = await octokit.request('GET /repos/{owner}/{repo}/zipball/{reference}', {
284149
284266
  request: {
284150
284267
  parseSuccessResponseBody: false,
284151
284268
  },
284152
284269
  owner,
284153
284270
  repo,
284154
- ref,
284271
+ reference,
284155
284272
  });
284156
284273
  const randomZipTmpPath = `/tmp/${catalog_common.generic.randomString(20)}.zip`;
284157
- console.log(`Downloading feature ${featureName} version ${version} to ${randomZipTmpPath}`);
284274
+ console.log(`Downloading feature ${featureName} version ${reference} to ${randomZipTmpPath}`);
284158
284275
  if (external_fs_.existsSync(randomZipTmpPath)) {
284159
284276
  console.log(`Temporary zip file ${randomZipTmpPath} already exists, removing it.`);
284160
284277
  external_fs_.unlinkSync(randomZipTmpPath);
284161
284278
  }
284162
284279
  const randomExtractPath = `/tmp/${catalog_common.generic.randomString(20)}`;
284163
- console.log(`Extracting feature ${featureName} version ${version} to ${randomExtractPath}`);
284164
- await response.data;
284280
+ console.log(`Extracting feature ${featureName} version ${reference} to ${randomExtractPath}`);
284165
284281
  external_fs_.rmSync(randomExtractPath, { recursive: true, force: true });
284282
+ await downloadZipBall(response.url, randomZipTmpPath);
284166
284283
  const zip = new (adm_zip_default())(randomZipTmpPath);
284167
284284
  const mainEntry = zip.getEntries()[0].entryName;
284168
284285
  console.log(`Main entry in zip: ${mainEntry}`);
@@ -284176,15 +284293,7 @@ async function downloadFeatureZip(repo, featureName, version, owner = 'prefapp')
284176
284293
  }
284177
284294
  catch (error) {
284178
284295
  console.error(error);
284179
- throw new Error(`Error for feature with tag ${featureName}-v${version}: ${error}. GitHub response: ${error}`);
284180
- }
284181
- }
284182
- function buildRef(featureName, version) {
284183
- if (IS_SEMVER_REF.test(version)) {
284184
- return `${featureName}-v${version}`;
284185
- }
284186
- else {
284187
- return `${version}`;
284296
+ throw new Error(`Error for feature with tag ${reference}: ${error}. GitHub response: ${error}`);
284188
284297
  }
284189
284298
  }
284190
284299
 
@@ -284193,6 +284302,7 @@ function buildRef(featureName, version) {
284193
284302
 
284194
284303
  /* harmony default export */ const features_preparer_src = ({
284195
284304
  renderFeature: renderFeature,
284305
+ getFeatureConfigFromRef: getFeatureConfigFromRef,
284196
284306
  getFeatureConfig: getFeatureConfig,
284197
284307
  prepareFeature: prepareFeature,
284198
284308
  });
@@ -284204,6 +284314,7 @@ function buildRef(featureName, version) {
284204
284314
  prepareFeature: features_preparer_src.prepareFeature,
284205
284315
  renderFeature: features_preparer_src.renderFeature,
284206
284316
  getFeatureConfig: features_preparer_src.getFeatureConfig,
284317
+ getFeatureConfigFromRef: features_preparer_src.getFeatureConfigFromRef,
284207
284318
  });
284208
284319
 
284209
284320
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/overriders/utils.ts
@@ -284248,13 +284359,17 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
284248
284359
 
284249
284360
 
284250
284361
  class FeaturesOverrider extends OverriderPatches {
284251
- constructor(featureName, featureVersion, featureConfig, featureArgs) {
284362
+ constructor(featureName, featureVersion, featureConfig, featureArgs, featureRef, featureRepo) {
284252
284363
  super();
284253
284364
  this.applicableProviders = ['github'];
284254
284365
  this.featureConfig = false;
284366
+ this.featureRepo = '';
284367
+ this.featureRef = '';
284255
284368
  this.featureName = featureName;
284256
284369
  this.featureVersion = featureVersion;
284257
284370
  this.featureArgs = featureArgs || {};
284371
+ this.featureRef = featureRef || '';
284372
+ this.featureRepo = featureRepo || '';
284258
284373
  if (featureConfig) {
284259
284374
  this.featureConfig = featureConfig;
284260
284375
  }
@@ -284262,15 +284377,32 @@ class FeaturesOverrider extends OverriderPatches {
284262
284377
  getFeatureConfig(cr) {
284263
284378
  if (this.featureConfig)
284264
284379
  return this.featureConfig;
284265
- return features_preparer.getFeatureConfig(this.featureName, this.featureVersion, this.featureArgs, cr, 'features', 'prefapp');
284380
+ return this.setUpAndRunRenderer(cr);
284381
+ }
284382
+ setUpAndRunRenderer(cr) {
284383
+ let repo = 'features';
284384
+ let owner = 'prefapp';
284385
+ let versionOrRef = this.featureVersion;
284386
+ let renderer = 'getFeatureConfig';
284387
+ if (this.featureRepo) {
284388
+ [owner, repo] = this.featureRepo.split(/\//);
284389
+ }
284390
+ if (this.featureRef) {
284391
+ versionOrRef = this.featureRef;
284392
+ renderer = 'getFeatureConfigFromRef';
284393
+ }
284394
+ return features_preparer[renderer](this.featureName, versionOrRef, cr, this.featureArgs, repo, owner);
284266
284395
  }
284267
284396
  async __validate() {
284268
284397
  return true;
284269
284398
  }
284270
284399
  async __patches(claim, _previousCR) {
284271
284400
  const featureName = this.featureName;
284272
- const featureVersion = this.featureVersion;
284401
+ const featureVersion = this.featureVersion || this.featureRef;
284273
284402
  const featureArgs = this.featureArgs;
284403
+ const fSetUpAndRunRenderer = function (cr) {
284404
+ return this.setUpAndRunRenderer(cr);
284405
+ }.bind(this);
284274
284406
  let renderedFeatureConfig = null;
284275
284407
  return [
284276
284408
  {
@@ -284278,7 +284410,7 @@ class FeaturesOverrider extends OverriderPatches {
284278
284410
  return true;
284279
284411
  },
284280
284412
  async apply(cr) {
284281
- renderedFeatureConfig = await features_preparer.getFeatureConfig(featureName, featureVersion, cr, featureArgs, 'features', 'prefapp');
284413
+ renderedFeatureConfig = await fSetUpAndRunRenderer(cr);
284282
284414
  return cr;
284283
284415
  },
284284
284416
  identify() {
@@ -284324,7 +284456,7 @@ async function generateFeaturesPatches(claim) {
284324
284456
  return patches;
284325
284457
  }
284326
284458
  async function createRenderFeaturePatch(claim, feature) {
284327
- const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args);
284459
+ const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args, feature.ref, feature.repo);
284328
284460
  return featureOverrider.patches(claim, null);
284329
284461
  }
284330
284462
 
@@ -36,5 +36,6 @@ declare const _default: {
36
36
  TFWorkspaceClaimSchema: string;
37
37
  ArgoDeployClaimSchema: string;
38
38
  OrgWebhookClaimSchema: string;
39
+ SecretsClaimSchema: string;
39
40
  };
40
41
  export default _default;
@@ -343,6 +343,47 @@ declare const schemas: {
343
343
  })[];
344
344
  };
345
345
  };
346
+ } | {
347
+ $schema: string;
348
+ $id: string;
349
+ definitions: {
350
+ GithubComponentFeatureClaim: {
351
+ $id: string;
352
+ description: string;
353
+ properties: {
354
+ name: {
355
+ type: string;
356
+ description: string;
357
+ };
358
+ version: {
359
+ type: string;
360
+ description: string;
361
+ };
362
+ ref: {
363
+ type: string;
364
+ description: string;
365
+ };
366
+ args: {
367
+ type: string;
368
+ properties: {};
369
+ additionalProperties: boolean;
370
+ };
371
+ repo: {
372
+ type: string;
373
+ description: string;
374
+ pattern: string;
375
+ };
376
+ };
377
+ required: string[];
378
+ oneOf: {
379
+ required: string[];
380
+ not: {
381
+ required: string[];
382
+ };
383
+ }[];
384
+ additionalProperties: boolean;
385
+ };
386
+ };
346
387
  } | {
347
388
  $schema: string;
348
389
  $id: string;
@@ -367,6 +408,12 @@ declare const schemas: {
367
408
  type: string;
368
409
  enum: string[];
369
410
  };
411
+ features: {
412
+ type: string;
413
+ items: {
414
+ $ref: string;
415
+ };
416
+ };
370
417
  };
371
418
  required: string[];
372
419
  $ref?: undefined;
@@ -0,0 +1,9 @@
1
+ import { IClaim } from '../base';
2
+ export interface ISecretsClaim extends IClaim {
3
+ type: string;
4
+ lifecycle: string;
5
+ system: string;
6
+ name: string;
7
+ providers: any;
8
+ }
9
+ export declare const schema = "firestartr.dev://common/SecretsClaim";
@@ -22,6 +22,12 @@ declare const _default: {
22
22
  type: string;
23
23
  enum: string[];
24
24
  };
25
+ features: {
26
+ type: string;
27
+ items: {
28
+ $ref: string;
29
+ };
30
+ };
25
31
  };
26
32
  required: string[];
27
33
  $ref?: undefined;
@@ -0,0 +1,43 @@
1
+ declare const _default: {
2
+ $schema: string;
3
+ $id: string;
4
+ definitions: {
5
+ GithubComponentFeatureClaim: {
6
+ $id: string;
7
+ description: string;
8
+ properties: {
9
+ name: {
10
+ type: string;
11
+ description: string;
12
+ };
13
+ version: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ ref: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ args: {
22
+ type: string;
23
+ properties: {};
24
+ additionalProperties: boolean;
25
+ };
26
+ repo: {
27
+ type: string;
28
+ description: string;
29
+ pattern: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ oneOf: {
34
+ required: string[];
35
+ not: {
36
+ required: string[];
37
+ };
38
+ }[];
39
+ additionalProperties: boolean;
40
+ };
41
+ };
42
+ };
43
+ export default _default;
@@ -59,6 +59,47 @@ export declare const GithubSchemas: ({
59
59
  })[];
60
60
  };
61
61
  };
62
+ } | {
63
+ $schema: string;
64
+ $id: string;
65
+ definitions: {
66
+ GithubComponentFeatureClaim: {
67
+ $id: string;
68
+ description: string;
69
+ properties: {
70
+ name: {
71
+ type: string;
72
+ description: string;
73
+ };
74
+ version: {
75
+ type: string;
76
+ description: string;
77
+ };
78
+ ref: {
79
+ type: string;
80
+ description: string;
81
+ };
82
+ args: {
83
+ type: string;
84
+ properties: {};
85
+ additionalProperties: boolean;
86
+ };
87
+ repo: {
88
+ type: string;
89
+ description: string;
90
+ pattern: string;
91
+ };
92
+ };
93
+ required: string[];
94
+ oneOf: {
95
+ required: string[];
96
+ not: {
97
+ required: string[];
98
+ };
99
+ }[];
100
+ additionalProperties: boolean;
101
+ };
102
+ };
62
103
  } | {
63
104
  $schema: string;
64
105
  $id: string;
@@ -83,6 +124,12 @@ export declare const GithubSchemas: ({
83
124
  type: string;
84
125
  enum: string[];
85
126
  };
127
+ features: {
128
+ type: string;
129
+ items: {
130
+ $ref: string;
131
+ };
132
+ };
86
133
  };
87
134
  required: string[];
88
135
  $ref?: undefined;
@@ -13,7 +13,9 @@ export interface IGithubRepositoryFeatureClaim extends IClaim {
13
13
  context: any;
14
14
  feature: {
15
15
  name: string;
16
- version: string;
16
+ version?: string;
17
+ ref?: string;
18
+ repo?: string;
17
19
  };
18
20
  repositoryTarget: FirestartrGithubRepositoryFeatureSpecRepositoryTarget;
19
21
  files: Array<IGithubRepositoryFeatureFileClaim>;
@@ -5,8 +5,11 @@ export declare class FeaturesOverrider extends OverriderPatches {
5
5
  private featureVersion;
6
6
  private featureConfig;
7
7
  private featureArgs;
8
- constructor(featureName: string, featureVersion: string, featureConfig?: any, featureArgs?: any);
8
+ private featureRepo;
9
+ private featureRef;
10
+ constructor(featureName: string, featureVersion: string, featureConfig?: any, featureArgs?: any, featureRef?: string, featureRepo?: string);
9
11
  getFeatureConfig(cr: any): any;
12
+ setUpAndRunRenderer(cr: any): any;
10
13
  __validate(): Promise<boolean>;
11
14
  __patches(claim: any, _previousCR: any): Promise<({
12
15
  validate(_cr: any): boolean;
@@ -3,5 +3,6 @@ declare const _default: {
3
3
  prepareFeature: typeof import("./src/installer").prepareFeature;
4
4
  renderFeature: typeof import("./src/renderer").renderFeature;
5
5
  getFeatureConfig: typeof import("./src/installer").getFeatureConfig;
6
+ getFeatureConfigFromRef: typeof import("./src/installer").getFeatureConfigFromRef;
6
7
  };
7
8
  export default _default;
@@ -1,7 +1,8 @@
1
- import { getFeatureConfig, prepareFeature } from './installer';
1
+ import { getFeatureConfigFromRef, getFeatureConfig, prepareFeature } from './installer';
2
2
  import { renderFeature } from './renderer';
3
3
  declare const _default: {
4
4
  renderFeature: typeof renderFeature;
5
+ getFeatureConfigFromRef: typeof getFeatureConfigFromRef;
5
6
  getFeatureConfig: typeof getFeatureConfig;
6
7
  prepareFeature: typeof prepareFeature;
7
8
  };
@@ -1,4 +1,6 @@
1
+ export declare function getFeatureConfigFromRef(featureName: string, featureRef: string, featureOwner: any, // -> cr
2
+ featureArgs?: any, repo?: string, owner?: string): Promise<any>;
1
3
  export declare function getFeatureConfig(featureName: string, version: string, featureOwner: any, // -> cr
2
4
  featureArgs?: any, repo?: string, owner?: string): Promise<any>;
3
5
  export declare function prepareFeature(featureName: string, version: string, repo?: string, owner?: string): Promise<void>;
4
- export declare function downloadFeatureZip(repo: string, featureName: string, version: string, owner?: string): Promise<string>;
6
+ export declare function downloadFeatureZip(repo: string, featureName: string, reference: string, owner?: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function downloadZipBall(url: string, filePath: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.43.1-snapshot-3",
3
+ "version": "1.43.1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",