@firestartr/cli 0.1.10 → 0.1.12
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 +705 -205
- package/build/provisioner/dist-cdktf/index.js +142 -4
- package/build/provisioner/dist-cdktf/index.js.map +1 -1
- package/build/provisioner/dist-cdktf/src/handlers/index.d.ts +1 -1
- package/build/provisioner/dist-cdktf/tsconfig.cdktf.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -49875,6 +49875,7 @@ const types_1 = __importDefault(__nccwpck_require__(130));
|
|
|
49875
49875
|
const environment_1 = __importDefault(__nccwpck_require__(2938));
|
|
49876
49876
|
const defaults_1 = __importDefault(__nccwpck_require__(195));
|
|
49877
49877
|
const features_1 = __importDefault(__nccwpck_require__(9727));
|
|
49878
|
+
const policies_1 = __importDefault(__nccwpck_require__(8141));
|
|
49878
49879
|
var github_1 = __nccwpck_require__(6666);
|
|
49879
49880
|
Object.defineProperty(exports, "BranchStrategy", ({ enumerable: true, get: function () { return github_1.BranchStrategy; } }));
|
|
49880
49881
|
exports["default"] = {
|
|
@@ -49883,7 +49884,8 @@ exports["default"] = {
|
|
|
49883
49884
|
types: types_1.default,
|
|
49884
49885
|
environment: environment_1.default,
|
|
49885
49886
|
defaults: defaults_1.default,
|
|
49886
|
-
features: features_1.default
|
|
49887
|
+
features: features_1.default,
|
|
49888
|
+
policies: policies_1.default
|
|
49887
49889
|
};
|
|
49888
49890
|
|
|
49889
49891
|
|
|
@@ -51124,6 +51126,108 @@ function writeLogFile(fileName, log) {
|
|
|
51124
51126
|
exports.writeLogFile = writeLogFile;
|
|
51125
51127
|
|
|
51126
51128
|
|
|
51129
|
+
/***/ }),
|
|
51130
|
+
|
|
51131
|
+
/***/ 8141:
|
|
51132
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
51133
|
+
|
|
51134
|
+
"use strict";
|
|
51135
|
+
|
|
51136
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51137
|
+
const policies_1 = __nccwpck_require__(2713);
|
|
51138
|
+
exports["default"] = {
|
|
51139
|
+
policiesAreCompatible: policies_1.policiesAreCompatible,
|
|
51140
|
+
getPolicyByName: policies_1.getPolicyByName,
|
|
51141
|
+
FIRESTARTR_POLICIES: policies_1.FIRESTARTR_POLICIES
|
|
51142
|
+
};
|
|
51143
|
+
|
|
51144
|
+
|
|
51145
|
+
/***/ }),
|
|
51146
|
+
|
|
51147
|
+
/***/ 2713:
|
|
51148
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
51149
|
+
|
|
51150
|
+
"use strict";
|
|
51151
|
+
|
|
51152
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51153
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51154
|
+
};
|
|
51155
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51156
|
+
exports.policiesAreCompatible = exports.getPolicyByName = exports.FIRESTARTR_POLICIES = void 0;
|
|
51157
|
+
const debug_1 = __importDefault(__nccwpck_require__(7984));
|
|
51158
|
+
const log = (0, debug_1.default)("firestartr:catalog_common:policies");
|
|
51159
|
+
exports.FIRESTARTR_POLICIES = [
|
|
51160
|
+
{
|
|
51161
|
+
name: "full-control",
|
|
51162
|
+
weight: 10,
|
|
51163
|
+
aliases: [],
|
|
51164
|
+
allowedOps: [
|
|
51165
|
+
"UPDATED",
|
|
51166
|
+
"CREATED",
|
|
51167
|
+
"RENAMED",
|
|
51168
|
+
"SYNC",
|
|
51169
|
+
"MARKED_TO_DELETION",
|
|
51170
|
+
"RETRY",
|
|
51171
|
+
"NOTHING"
|
|
51172
|
+
]
|
|
51173
|
+
},
|
|
51174
|
+
{
|
|
51175
|
+
name: "apply",
|
|
51176
|
+
weight: 9,
|
|
51177
|
+
aliases: [
|
|
51178
|
+
"create-update-only"
|
|
51179
|
+
],
|
|
51180
|
+
allowedOps: [
|
|
51181
|
+
"UPDATED",
|
|
51182
|
+
"CREATED",
|
|
51183
|
+
"RENAMED",
|
|
51184
|
+
"SYNC",
|
|
51185
|
+
"RETRY",
|
|
51186
|
+
"NOTHING"
|
|
51187
|
+
]
|
|
51188
|
+
},
|
|
51189
|
+
{
|
|
51190
|
+
name: "observe",
|
|
51191
|
+
weight: 8,
|
|
51192
|
+
aliases: [
|
|
51193
|
+
"observe-only"
|
|
51194
|
+
],
|
|
51195
|
+
allowedOps: [
|
|
51196
|
+
"SYNC"
|
|
51197
|
+
]
|
|
51198
|
+
},
|
|
51199
|
+
{
|
|
51200
|
+
name: "create-only",
|
|
51201
|
+
weight: 8,
|
|
51202
|
+
aliases: [],
|
|
51203
|
+
allowedOps: [
|
|
51204
|
+
"CREATED",
|
|
51205
|
+
"RETRY",
|
|
51206
|
+
"SYNC",
|
|
51207
|
+
]
|
|
51208
|
+
},
|
|
51209
|
+
];
|
|
51210
|
+
function getPolicyByName(policyName) {
|
|
51211
|
+
return exports.FIRESTARTR_POLICIES.find(p => p.name === policyName || p.aliases.includes(policyName));
|
|
51212
|
+
}
|
|
51213
|
+
exports.getPolicyByName = getPolicyByName;
|
|
51214
|
+
function policiesAreCompatible(syncPolicy, generalPolicy) {
|
|
51215
|
+
log("Validating policy compatibility: %s %s", syncPolicy, generalPolicy);
|
|
51216
|
+
const syncPolicyWeight = getPolicyByName(syncPolicy)?.weight;
|
|
51217
|
+
const generalPolicyWeight = getPolicyByName(generalPolicy)?.weight;
|
|
51218
|
+
if (!syncPolicyWeight || !generalPolicyWeight) {
|
|
51219
|
+
throw new Error(`Policy ${syncPolicy} or ${generalPolicy} not found`);
|
|
51220
|
+
}
|
|
51221
|
+
if (generalPolicyWeight >= syncPolicyWeight) {
|
|
51222
|
+
log("Policies %s %s are compatible", syncPolicy, generalPolicy);
|
|
51223
|
+
return true;
|
|
51224
|
+
}
|
|
51225
|
+
log("Policies %s %s are not compatible", syncPolicy, generalPolicy);
|
|
51226
|
+
return false;
|
|
51227
|
+
}
|
|
51228
|
+
exports.policiesAreCompatible = policiesAreCompatible;
|
|
51229
|
+
|
|
51230
|
+
|
|
51127
51231
|
/***/ }),
|
|
51128
51232
|
|
|
51129
51233
|
/***/ 3591:
|
|
@@ -51624,7 +51728,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
51624
51728
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51625
51729
|
};
|
|
51626
51730
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51627
|
-
exports.commentInPR = void 0;
|
|
51731
|
+
exports.getPrFiles = exports.commentInPR = void 0;
|
|
51628
51732
|
const auth_1 = __nccwpck_require__(7745);
|
|
51629
51733
|
const debug_1 = __importDefault(__nccwpck_require__(7984));
|
|
51630
51734
|
const messageLog = (0, debug_1.default)('firestartr:github:pull_request');
|
|
@@ -51636,7 +51740,39 @@ async function commentInPR(comment, pr_number, repo, owner = "prefapp") {
|
|
|
51636
51740
|
});
|
|
51637
51741
|
}
|
|
51638
51742
|
exports.commentInPR = commentInPR;
|
|
51639
|
-
|
|
51743
|
+
async function getPrFiles(pr_number, repo, owner = "prefapp") {
|
|
51744
|
+
messageLog(`Getting PR details of PR ${pr_number} of ${owner}/${repo}`);
|
|
51745
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51746
|
+
return await octokit.rest.pulls.listFiles({
|
|
51747
|
+
owner, repo, pull_number: pr_number
|
|
51748
|
+
});
|
|
51749
|
+
}
|
|
51750
|
+
exports.getPrFiles = getPrFiles;
|
|
51751
|
+
async function filterPrBy(filter, opts) {
|
|
51752
|
+
let foundPr = null;
|
|
51753
|
+
let retries = 0;
|
|
51754
|
+
const { title, state, repo, owner, userType } = filter;
|
|
51755
|
+
const { maxRetries } = opts;
|
|
51756
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51757
|
+
while (retries < maxRetries) {
|
|
51758
|
+
const resp = await octokit.rest.pulls.list({
|
|
51759
|
+
owner,
|
|
51760
|
+
repo,
|
|
51761
|
+
state,
|
|
51762
|
+
per_page: 100,
|
|
51763
|
+
page: retries
|
|
51764
|
+
});
|
|
51765
|
+
foundPr = resp.data.find(pr => {
|
|
51766
|
+
return pr.title
|
|
51767
|
+
.includes(title) &&
|
|
51768
|
+
pr?.user?.type === userType;
|
|
51769
|
+
});
|
|
51770
|
+
if (foundPr)
|
|
51771
|
+
return foundPr;
|
|
51772
|
+
retries++;
|
|
51773
|
+
}
|
|
51774
|
+
}
|
|
51775
|
+
exports["default"] = { commentInPR, getPrFiles, filterPrBy };
|
|
51640
51776
|
|
|
51641
51777
|
|
|
51642
51778
|
/***/ }),
|
|
@@ -51683,7 +51819,9 @@ async function listReleases(repo, owner = "prefapp") {
|
|
|
51683
51819
|
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51684
51820
|
const response = await octokit.rest.repos.listReleases({
|
|
51685
51821
|
owner,
|
|
51686
|
-
repo
|
|
51822
|
+
repo,
|
|
51823
|
+
per_page: 100,
|
|
51824
|
+
page: 0
|
|
51687
51825
|
});
|
|
51688
51826
|
return response.data;
|
|
51689
51827
|
}
|