@firestartr/cli 1.43.2-snapshot-6 → 1.43.2-snapshot-8

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
@@ -165787,7 +165787,7 @@ const Comparator = __nccwpck_require__(14435)
165787
165787
  const Range = __nccwpck_require__(34189)
165788
165788
  const satisfies = __nccwpck_require__(74432)
165789
165789
  const toComparators = __nccwpck_require__(90453)
165790
- const maxSatisfying = __nccwpck_require__(49939)
165790
+ const maxSatisfying = __nccwpck_require__(46253)
165791
165791
  const minSatisfying = __nccwpck_require__(59276)
165792
165792
  const minVersion = __nccwpck_require__(97241)
165793
165793
  const validRange = __nccwpck_require__(65493)
@@ -166213,7 +166213,7 @@ module.exports = ltr
166213
166213
 
166214
166214
  /***/ }),
166215
166215
 
166216
- /***/ 49939:
166216
+ /***/ 46253:
166217
166217
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
166218
166218
 
166219
166219
  const SemVer = __nccwpck_require__(87048)
@@ -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
  ];
@@ -284112,59 +284162,83 @@ var adm_zip = __nccwpck_require__(7993);
284112
284162
  var adm_zip_default = /*#__PURE__*/__nccwpck_require__.n(adm_zip);
284113
284163
  // EXTERNAL MODULE: external "node:stream"
284114
284164
  var external_node_stream_ = __nccwpck_require__(84492);
284115
- ;// CONCATENATED MODULE: ../features_preparer/src/installer.ts
284165
+ ;// CONCATENATED MODULE: ../features_preparer/src/zip.ts
284116
284166
 
284117
284167
 
284168
+ async function downloadZipBall(url, filePath) {
284169
+ try {
284170
+ const zipResponse = await fetch(url);
284171
+ if (!zipResponse.ok) {
284172
+ throw new Error(`Failed to download ZIP: ${zipResponse.statusText}`);
284173
+ }
284174
+ const webStream = zipResponse.body;
284175
+ const stream = external_node_stream_.Readable.fromWeb(webStream);
284176
+ await (0,promises_namespaceObject.writeFile)(filePath, stream);
284177
+ }
284178
+ catch (err) {
284179
+ throw new Error(`Downloading feature's zip: ${err.message}`);
284180
+ }
284181
+ }
284118
284182
 
284183
+ ;// CONCATENATED MODULE: ../features_preparer/src/installer.ts
284119
284184
 
284120
284185
 
284121
284186
 
284122
284187
 
284123
- //const IS_COMMIT_REF = new RegExp(/\b[0-9a-f]{40}/g);
284124
- 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-]+)*))?$/);
284188
+
284189
+
284190
+ async function getFeatureConfigFromRef(featureName, featureRef, featureOwner, // -> cr
284191
+ featureArgs = {}, repo = 'features', owner = 'prefapp') {
284192
+ // reference is the featureRef directly
284193
+ const reference = `${featureRef}`;
284194
+ return processFeature(featureName, reference, featureOwner, featureArgs, repo, owner);
284195
+ }
284125
284196
  async function getFeatureConfig(featureName, version, featureOwner, // -> cr
284126
284197
  featureArgs = {}, repo = 'features', owner = 'prefapp') {
284127
- await downloadFeatureZip(repo, featureName, version, owner);
284128
- const ref = buildRef(featureName, version);
284198
+ const reference = `${featureName}-v${version}`;
284199
+ return processFeature(featureName, reference, featureOwner, featureArgs, repo, owner);
284200
+ }
284201
+ async function processFeature(featureName, reference, featureOwner, // -> cr
284202
+ featureArgs = {}, repo = 'features', owner = 'prefapp') {
284203
+ await downloadFeatureZip(repo, featureName, reference, owner);
284129
284204
  featureArgs['traceability'] = {
284130
- version,
284205
+ version: reference,
284131
284206
  owner,
284132
284207
  repo,
284133
284208
  name: featureName,
284134
- ref,
284135
- url: `https://github.com/${owner}/${repo}/tree/${ref}/packages/${featureName}`,
284209
+ ref: reference,
284210
+ url: `https://github.com/${owner}/${repo}/tree/${reference}/packages/${featureName}`,
284136
284211
  };
284137
- return renderFeature(featureName, version, featureOwner, '/tmp', featureArgs);
284212
+ return renderFeature(featureName, reference, featureOwner, '/tmp', featureArgs);
284138
284213
  }
284139
284214
  async function prepareFeature(featureName, version, repo = 'features', owner = 'prefapp') {
284140
284215
  await downloadFeatureZip(repo, featureName, version, owner);
284141
284216
  }
284142
- async function downloadFeatureZip(repo, featureName, version, owner = 'prefapp') {
284217
+ async function downloadFeatureZip(repo, featureName, reference, owner = 'prefapp') {
284143
284218
  try {
284144
- const ref = buildRef(featureName, version);
284145
284219
  const octokit = await github_0.getOctokitForOrg(owner);
284146
- const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, version, { createIfNotExists: true });
284220
+ const zipballExtractPath = catalog_common.features.tarballs.getFeaturesExtractPath(featureName, reference, { createIfNotExists: true });
284147
284221
  console.log(`Zipball extract path: ${zipballExtractPath}`);
284148
284222
  if (external_fs_.existsSync(zipballExtractPath)) {
284149
284223
  console.log(`Zipball extract path ${zipballExtractPath} already exists, removing it.`);
284150
284224
  external_fs_.rmSync(zipballExtractPath, { recursive: true });
284151
284225
  }
284152
- const response = await octokit.request('GET /repos/{owner}/{repo}/zipball/{ref}', {
284226
+ const response = await octokit.request('GET /repos/{owner}/{repo}/zipball/{reference}', {
284153
284227
  request: {
284154
284228
  parseSuccessResponseBody: false,
284155
284229
  },
284156
284230
  owner,
284157
284231
  repo,
284158
- ref,
284232
+ reference,
284159
284233
  });
284160
284234
  const randomZipTmpPath = `/tmp/${catalog_common.generic.randomString(20)}.zip`;
284161
- console.log(`Downloading feature ${featureName} version ${version} to ${randomZipTmpPath}`);
284235
+ console.log(`Downloading feature ${featureName} version ${reference} to ${randomZipTmpPath}`);
284162
284236
  if (external_fs_.existsSync(randomZipTmpPath)) {
284163
284237
  console.log(`Temporary zip file ${randomZipTmpPath} already exists, removing it.`);
284164
284238
  external_fs_.unlinkSync(randomZipTmpPath);
284165
284239
  }
284166
284240
  const randomExtractPath = `/tmp/${catalog_common.generic.randomString(20)}`;
284167
- console.log(`Extracting feature ${featureName} version ${version} to ${randomExtractPath}`);
284241
+ console.log(`Extracting feature ${featureName} version ${reference} to ${randomExtractPath}`);
284168
284242
  external_fs_.rmSync(randomExtractPath, { recursive: true, force: true });
284169
284243
  await downloadZipBall(response.url, randomZipTmpPath);
284170
284244
  const zip = new (adm_zip_default())(randomZipTmpPath);
@@ -284180,30 +284254,11 @@ async function downloadFeatureZip(repo, featureName, version, owner = 'prefapp')
284180
284254
  }
284181
284255
  catch (error) {
284182
284256
  console.error(error);
284183
- throw new Error(`Error for feature with tag ${featureName}-v${version}: ${error}. GitHub response: ${error}`);
284184
- }
284185
- }
284186
- async function downloadZipBall(url, filePath) {
284187
- try {
284188
- const zipResponse = await fetch(url);
284189
- if (!zipResponse.ok) {
284190
- throw new Error(`Failed to download ZIP: ${zipResponse.statusText}`);
284191
- }
284192
- const webStream = zipResponse.body;
284193
- const stream = external_node_stream_.Readable.fromWeb(webStream);
284194
- await (0,promises_namespaceObject.writeFile)(filePath, stream);
284195
- }
284196
- catch (err) {
284197
- throw new Error(`Downloading feature's zip: ${err.message}`);
284257
+ throw new Error(`Error for feature with tag ${reference}: ${error}. GitHub response: ${error}`);
284198
284258
  }
284199
284259
  }
284200
284260
  function buildRef(featureName, version) {
284201
- if (IS_SEMVER_REF.test(version)) {
284202
- return `${featureName}-v${version}`;
284203
- }
284204
- else {
284205
- return `${version}`;
284206
- }
284261
+ return `${featureName}-v${version}`;
284207
284262
  }
284208
284263
 
284209
284264
  ;// CONCATENATED MODULE: ../features_preparer/src/index.ts
@@ -284211,6 +284266,7 @@ function buildRef(featureName, version) {
284211
284266
 
284212
284267
  /* harmony default export */ const features_preparer_src = ({
284213
284268
  renderFeature: renderFeature,
284269
+ getFeatureConfigFromRef: getFeatureConfigFromRef,
284214
284270
  getFeatureConfig: getFeatureConfig,
284215
284271
  prepareFeature: prepareFeature,
284216
284272
  });
@@ -284222,6 +284278,7 @@ function buildRef(featureName, version) {
284222
284278
  prepareFeature: features_preparer_src.prepareFeature,
284223
284279
  renderFeature: features_preparer_src.renderFeature,
284224
284280
  getFeatureConfig: features_preparer_src.getFeatureConfig,
284281
+ getFeatureConfigFromRef: features_preparer_src.getFeatureConfigFromRef,
284225
284282
  });
284226
284283
 
284227
284284
  ;// CONCATENATED MODULE: ../cdk8s_renderer/src/overriders/utils.ts
@@ -284266,13 +284323,17 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
284266
284323
 
284267
284324
 
284268
284325
  class FeaturesOverrider extends OverriderPatches {
284269
- constructor(featureName, featureVersion, featureConfig, featureArgs) {
284326
+ constructor(featureName, featureVersion, featureConfig, featureArgs, featureRef, featureRepo) {
284270
284327
  super();
284271
284328
  this.applicableProviders = ['github'];
284272
284329
  this.featureConfig = false;
284330
+ this.featureRepo = '';
284331
+ this.featureRef = '';
284273
284332
  this.featureName = featureName;
284274
284333
  this.featureVersion = featureVersion;
284275
284334
  this.featureArgs = featureArgs || {};
284335
+ this.featureRef = featureRef || '';
284336
+ this.featureRepo = featureRepo || '';
284276
284337
  if (featureConfig) {
284277
284338
  this.featureConfig = featureConfig;
284278
284339
  }
@@ -284280,7 +284341,21 @@ class FeaturesOverrider extends OverriderPatches {
284280
284341
  getFeatureConfig(cr) {
284281
284342
  if (this.featureConfig)
284282
284343
  return this.featureConfig;
284283
- return features_preparer.getFeatureConfig(this.featureName, this.featureVersion, this.featureArgs, cr, 'features', 'prefapp');
284344
+ return this.setUpAndRunRenderer(cr);
284345
+ }
284346
+ setUpAndRunRenderer(cr) {
284347
+ let repo = 'features';
284348
+ let owner = 'prefapp';
284349
+ let versionOrRef = this.featureVersion;
284350
+ let renderer = 'getFeatureConfig';
284351
+ if (this.featureRepo) {
284352
+ [owner, repo] = this.featureRepo.split(/\//);
284353
+ }
284354
+ if (this.featureRef) {
284355
+ versionOrRef = this.featureRef;
284356
+ renderer = 'getFeatureConfigFromRef';
284357
+ }
284358
+ return features_preparer[renderer](this.featureName, versionOrRef, this.featureArgs, cr, repo, owner);
284284
284359
  }
284285
284360
  async __validate() {
284286
284361
  return true;
@@ -284289,6 +284364,9 @@ class FeaturesOverrider extends OverriderPatches {
284289
284364
  const featureName = this.featureName;
284290
284365
  const featureVersion = this.featureVersion;
284291
284366
  const featureArgs = this.featureArgs;
284367
+ const fSetUpAndRunRenderer = function (cr) {
284368
+ return this.setUpAndRunRenderer(cr);
284369
+ }.bind(this);
284292
284370
  let renderedFeatureConfig = null;
284293
284371
  return [
284294
284372
  {
@@ -284296,7 +284374,7 @@ class FeaturesOverrider extends OverriderPatches {
284296
284374
  return true;
284297
284375
  },
284298
284376
  async apply(cr) {
284299
- renderedFeatureConfig = await features_preparer.getFeatureConfig(featureName, featureVersion, cr, featureArgs, 'features', 'prefapp');
284377
+ renderedFeatureConfig = await fSetUpAndRunRenderer(cr);
284300
284378
  return cr;
284301
284379
  },
284302
284380
  identify() {
@@ -284342,7 +284420,7 @@ async function generateFeaturesPatches(claim) {
284342
284420
  return patches;
284343
284421
  }
284344
284422
  async function createRenderFeaturePatch(claim, feature) {
284345
- const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args);
284423
+ const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args, feature.ref, feature.repo);
284346
284424
  return featureOverrider.patches(claim, null);
284347
284425
  }
284348
284426
 
@@ -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;
@@ -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.2-snapshot-6",
3
+ "version": "1.43.2-snapshot-8",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",