repowise 0.1.92 → 0.1.94
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/dist/bin/repowise.js +41 -3
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -1006,7 +1006,7 @@ var init_tiers = __esm({
|
|
|
1006
1006
|
[SUBSCRIPTION_TIERS.TEAM]: {
|
|
1007
1007
|
maxRepos: 1,
|
|
1008
1008
|
maxSeats: 999999,
|
|
1009
|
-
minSeats:
|
|
1009
|
+
minSeats: 5,
|
|
1010
1010
|
maxSyncsPerMonth: 30,
|
|
1011
1011
|
maxConcurrentSyncs: 10,
|
|
1012
1012
|
freeFullScans: 1,
|
|
@@ -2426,7 +2426,8 @@ __export(sidecar_client_exports, {
|
|
|
2426
2426
|
uploadSidecar: () => uploadSidecar
|
|
2427
2427
|
});
|
|
2428
2428
|
async function uploadSidecar(req, fetchImpl = fetch) {
|
|
2429
|
-
const
|
|
2429
|
+
const base = req.apiUrl.replace(/\/$/, "");
|
|
2430
|
+
const repoSeg = encodeURIComponent(req.repoId);
|
|
2430
2431
|
const body = JSON.stringify({ ...req.sidecar, commitSha: req.commitSha });
|
|
2431
2432
|
const byteLength = Buffer.byteLength(body, "utf8");
|
|
2432
2433
|
if (byteLength > UPLOAD_BODY_BYTE_LIMIT) {
|
|
@@ -2439,6 +2440,43 @@ async function uploadSidecar(req, fetchImpl = fetch) {
|
|
|
2439
2440
|
error: msg
|
|
2440
2441
|
};
|
|
2441
2442
|
}
|
|
2443
|
+
const urlRes = await fetchImpl(`${base}/v1/repos/${repoSeg}/typed-resolution/upload-url`, {
|
|
2444
|
+
method: "POST",
|
|
2445
|
+
headers: {
|
|
2446
|
+
"content-type": "application/json",
|
|
2447
|
+
authorization: `Bearer ${req.authToken}`
|
|
2448
|
+
},
|
|
2449
|
+
body: JSON.stringify({ commitSha: req.commitSha })
|
|
2450
|
+
});
|
|
2451
|
+
if (urlRes.status === 404) {
|
|
2452
|
+
return uploadSidecarLegacy(req, body, fetchImpl);
|
|
2453
|
+
}
|
|
2454
|
+
if (!urlRes.ok) {
|
|
2455
|
+
const text = await urlRes.text().catch(() => "");
|
|
2456
|
+
throw new Error(`upload-url request failed: HTTP ${urlRes.status.toString()} ${text}`);
|
|
2457
|
+
}
|
|
2458
|
+
const urlPayload = await urlRes.json();
|
|
2459
|
+
const presignedUrl = urlPayload.data?.url;
|
|
2460
|
+
const uploadKey = urlPayload.data?.key ?? "";
|
|
2461
|
+
if (!presignedUrl)
|
|
2462
|
+
throw new Error("upload-url response missing `data.url`");
|
|
2463
|
+
const putRes = await fetchImpl(presignedUrl, {
|
|
2464
|
+
method: "PUT",
|
|
2465
|
+
headers: { "content-type": "application/json" },
|
|
2466
|
+
body
|
|
2467
|
+
});
|
|
2468
|
+
if (!putRes.ok) {
|
|
2469
|
+
const text = await putRes.text().catch(() => "");
|
|
2470
|
+
throw new Error(`S3 sidecar PUT failed: HTTP ${putRes.status.toString()} ${text}`);
|
|
2471
|
+
}
|
|
2472
|
+
return {
|
|
2473
|
+
uploaded: true,
|
|
2474
|
+
resolutionCount: req.sidecar.resolutions.length,
|
|
2475
|
+
uploadKey
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
async function uploadSidecarLegacy(req, body, fetchImpl) {
|
|
2479
|
+
const url = `${req.apiUrl.replace(/\/$/, "")}/v1/repos/${encodeURIComponent(req.repoId)}/typed-resolution`;
|
|
2442
2480
|
const res = await fetchImpl(url, {
|
|
2443
2481
|
method: "POST",
|
|
2444
2482
|
headers: {
|
|
@@ -2551,7 +2589,7 @@ var init_sidecar_client = __esm({
|
|
|
2551
2589
|
"../listener/dist/typed-resolution/sidecar-client.js"() {
|
|
2552
2590
|
"use strict";
|
|
2553
2591
|
init_src();
|
|
2554
|
-
UPLOAD_BODY_BYTE_LIMIT =
|
|
2592
|
+
UPLOAD_BODY_BYTE_LIMIT = 32 * 1024 * 1024;
|
|
2555
2593
|
}
|
|
2556
2594
|
});
|
|
2557
2595
|
|