@supacloud/cli 0.128.4 → 0.128.5
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/index.js +28 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44481,7 +44481,7 @@ async function runProjectDeployment(http, args) {
|
|
|
44481
44481
|
// package.json
|
|
44482
44482
|
var package_default = {
|
|
44483
44483
|
name: "@supacloud/cli",
|
|
44484
|
-
version: "0.128.
|
|
44484
|
+
version: "0.128.5",
|
|
44485
44485
|
description: "Project-scoped CLI for SupaCloud users",
|
|
44486
44486
|
type: "module",
|
|
44487
44487
|
main: "./dist/index.js",
|
|
@@ -44617,10 +44617,25 @@ function missingProjectContextFields(context) {
|
|
|
44617
44617
|
!context.projectRef ? "projectRef" : null
|
|
44618
44618
|
].filter((field) => Boolean(field));
|
|
44619
44619
|
}
|
|
44620
|
-
function authenticatedByProbe(authentication) {
|
|
44620
|
+
function authenticatedByProbe(scope, authentication) {
|
|
44621
44621
|
if (!authentication)
|
|
44622
44622
|
return null;
|
|
44623
|
-
|
|
44623
|
+
if (!authentication.reachable)
|
|
44624
|
+
return false;
|
|
44625
|
+
if (authentication.ok)
|
|
44626
|
+
return true;
|
|
44627
|
+
if (scope !== "project_application" && authentication.httpStatus === 404)
|
|
44628
|
+
return null;
|
|
44629
|
+
return false;
|
|
44630
|
+
}
|
|
44631
|
+
function projectProbeError(scope, authentication) {
|
|
44632
|
+
if (!authentication?.reachable || authentication.ok)
|
|
44633
|
+
return null;
|
|
44634
|
+
if (scope !== "project_application" && authentication.httpStatus === 404)
|
|
44635
|
+
return "project_not_found";
|
|
44636
|
+
if ([401, 403].includes(authentication.httpStatus ?? 0))
|
|
44637
|
+
return "authentication_rejected";
|
|
44638
|
+
return "project_unavailable";
|
|
44624
44639
|
}
|
|
44625
44640
|
function connectivityProbeIsHealthy(scope, connectivity) {
|
|
44626
44641
|
if (!connectivity)
|
|
@@ -44651,7 +44666,7 @@ function projectStatusProbePlan(context) {
|
|
|
44651
44666
|
authenticationHeaders: { Authorization: `Bearer ${context.apiToken}` }
|
|
44652
44667
|
};
|
|
44653
44668
|
}
|
|
44654
|
-
function projectStatusChecks(missing, connectivity, authentication, connectivityOk) {
|
|
44669
|
+
function projectStatusChecks(scope, missing, connectivity, authentication, connectivityOk) {
|
|
44655
44670
|
return {
|
|
44656
44671
|
configuration: { ok: missing.length === 0, missing },
|
|
44657
44672
|
connectivity: {
|
|
@@ -44660,8 +44675,14 @@ function projectStatusChecks(missing, connectivity, authentication, connectivity
|
|
|
44660
44675
|
httpStatus: connectivity?.httpStatus ?? null,
|
|
44661
44676
|
error: connectivity?.error ?? null
|
|
44662
44677
|
},
|
|
44663
|
-
authentication: {
|
|
44664
|
-
|
|
44678
|
+
authentication: {
|
|
44679
|
+
ok: authenticatedByProbe(scope, authentication),
|
|
44680
|
+
httpStatus: authentication?.httpStatus ?? null
|
|
44681
|
+
},
|
|
44682
|
+
project: {
|
|
44683
|
+
ok: authentication?.ok ?? null,
|
|
44684
|
+
error: projectProbeError(scope, authentication)
|
|
44685
|
+
}
|
|
44665
44686
|
};
|
|
44666
44687
|
}
|
|
44667
44688
|
async function collectProjectStatusChecks(context) {
|
|
@@ -44670,7 +44691,7 @@ async function collectProjectStatusChecks(context) {
|
|
|
44670
44691
|
const connectivity = probePlan.apiUrl ? await probeEndpoint(`${probePlan.apiUrl}${probePlan.connectivityPath}`, undefined, context.insecureTls) : null;
|
|
44671
44692
|
const connectivityOk = connectivityProbeIsHealthy(context.credentialScope, connectivity);
|
|
44672
44693
|
const authentication = missing.length === 0 && connectivityOk ? await probeEndpoint(`${probePlan.apiUrl}${probePlan.authenticationPath}`, probePlan.authenticationHeaders, context.insecureTls) : null;
|
|
44673
|
-
return projectStatusChecks(missing, connectivity, authentication, connectivityOk);
|
|
44694
|
+
return projectStatusChecks(context.credentialScope, missing, connectivity, authentication, connectivityOk);
|
|
44674
44695
|
}
|
|
44675
44696
|
function projectStatusIsHealthy(checks) {
|
|
44676
44697
|
return checks.configuration.ok && checks.connectivity.ok === true && checks.authentication.ok === true && checks.project.ok === true;
|