@firestartr/cli 1.44.1-snapshot-3 → 1.45.0-snapshot-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
@@ -263516,6 +263516,183 @@ exports.visit = visit;
263516
263516
  exports.visitAsync = visitAsync;
263517
263517
 
263518
263518
 
263519
+ /***/ }),
263520
+
263521
+ /***/ 88840:
263522
+ /***/ ((module) => {
263523
+
263524
+ var __webpack_unused_export__;
263525
+
263526
+
263527
+ const NullObject = function NullObject () { }
263528
+ NullObject.prototype = Object.create(null)
263529
+
263530
+ /**
263531
+ * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
263532
+ *
263533
+ * parameter = token "=" ( token / quoted-string )
263534
+ * token = 1*tchar
263535
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
263536
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
263537
+ * / DIGIT / ALPHA
263538
+ * ; any VCHAR, except delimiters
263539
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
263540
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
263541
+ * obs-text = %x80-FF
263542
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
263543
+ */
263544
+ const paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu
263545
+
263546
+ /**
263547
+ * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
263548
+ *
263549
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
263550
+ * obs-text = %x80-FF
263551
+ */
263552
+ const quotedPairRE = /\\([\v\u0020-\u00ff])/gu
263553
+
263554
+ /**
263555
+ * RegExp to match type in RFC 7231 sec 3.1.1.1
263556
+ *
263557
+ * media-type = type "/" subtype
263558
+ * type = token
263559
+ * subtype = token
263560
+ */
263561
+ const mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u
263562
+
263563
+ // default ContentType to prevent repeated object creation
263564
+ const defaultContentType = { type: '', parameters: new NullObject() }
263565
+ Object.freeze(defaultContentType.parameters)
263566
+ Object.freeze(defaultContentType)
263567
+
263568
+ /**
263569
+ * Parse media type to object.
263570
+ *
263571
+ * @param {string|object} header
263572
+ * @return {Object}
263573
+ * @public
263574
+ */
263575
+
263576
+ function parse (header) {
263577
+ if (typeof header !== 'string') {
263578
+ throw new TypeError('argument header is required and must be a string')
263579
+ }
263580
+
263581
+ let index = header.indexOf(';')
263582
+ const type = index !== -1
263583
+ ? header.slice(0, index).trim()
263584
+ : header.trim()
263585
+
263586
+ if (mediaTypeRE.test(type) === false) {
263587
+ throw new TypeError('invalid media type')
263588
+ }
263589
+
263590
+ const result = {
263591
+ type: type.toLowerCase(),
263592
+ parameters: new NullObject()
263593
+ }
263594
+
263595
+ // parse parameters
263596
+ if (index === -1) {
263597
+ return result
263598
+ }
263599
+
263600
+ let key
263601
+ let match
263602
+ let value
263603
+
263604
+ paramRE.lastIndex = index
263605
+
263606
+ while ((match = paramRE.exec(header))) {
263607
+ if (match.index !== index) {
263608
+ throw new TypeError('invalid parameter format')
263609
+ }
263610
+
263611
+ index += match[0].length
263612
+ key = match[1].toLowerCase()
263613
+ value = match[2]
263614
+
263615
+ if (value[0] === '"') {
263616
+ // remove quotes and escapes
263617
+ value = value
263618
+ .slice(1, value.length - 1)
263619
+
263620
+ quotedPairRE.test(value) && (value = value.replace(quotedPairRE, '$1'))
263621
+ }
263622
+
263623
+ result.parameters[key] = value
263624
+ }
263625
+
263626
+ if (index !== header.length) {
263627
+ throw new TypeError('invalid parameter format')
263628
+ }
263629
+
263630
+ return result
263631
+ }
263632
+
263633
+ function safeParse (header) {
263634
+ if (typeof header !== 'string') {
263635
+ return defaultContentType
263636
+ }
263637
+
263638
+ let index = header.indexOf(';')
263639
+ const type = index !== -1
263640
+ ? header.slice(0, index).trim()
263641
+ : header.trim()
263642
+
263643
+ if (mediaTypeRE.test(type) === false) {
263644
+ return defaultContentType
263645
+ }
263646
+
263647
+ const result = {
263648
+ type: type.toLowerCase(),
263649
+ parameters: new NullObject()
263650
+ }
263651
+
263652
+ // parse parameters
263653
+ if (index === -1) {
263654
+ return result
263655
+ }
263656
+
263657
+ let key
263658
+ let match
263659
+ let value
263660
+
263661
+ paramRE.lastIndex = index
263662
+
263663
+ while ((match = paramRE.exec(header))) {
263664
+ if (match.index !== index) {
263665
+ return defaultContentType
263666
+ }
263667
+
263668
+ index += match[0].length
263669
+ key = match[1].toLowerCase()
263670
+ value = match[2]
263671
+
263672
+ if (value[0] === '"') {
263673
+ // remove quotes and escapes
263674
+ value = value
263675
+ .slice(1, value.length - 1)
263676
+
263677
+ quotedPairRE.test(value) && (value = value.replace(quotedPairRE, '$1'))
263678
+ }
263679
+
263680
+ result.parameters[key] = value
263681
+ }
263682
+
263683
+ if (index !== header.length) {
263684
+ return defaultContentType
263685
+ }
263686
+
263687
+ return result
263688
+ }
263689
+
263690
+ __webpack_unused_export__ = { parse, safeParse }
263691
+ __webpack_unused_export__ = parse
263692
+ module.exports.As = safeParse
263693
+ __webpack_unused_export__ = defaultContentType
263694
+
263695
+
263519
263696
  /***/ }),
263520
263697
 
263521
263698
  /***/ 57932:
@@ -278130,77 +278307,692 @@ dist_bundle_paginateRest.VERSION = _octokit_plugin_paginate_rest_dist_bundle_VER
278130
278307
 
278131
278308
  // EXTERNAL MODULE: ../../node_modules/@octokit/auth-app/dist-node/index.js
278132
278309
  var dist_node = __nccwpck_require__(53317);
278133
- ;// CONCATENATED MODULE: ../github/src/auth.ts
278310
+ ;// CONCATENATED MODULE: ../github/node_modules/universal-user-agent/index.js
278311
+ function node_modules_universal_user_agent_getUserAgent() {
278312
+ if (typeof navigator === "object" && "userAgent" in navigator) {
278313
+ return navigator.userAgent;
278314
+ }
278134
278315
 
278316
+ if (typeof process === "object" && process.version !== undefined) {
278317
+ return `Node.js/${process.version.substr(1)} (${process.platform}; ${
278318
+ process.arch
278319
+ })`;
278320
+ }
278135
278321
 
278322
+ return "<environment undetectable>";
278323
+ }
278136
278324
 
278325
+ ;// CONCATENATED MODULE: ../github/node_modules/@octokit/endpoint/dist-bundle/index.js
278326
+ // pkg/dist-src/defaults.js
278137
278327
 
278138
- const generateGithubAppToken = async (config) => {
278139
- try {
278140
- const { appId, privateKey, installationOrgId } = config;
278141
- const auth = (0,dist_node.createAppAuth)({
278142
- appId: appId,
278143
- privateKey: privateKey,
278144
- installationId: installationOrgId,
278145
- });
278146
- const authOptions = await auth({
278147
- type: 'installation',
278148
- });
278149
- return authOptions.token;
278150
- }
278151
- catch (error) {
278152
- console.error('Error generating github app token', error);
278153
- throw error;
278154
- }
278155
- };
278156
- async function getGithubAppToken(org = 'default', genGithubAppToken = generateGithubAppToken) {
278157
- const installationOrgId = catalog_common.environment.getFromEnvironmentWithDefault(org === 'prefapp'
278158
- ? catalog_common.types.envVars.githubAppInstallationIdPrefapp
278159
- : catalog_common.types.envVars.githubAppInstallationId);
278160
- const token = await genGithubAppToken({
278161
- appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
278162
- privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
278163
- installationOrgId: installationOrgId,
278164
- });
278165
- return token;
278166
- }
278167
- async function getOctokitForOrg(org = 'default', paginated = false, genGithubAppToken = generateGithubAppToken) {
278168
- if (org === 'prefapp')
278169
- return getOctokitFromPat(catalog_common.types.envVars.githubAppPatPrefapp);
278170
- const installationOrgId = catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppInstallationId);
278171
- const auth = await genGithubAppToken({
278172
- appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
278173
- privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
278174
- installationOrgId: installationOrgId,
278175
- });
278176
- const options = { auth: auth };
278177
- if (paginated) {
278178
- options.plugins = [dist_bundle_paginateRest];
278179
- }
278180
- return new dist_src_Octokit(options);
278181
- }
278182
- async function getOctokitFromPat(envVar) {
278183
- return new dist_src_Octokit({
278184
- auth: process.env[envVar],
278185
- });
278186
- }
278187
- /* harmony default export */ const src_auth = ({ getOctokitForOrg });
278188
278328
 
278189
- ;// CONCATENATED MODULE: ../github/src/organization.ts
278329
+ // pkg/dist-src/version.js
278330
+ var _octokit_endpoint_dist_bundle_VERSION = "0.0.0-development";
278190
278331
 
278332
+ // pkg/dist-src/defaults.js
278333
+ var endpoint_dist_bundle_userAgent = `octokit-endpoint.js/${_octokit_endpoint_dist_bundle_VERSION} ${node_modules_universal_user_agent_getUserAgent()}`;
278334
+ var endpoint_dist_bundle_DEFAULTS = {
278335
+ method: "GET",
278336
+ baseUrl: "https://api.github.com",
278337
+ headers: {
278338
+ accept: "application/vnd.github.v3+json",
278339
+ "user-agent": endpoint_dist_bundle_userAgent
278340
+ },
278341
+ mediaType: {
278342
+ format: ""
278343
+ }
278344
+ };
278191
278345
 
278192
- const organization_messageLog = src_default()('firestartr:github:organization');
278193
- const defaultPerPage = 100;
278194
- async function getRepositoryList(org, perPageEntries = defaultPerPage) {
278195
- organization_messageLog(`Getting repository list for ${org} with ${perPageEntries} entries per page`);
278196
- const octokit = await getOctokitForOrg(org);
278197
- const options = octokit.repos.listForOrg.endpoint.merge({
278198
- org: org,
278199
- per_page: perPageEntries,
278200
- type: 'all',
278201
- });
278202
- return await doPaginatedRequest(options);
278203
- }
278346
+ // pkg/dist-src/util/lowercase-keys.js
278347
+ function endpoint_dist_bundle_lowercaseKeys(object) {
278348
+ if (!object) {
278349
+ return {};
278350
+ }
278351
+ return Object.keys(object).reduce((newObj, key) => {
278352
+ newObj[key.toLowerCase()] = object[key];
278353
+ return newObj;
278354
+ }, {});
278355
+ }
278356
+
278357
+ // pkg/dist-src/util/is-plain-object.js
278358
+ function _octokit_endpoint_dist_bundle_isPlainObject(value) {
278359
+ if (typeof value !== "object" || value === null) return false;
278360
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
278361
+ const proto = Object.getPrototypeOf(value);
278362
+ if (proto === null) return true;
278363
+ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
278364
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
278365
+ }
278366
+
278367
+ // pkg/dist-src/util/merge-deep.js
278368
+ function endpoint_dist_bundle_mergeDeep(defaults, options) {
278369
+ const result = Object.assign({}, defaults);
278370
+ Object.keys(options).forEach((key) => {
278371
+ if (_octokit_endpoint_dist_bundle_isPlainObject(options[key])) {
278372
+ if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
278373
+ else result[key] = endpoint_dist_bundle_mergeDeep(defaults[key], options[key]);
278374
+ } else {
278375
+ Object.assign(result, { [key]: options[key] });
278376
+ }
278377
+ });
278378
+ return result;
278379
+ }
278380
+
278381
+ // pkg/dist-src/util/remove-undefined-properties.js
278382
+ function endpoint_dist_bundle_removeUndefinedProperties(obj) {
278383
+ for (const key in obj) {
278384
+ if (obj[key] === void 0) {
278385
+ delete obj[key];
278386
+ }
278387
+ }
278388
+ return obj;
278389
+ }
278390
+
278391
+ // pkg/dist-src/merge.js
278392
+ function endpoint_dist_bundle_merge(defaults, route, options) {
278393
+ if (typeof route === "string") {
278394
+ let [method, url] = route.split(" ");
278395
+ options = Object.assign(url ? { method, url } : { url: method }, options);
278396
+ } else {
278397
+ options = Object.assign({}, route);
278398
+ }
278399
+ options.headers = endpoint_dist_bundle_lowercaseKeys(options.headers);
278400
+ endpoint_dist_bundle_removeUndefinedProperties(options);
278401
+ endpoint_dist_bundle_removeUndefinedProperties(options.headers);
278402
+ const mergedOptions = endpoint_dist_bundle_mergeDeep(defaults || {}, options);
278403
+ if (options.url === "/graphql") {
278404
+ if (defaults && defaults.mediaType.previews?.length) {
278405
+ mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
278406
+ (preview) => !mergedOptions.mediaType.previews.includes(preview)
278407
+ ).concat(mergedOptions.mediaType.previews);
278408
+ }
278409
+ mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
278410
+ }
278411
+ return mergedOptions;
278412
+ }
278413
+
278414
+ // pkg/dist-src/util/add-query-parameters.js
278415
+ function endpoint_dist_bundle_addQueryParameters(url, parameters) {
278416
+ const separator = /\?/.test(url) ? "&" : "?";
278417
+ const names = Object.keys(parameters);
278418
+ if (names.length === 0) {
278419
+ return url;
278420
+ }
278421
+ return url + separator + names.map((name) => {
278422
+ if (name === "q") {
278423
+ return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
278424
+ }
278425
+ return `${name}=${encodeURIComponent(parameters[name])}`;
278426
+ }).join("&");
278427
+ }
278428
+
278429
+ // pkg/dist-src/util/extract-url-variable-names.js
278430
+ var endpoint_dist_bundle_urlVariableRegex = /\{[^{}}]+\}/g;
278431
+ function endpoint_dist_bundle_removeNonChars(variableName) {
278432
+ return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
278433
+ }
278434
+ function endpoint_dist_bundle_extractUrlVariableNames(url) {
278435
+ const matches = url.match(endpoint_dist_bundle_urlVariableRegex);
278436
+ if (!matches) {
278437
+ return [];
278438
+ }
278439
+ return matches.map(endpoint_dist_bundle_removeNonChars).reduce((a, b) => a.concat(b), []);
278440
+ }
278441
+
278442
+ // pkg/dist-src/util/omit.js
278443
+ function endpoint_dist_bundle_omit(object, keysToOmit) {
278444
+ const result = { __proto__: null };
278445
+ for (const key of Object.keys(object)) {
278446
+ if (keysToOmit.indexOf(key) === -1) {
278447
+ result[key] = object[key];
278448
+ }
278449
+ }
278450
+ return result;
278451
+ }
278452
+
278453
+ // pkg/dist-src/util/url-template.js
278454
+ function endpoint_dist_bundle_encodeReserved(str) {
278455
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
278456
+ if (!/%[0-9A-Fa-f]/.test(part)) {
278457
+ part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
278458
+ }
278459
+ return part;
278460
+ }).join("");
278461
+ }
278462
+ function endpoint_dist_bundle_encodeUnreserved(str) {
278463
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
278464
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
278465
+ });
278466
+ }
278467
+ function endpoint_dist_bundle_encodeValue(operator, value, key) {
278468
+ value = operator === "+" || operator === "#" ? endpoint_dist_bundle_encodeReserved(value) : endpoint_dist_bundle_encodeUnreserved(value);
278469
+ if (key) {
278470
+ return endpoint_dist_bundle_encodeUnreserved(key) + "=" + value;
278471
+ } else {
278472
+ return value;
278473
+ }
278474
+ }
278475
+ function endpoint_dist_bundle_isDefined(value) {
278476
+ return value !== void 0 && value !== null;
278477
+ }
278478
+ function endpoint_dist_bundle_isKeyOperator(operator) {
278479
+ return operator === ";" || operator === "&" || operator === "?";
278480
+ }
278481
+ function endpoint_dist_bundle_getValues(context, operator, key, modifier) {
278482
+ var value = context[key], result = [];
278483
+ if (endpoint_dist_bundle_isDefined(value) && value !== "") {
278484
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
278485
+ value = value.toString();
278486
+ if (modifier && modifier !== "*") {
278487
+ value = value.substring(0, parseInt(modifier, 10));
278488
+ }
278489
+ result.push(
278490
+ endpoint_dist_bundle_encodeValue(operator, value, endpoint_dist_bundle_isKeyOperator(operator) ? key : "")
278491
+ );
278492
+ } else {
278493
+ if (modifier === "*") {
278494
+ if (Array.isArray(value)) {
278495
+ value.filter(endpoint_dist_bundle_isDefined).forEach(function(value2) {
278496
+ result.push(
278497
+ endpoint_dist_bundle_encodeValue(operator, value2, endpoint_dist_bundle_isKeyOperator(operator) ? key : "")
278498
+ );
278499
+ });
278500
+ } else {
278501
+ Object.keys(value).forEach(function(k) {
278502
+ if (endpoint_dist_bundle_isDefined(value[k])) {
278503
+ result.push(endpoint_dist_bundle_encodeValue(operator, value[k], k));
278504
+ }
278505
+ });
278506
+ }
278507
+ } else {
278508
+ const tmp = [];
278509
+ if (Array.isArray(value)) {
278510
+ value.filter(endpoint_dist_bundle_isDefined).forEach(function(value2) {
278511
+ tmp.push(endpoint_dist_bundle_encodeValue(operator, value2));
278512
+ });
278513
+ } else {
278514
+ Object.keys(value).forEach(function(k) {
278515
+ if (endpoint_dist_bundle_isDefined(value[k])) {
278516
+ tmp.push(endpoint_dist_bundle_encodeUnreserved(k));
278517
+ tmp.push(endpoint_dist_bundle_encodeValue(operator, value[k].toString()));
278518
+ }
278519
+ });
278520
+ }
278521
+ if (endpoint_dist_bundle_isKeyOperator(operator)) {
278522
+ result.push(endpoint_dist_bundle_encodeUnreserved(key) + "=" + tmp.join(","));
278523
+ } else if (tmp.length !== 0) {
278524
+ result.push(tmp.join(","));
278525
+ }
278526
+ }
278527
+ }
278528
+ } else {
278529
+ if (operator === ";") {
278530
+ if (endpoint_dist_bundle_isDefined(value)) {
278531
+ result.push(endpoint_dist_bundle_encodeUnreserved(key));
278532
+ }
278533
+ } else if (value === "" && (operator === "&" || operator === "?")) {
278534
+ result.push(endpoint_dist_bundle_encodeUnreserved(key) + "=");
278535
+ } else if (value === "") {
278536
+ result.push("");
278537
+ }
278538
+ }
278539
+ return result;
278540
+ }
278541
+ function endpoint_dist_bundle_parseUrl(template) {
278542
+ return {
278543
+ expand: endpoint_dist_bundle_expand.bind(null, template)
278544
+ };
278545
+ }
278546
+ function endpoint_dist_bundle_expand(template, context) {
278547
+ var operators = ["+", "#", ".", "/", ";", "?", "&"];
278548
+ template = template.replace(
278549
+ /\{([^\{\}]+)\}|([^\{\}]+)/g,
278550
+ function(_, expression, literal) {
278551
+ if (expression) {
278552
+ let operator = "";
278553
+ const values = [];
278554
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
278555
+ operator = expression.charAt(0);
278556
+ expression = expression.substr(1);
278557
+ }
278558
+ expression.split(/,/g).forEach(function(variable) {
278559
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
278560
+ values.push(endpoint_dist_bundle_getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
278561
+ });
278562
+ if (operator && operator !== "+") {
278563
+ var separator = ",";
278564
+ if (operator === "?") {
278565
+ separator = "&";
278566
+ } else if (operator !== "#") {
278567
+ separator = operator;
278568
+ }
278569
+ return (values.length !== 0 ? operator : "") + values.join(separator);
278570
+ } else {
278571
+ return values.join(",");
278572
+ }
278573
+ } else {
278574
+ return endpoint_dist_bundle_encodeReserved(literal);
278575
+ }
278576
+ }
278577
+ );
278578
+ if (template === "/") {
278579
+ return template;
278580
+ } else {
278581
+ return template.replace(/\/$/, "");
278582
+ }
278583
+ }
278584
+
278585
+ // pkg/dist-src/parse.js
278586
+ function _octokit_endpoint_dist_bundle_parse(options) {
278587
+ let method = options.method.toUpperCase();
278588
+ let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
278589
+ let headers = Object.assign({}, options.headers);
278590
+ let body;
278591
+ let parameters = endpoint_dist_bundle_omit(options, [
278592
+ "method",
278593
+ "baseUrl",
278594
+ "url",
278595
+ "headers",
278596
+ "request",
278597
+ "mediaType"
278598
+ ]);
278599
+ const urlVariableNames = endpoint_dist_bundle_extractUrlVariableNames(url);
278600
+ url = endpoint_dist_bundle_parseUrl(url).expand(parameters);
278601
+ if (!/^http/.test(url)) {
278602
+ url = options.baseUrl + url;
278603
+ }
278604
+ const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
278605
+ const remainingParameters = endpoint_dist_bundle_omit(parameters, omittedParameters);
278606
+ const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
278607
+ if (!isBinaryRequest) {
278608
+ if (options.mediaType.format) {
278609
+ headers.accept = headers.accept.split(/,/).map(
278610
+ (format) => format.replace(
278611
+ /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
278612
+ `application/vnd$1$2.${options.mediaType.format}`
278613
+ )
278614
+ ).join(",");
278615
+ }
278616
+ if (url.endsWith("/graphql")) {
278617
+ if (options.mediaType.previews?.length) {
278618
+ const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
278619
+ headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
278620
+ const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
278621
+ return `application/vnd.github.${preview}-preview${format}`;
278622
+ }).join(",");
278623
+ }
278624
+ }
278625
+ }
278626
+ if (["GET", "HEAD"].includes(method)) {
278627
+ url = endpoint_dist_bundle_addQueryParameters(url, remainingParameters);
278628
+ } else {
278629
+ if ("data" in remainingParameters) {
278630
+ body = remainingParameters.data;
278631
+ } else {
278632
+ if (Object.keys(remainingParameters).length) {
278633
+ body = remainingParameters;
278634
+ }
278635
+ }
278636
+ }
278637
+ if (!headers["content-type"] && typeof body !== "undefined") {
278638
+ headers["content-type"] = "application/json; charset=utf-8";
278639
+ }
278640
+ if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
278641
+ body = "";
278642
+ }
278643
+ return Object.assign(
278644
+ { method, url, headers },
278645
+ typeof body !== "undefined" ? { body } : null,
278646
+ options.request ? { request: options.request } : null
278647
+ );
278648
+ }
278649
+
278650
+ // pkg/dist-src/endpoint-with-defaults.js
278651
+ function endpoint_dist_bundle_endpointWithDefaults(defaults, route, options) {
278652
+ return _octokit_endpoint_dist_bundle_parse(endpoint_dist_bundle_merge(defaults, route, options));
278653
+ }
278654
+
278655
+ // pkg/dist-src/with-defaults.js
278656
+ function _octokit_endpoint_dist_bundle_withDefaults(oldDefaults, newDefaults) {
278657
+ const DEFAULTS2 = endpoint_dist_bundle_merge(oldDefaults, newDefaults);
278658
+ const endpoint2 = endpoint_dist_bundle_endpointWithDefaults.bind(null, DEFAULTS2);
278659
+ return Object.assign(endpoint2, {
278660
+ DEFAULTS: DEFAULTS2,
278661
+ defaults: _octokit_endpoint_dist_bundle_withDefaults.bind(null, DEFAULTS2),
278662
+ merge: endpoint_dist_bundle_merge.bind(null, DEFAULTS2),
278663
+ parse: _octokit_endpoint_dist_bundle_parse
278664
+ });
278665
+ }
278666
+
278667
+ // pkg/dist-src/index.js
278668
+ var endpoint_dist_bundle_endpoint = _octokit_endpoint_dist_bundle_withDefaults(null, endpoint_dist_bundle_DEFAULTS);
278669
+
278670
+
278671
+ // EXTERNAL MODULE: ../github/node_modules/fast-content-type-parse/index.js
278672
+ var node_modules_fast_content_type_parse = __nccwpck_require__(88840);
278673
+ ;// CONCATENATED MODULE: ../github/node_modules/@octokit/request-error/dist-src/index.js
278674
+ class request_error_dist_src_RequestError extends Error {
278675
+ name;
278676
+ /**
278677
+ * http status code
278678
+ */
278679
+ status;
278680
+ /**
278681
+ * Request options that lead to the error.
278682
+ */
278683
+ request;
278684
+ /**
278685
+ * Response object if a response was received
278686
+ */
278687
+ response;
278688
+ constructor(message, statusCode, options) {
278689
+ super(message);
278690
+ this.name = "HttpError";
278691
+ this.status = Number.parseInt(statusCode);
278692
+ if (Number.isNaN(this.status)) {
278693
+ this.status = 0;
278694
+ }
278695
+ if ("response" in options) {
278696
+ this.response = options.response;
278697
+ }
278698
+ const requestCopy = Object.assign({}, options.request);
278699
+ if (options.request.headers.authorization) {
278700
+ requestCopy.headers = Object.assign({}, options.request.headers, {
278701
+ authorization: options.request.headers.authorization.replace(
278702
+ /(?<! ) .*$/,
278703
+ " [REDACTED]"
278704
+ )
278705
+ });
278706
+ }
278707
+ requestCopy.url = requestCopy.url.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]").replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
278708
+ this.request = requestCopy;
278709
+ }
278710
+ }
278711
+
278712
+
278713
+ ;// CONCATENATED MODULE: ../github/node_modules/@octokit/request/dist-bundle/index.js
278714
+ // pkg/dist-src/index.js
278715
+
278716
+
278717
+ // pkg/dist-src/defaults.js
278718
+
278719
+
278720
+ // pkg/dist-src/version.js
278721
+ var _octokit_request_dist_bundle_VERSION = "10.0.3";
278722
+
278723
+ // pkg/dist-src/defaults.js
278724
+ var request_dist_bundle_defaults_default = {
278725
+ headers: {
278726
+ "user-agent": `octokit-request.js/${_octokit_request_dist_bundle_VERSION} ${node_modules_universal_user_agent_getUserAgent()}`
278727
+ }
278728
+ };
278729
+
278730
+ // pkg/dist-src/fetch-wrapper.js
278731
+
278732
+
278733
+ // pkg/dist-src/is-plain-object.js
278734
+ function _octokit_request_dist_bundle_isPlainObject(value) {
278735
+ if (typeof value !== "object" || value === null) return false;
278736
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
278737
+ const proto = Object.getPrototypeOf(value);
278738
+ if (proto === null) return true;
278739
+ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
278740
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
278741
+ }
278742
+
278743
+ // pkg/dist-src/fetch-wrapper.js
278744
+
278745
+ async function request_dist_bundle_fetchWrapper(requestOptions) {
278746
+ const fetch = requestOptions.request?.fetch || globalThis.fetch;
278747
+ if (!fetch) {
278748
+ throw new Error(
278749
+ "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing"
278750
+ );
278751
+ }
278752
+ const log = requestOptions.request?.log || console;
278753
+ const parseSuccessResponseBody = requestOptions.request?.parseSuccessResponseBody !== false;
278754
+ const body = _octokit_request_dist_bundle_isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body) ? JSON.stringify(requestOptions.body) : requestOptions.body;
278755
+ const requestHeaders = Object.fromEntries(
278756
+ Object.entries(requestOptions.headers).map(([name, value]) => [
278757
+ name,
278758
+ String(value)
278759
+ ])
278760
+ );
278761
+ let fetchResponse;
278762
+ try {
278763
+ fetchResponse = await fetch(requestOptions.url, {
278764
+ method: requestOptions.method,
278765
+ body,
278766
+ redirect: requestOptions.request?.redirect,
278767
+ headers: requestHeaders,
278768
+ signal: requestOptions.request?.signal,
278769
+ // duplex must be set if request.body is ReadableStream or Async Iterables.
278770
+ // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
278771
+ ...requestOptions.body && { duplex: "half" }
278772
+ });
278773
+ } catch (error) {
278774
+ let message = "Unknown Error";
278775
+ if (error instanceof Error) {
278776
+ if (error.name === "AbortError") {
278777
+ error.status = 500;
278778
+ throw error;
278779
+ }
278780
+ message = error.message;
278781
+ if (error.name === "TypeError" && "cause" in error) {
278782
+ if (error.cause instanceof Error) {
278783
+ message = error.cause.message;
278784
+ } else if (typeof error.cause === "string") {
278785
+ message = error.cause;
278786
+ }
278787
+ }
278788
+ }
278789
+ const requestError = new request_error_dist_src_RequestError(message, 500, {
278790
+ request: requestOptions
278791
+ });
278792
+ requestError.cause = error;
278793
+ throw requestError;
278794
+ }
278795
+ const status = fetchResponse.status;
278796
+ const url = fetchResponse.url;
278797
+ const responseHeaders = {};
278798
+ for (const [key, value] of fetchResponse.headers) {
278799
+ responseHeaders[key] = value;
278800
+ }
278801
+ const octokitResponse = {
278802
+ url,
278803
+ status,
278804
+ headers: responseHeaders,
278805
+ data: ""
278806
+ };
278807
+ if ("deprecation" in responseHeaders) {
278808
+ const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
278809
+ const deprecationLink = matches && matches.pop();
278810
+ log.warn(
278811
+ `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
278812
+ );
278813
+ }
278814
+ if (status === 204 || status === 205) {
278815
+ return octokitResponse;
278816
+ }
278817
+ if (requestOptions.method === "HEAD") {
278818
+ if (status < 400) {
278819
+ return octokitResponse;
278820
+ }
278821
+ throw new request_error_dist_src_RequestError(fetchResponse.statusText, status, {
278822
+ response: octokitResponse,
278823
+ request: requestOptions
278824
+ });
278825
+ }
278826
+ if (status === 304) {
278827
+ octokitResponse.data = await request_dist_bundle_getResponseData(fetchResponse);
278828
+ throw new request_error_dist_src_RequestError("Not modified", status, {
278829
+ response: octokitResponse,
278830
+ request: requestOptions
278831
+ });
278832
+ }
278833
+ if (status >= 400) {
278834
+ octokitResponse.data = await request_dist_bundle_getResponseData(fetchResponse);
278835
+ throw new request_error_dist_src_RequestError(request_dist_bundle_toErrorMessage(octokitResponse.data), status, {
278836
+ response: octokitResponse,
278837
+ request: requestOptions
278838
+ });
278839
+ }
278840
+ octokitResponse.data = parseSuccessResponseBody ? await request_dist_bundle_getResponseData(fetchResponse) : fetchResponse.body;
278841
+ return octokitResponse;
278842
+ }
278843
+ async function request_dist_bundle_getResponseData(response) {
278844
+ const contentType = response.headers.get("content-type");
278845
+ if (!contentType) {
278846
+ return response.text().catch(() => "");
278847
+ }
278848
+ const mimetype = (0,node_modules_fast_content_type_parse/* safeParse */.As)(contentType);
278849
+ if (request_dist_bundle_isJSONResponse(mimetype)) {
278850
+ let text = "";
278851
+ try {
278852
+ text = await response.text();
278853
+ return JSON.parse(text);
278854
+ } catch (err) {
278855
+ return text;
278856
+ }
278857
+ } else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
278858
+ return response.text().catch(() => "");
278859
+ } else {
278860
+ return response.arrayBuffer().catch(() => new ArrayBuffer(0));
278861
+ }
278862
+ }
278863
+ function request_dist_bundle_isJSONResponse(mimetype) {
278864
+ return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
278865
+ }
278866
+ function request_dist_bundle_toErrorMessage(data) {
278867
+ if (typeof data === "string") {
278868
+ return data;
278869
+ }
278870
+ if (data instanceof ArrayBuffer) {
278871
+ return "Unknown error";
278872
+ }
278873
+ if ("message" in data) {
278874
+ const suffix = "documentation_url" in data ? ` - ${data.documentation_url}` : "";
278875
+ return Array.isArray(data.errors) ? `${data.message}: ${data.errors.map((v) => JSON.stringify(v)).join(", ")}${suffix}` : `${data.message}${suffix}`;
278876
+ }
278877
+ return `Unknown error: ${JSON.stringify(data)}`;
278878
+ }
278879
+
278880
+ // pkg/dist-src/with-defaults.js
278881
+ function _octokit_request_dist_bundle_withDefaults(oldEndpoint, newDefaults) {
278882
+ const endpoint2 = oldEndpoint.defaults(newDefaults);
278883
+ const newApi = function(route, parameters) {
278884
+ const endpointOptions = endpoint2.merge(route, parameters);
278885
+ if (!endpointOptions.request || !endpointOptions.request.hook) {
278886
+ return request_dist_bundle_fetchWrapper(endpoint2.parse(endpointOptions));
278887
+ }
278888
+ const request2 = (route2, parameters2) => {
278889
+ return request_dist_bundle_fetchWrapper(
278890
+ endpoint2.parse(endpoint2.merge(route2, parameters2))
278891
+ );
278892
+ };
278893
+ Object.assign(request2, {
278894
+ endpoint: endpoint2,
278895
+ defaults: _octokit_request_dist_bundle_withDefaults.bind(null, endpoint2)
278896
+ });
278897
+ return endpointOptions.request.hook(request2, endpointOptions);
278898
+ };
278899
+ return Object.assign(newApi, {
278900
+ endpoint: endpoint2,
278901
+ defaults: _octokit_request_dist_bundle_withDefaults.bind(null, endpoint2)
278902
+ });
278903
+ }
278904
+
278905
+ // pkg/dist-src/index.js
278906
+ var request_dist_bundle_request = _octokit_request_dist_bundle_withDefaults(endpoint_dist_bundle_endpoint, request_dist_bundle_defaults_default);
278907
+
278908
+
278909
+ ;// CONCATENATED MODULE: ../github/src/auth_installation.ts
278910
+
278911
+
278912
+
278913
+ async function getInstallationID(org = 'default') {
278914
+ const auth = (0,dist_node.createAppAuth)({
278915
+ appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
278916
+ privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
278917
+ request: request_dist_bundle_request,
278918
+ });
278919
+ const response = await request_dist_bundle_request(`GET /orgs/${org}/installation`, {
278920
+ org,
278921
+ request: {
278922
+ hook: auth.hook,
278923
+ },
278924
+ });
278925
+ return response.data.id;
278926
+ }
278927
+
278928
+ ;// CONCATENATED MODULE: ../github/src/auth.ts
278929
+
278930
+
278931
+
278932
+
278933
+
278934
+ const generateGithubAppToken = async (config) => {
278935
+ try {
278936
+ const { appId, privateKey, installationOrgId } = config;
278937
+ const auth = (0,dist_node.createAppAuth)({
278938
+ appId: appId,
278939
+ privateKey: privateKey,
278940
+ installationId: installationOrgId,
278941
+ });
278942
+ const authOptions = await auth({
278943
+ type: 'installation',
278944
+ });
278945
+ return authOptions.token;
278946
+ }
278947
+ catch (error) {
278948
+ console.error('Error generating github app token', error);
278949
+ throw error;
278950
+ }
278951
+ };
278952
+ async function getGithubAppToken(org = 'default', genGithubAppToken = generateGithubAppToken) {
278953
+ const token = await genGithubAppToken({
278954
+ appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
278955
+ privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
278956
+ installationOrgId: await getInstallationID(org),
278957
+ });
278958
+ return token;
278959
+ }
278960
+ async function getOctokitForOrg(org = 'default', paginated = false, genGithubAppToken = generateGithubAppToken) {
278961
+ if (org === 'prefapp')
278962
+ return getOctokitFromPat(catalog_common.types.envVars.githubAppPatPrefapp);
278963
+ const auth = await genGithubAppToken({
278964
+ appId: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppId),
278965
+ privateKey: catalog_common.environment.getFromEnvironment(catalog_common.types.envVars.githubAppPemFile),
278966
+ installationOrgId: await getInstallationID(org),
278967
+ });
278968
+ const options = { auth: auth };
278969
+ if (paginated) {
278970
+ options.plugins = [dist_bundle_paginateRest];
278971
+ }
278972
+ return new dist_src_Octokit(options);
278973
+ }
278974
+ async function getOctokitFromPat(envVar) {
278975
+ return new dist_src_Octokit({
278976
+ auth: process.env[envVar],
278977
+ });
278978
+ }
278979
+ /* harmony default export */ const src_auth = ({ getOctokitForOrg });
278980
+
278981
+ ;// CONCATENATED MODULE: ../github/src/organization.ts
278982
+
278983
+
278984
+ const organization_messageLog = src_default()('firestartr:github:organization');
278985
+ const defaultPerPage = 100;
278986
+ async function getRepositoryList(org, perPageEntries = defaultPerPage) {
278987
+ organization_messageLog(`Getting repository list for ${org} with ${perPageEntries} entries per page`);
278988
+ const octokit = await getOctokitForOrg(org);
278989
+ const options = octokit.repos.listForOrg.endpoint.merge({
278990
+ org: org,
278991
+ per_page: perPageEntries,
278992
+ type: 'all',
278993
+ });
278994
+ return await doPaginatedRequest(options);
278995
+ }
278204
278996
  async function getTeamList(org, perPageEntries = defaultPerPage) {
278205
278997
  organization_messageLog(`Getting team list for ${org} with ${perPageEntries} entries per page`);
278206
278998
  const octokit = await getOctokitForOrg(org);
@@ -282295,7 +283087,43 @@ const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createReq
282295
283087
 
282296
283088
 
282297
283089
  const lazy_loader_log = src_default()('firestartr:renderer:lazy_loader');
283090
+ // We need to ensure the grep command is a gnu version
283091
+ let IS_GNU_GREP = false;
283092
+ let GREP_ON_CHECK = false;
283093
+ // this loop is for avoid race conditions
283094
+ // once a check is running no more checks
283095
+ async function waitForCheck() {
283096
+ const f_wait = () => new Promise((timeOut) => setTimeout(timeOut, 10));
283097
+ do {
283098
+ await f_wait();
283099
+ } while (GREP_ON_CHECK);
283100
+ }
283101
+ function checkGrep() {
283102
+ return new Promise((ok, ko) => {
283103
+ // idempotency: already checked
283104
+ if (IS_GNU_GREP)
283105
+ return ok();
283106
+ // a check is already running no new checks
283107
+ if (GREP_ON_CHECK)
283108
+ return waitForCheck();
283109
+ lazy_loader_log('Checking the grep command');
283110
+ GREP_ON_CHECK = true;
283111
+ const handler = (0,external_node_child_process_namespaceObject.spawn)('grep', ['--version']);
283112
+ handler.on('close', (code) => {
283113
+ GREP_ON_CHECK = false;
283114
+ if (code === 0) {
283115
+ lazy_loader_log('Grep is a gnu grep');
283116
+ IS_GNU_GREP = true;
283117
+ ok();
283118
+ }
283119
+ else {
283120
+ ko('Lazy evaluation needs a gnu-grep command');
283121
+ }
283122
+ });
283123
+ });
283124
+ }
282298
283125
  async function loadClaim(claimRef, org, defaults = loadClaimDefaults(), patchClaim = loader_patchClaim, loadInitializers, loadGlobals, loadOverrides, loadNormalizers, cwd, existingRefs = {}) {
283126
+ await checkGrep();
282299
283127
  let result = existingRefs;
282300
283128
  lazy_loader_log(`Load reference ${claimRef}`);
282301
283129
  initVirtualClaims(org);
@@ -286944,7 +287772,7 @@ class FeatureRepoChart extends BaseGithubChart {
286944
287772
  spec: {
286945
287773
  context: claim.context,
286946
287774
  type: claim.name,
286947
- version: claim.feature.version || claim.feature.ref,
287775
+ version: claim.feature.version,
286948
287776
  org: claim.org,
286949
287777
  repositoryTarget,
286950
287778
  files: claim.files,
@@ -0,0 +1 @@
1
+ export declare function getInstallationID(org?: string): Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "1.44.1-snapshot-3",
3
+ "version": "1.45.0-snapshot-1",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",