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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -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
+ pattern: '^[a-zA-Z0-9-._]+/[a-zA-Z0-9-._]+$',
281379
+ },
281380
+ args: {
281381
+ type: 'object',
281382
+ properties: {},
281383
+ additionalProperties: true,
281384
+ },
281385
+ repo: {
281386
+ type: 'string',
281387
+ description: 'A repo where the feature exists, format: owner/repository',
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
284166
+
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
+ }
284116
284182
 
284183
+ ;// CONCATENATED MODULE: ../features_preparer/src/installer.ts
284117
284184
 
284118
284185
 
284119
284186
 
284120
284187
 
284121
284188
 
284122
284189
 
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-]+)*))?$/);
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
  });
@@ -284266,13 +284322,17 @@ async function utils_renderFeature(featureName, featureVersion, featureOutputObj
284266
284322
 
284267
284323
 
284268
284324
  class FeaturesOverrider extends OverriderPatches {
284269
- constructor(featureName, featureVersion, featureConfig, featureArgs) {
284325
+ constructor(featureName, featureVersion, featureConfig, featureArgs, featureRef, featureRepo) {
284270
284326
  super();
284271
284327
  this.applicableProviders = ['github'];
284272
284328
  this.featureConfig = false;
284329
+ this.featureRepo = '';
284330
+ this.featureRef = '';
284273
284331
  this.featureName = featureName;
284274
284332
  this.featureVersion = featureVersion;
284275
284333
  this.featureArgs = featureArgs || {};
284334
+ this.featureRef = featureRef || '';
284335
+ this.featureRepo = featureRepo || '';
284276
284336
  if (featureConfig) {
284277
284337
  this.featureConfig = featureConfig;
284278
284338
  }
@@ -284280,7 +284340,18 @@ class FeaturesOverrider extends OverriderPatches {
284280
284340
  getFeatureConfig(cr) {
284281
284341
  if (this.featureConfig)
284282
284342
  return this.featureConfig;
284283
- return features_preparer.getFeatureConfig(this.featureName, this.featureVersion, this.featureArgs, cr, 'features', 'prefapp');
284343
+ let repo = 'features';
284344
+ let owner = 'prefapp';
284345
+ let version = this.featureVersion;
284346
+ let renderer = 'getFeatureConfig';
284347
+ if (this.featureRepo) {
284348
+ [owner, repo] = this.featureRepo.split(/\//);
284349
+ }
284350
+ if (this.featureRef) {
284351
+ version = this.featureRef;
284352
+ renderer = 'getFeatureConfigFromRef';
284353
+ }
284354
+ return features_preparer[renderer](this.featureName, version, this.featureArgs, cr, repo, owner, this.featureRef);
284284
284355
  }
284285
284356
  async __validate() {
284286
284357
  return true;
@@ -284342,7 +284413,7 @@ async function generateFeaturesPatches(claim) {
284342
284413
  return patches;
284343
284414
  }
284344
284415
  async function createRenderFeaturePatch(claim, feature) {
284345
- const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args);
284416
+ const featureOverrider = new FeaturesOverrider(feature.name, feature.version, false, feature.args, feature.ref, feature.repo);
284346
284417
  return featureOverrider.patches(claim, null);
284347
284418
  }
284348
284419
 
@@ -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
+ pattern: string;
366
+ };
367
+ args: {
368
+ type: string;
369
+ properties: {};
370
+ additionalProperties: boolean;
371
+ };
372
+ repo: {
373
+ type: string;
374
+ description: 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
+ pattern: string;
21
+ };
22
+ args: {
23
+ type: string;
24
+ properties: {};
25
+ additionalProperties: boolean;
26
+ };
27
+ repo: {
28
+ type: string;
29
+ description: 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
+ pattern: string;
82
+ };
83
+ args: {
84
+ type: string;
85
+ properties: {};
86
+ additionalProperties: boolean;
87
+ };
88
+ repo: {
89
+ type: string;
90
+ description: 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,7 +5,9 @@ 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;
10
12
  __validate(): Promise<boolean>;
11
13
  __patches(claim: any, _previousCR: any): Promise<({
@@ -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>;
@@ -428,7 +428,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
428
428
  verified_at: string;
429
429
  };
430
430
  };
431
- author: {
431
+ author: Record<string, never> | {
432
432
  name?: string;
433
433
  email?: string;
434
434
  login: string;
@@ -451,8 +451,8 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
451
451
  site_admin: boolean;
452
452
  starred_at?: string;
453
453
  user_view_type?: string;
454
- } | Record<string, never>;
455
- committer: {
454
+ };
455
+ committer: Record<string, never> | {
456
456
  name?: string;
457
457
  email?: string;
458
458
  login: string;
@@ -475,7 +475,7 @@ export declare function getBranch(repo: string, branch: string, owner?: string):
475
475
  site_admin: boolean;
476
476
  starred_at?: string;
477
477
  user_view_type?: string;
478
- } | Record<string, never>;
478
+ };
479
479
  parents: {
480
480
  sha: string;
481
481
  url: string;
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-7",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",