@lukoweb/apitogo 0.1.136 → 0.1.137
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/cli/cli.js
CHANGED
|
@@ -5809,7 +5809,7 @@ import {
|
|
|
5809
5809
|
// package.json
|
|
5810
5810
|
var package_default = {
|
|
5811
5811
|
name: "@lukoweb/apitogo",
|
|
5812
|
-
version: "0.1.
|
|
5812
|
+
version: "0.1.137",
|
|
5813
5813
|
type: "module",
|
|
5814
5814
|
sideEffects: [
|
|
5815
5815
|
"**/*.css",
|
|
@@ -16864,11 +16864,17 @@ async function checkGatewayPlansOnPlatform(client, args) {
|
|
|
16864
16864
|
};
|
|
16865
16865
|
}
|
|
16866
16866
|
async function assertGatewayPlansValidForPublish(client, args) {
|
|
16867
|
+
const localErrors = args.localErrors ?? [];
|
|
16867
16868
|
const check2 = await checkGatewayPlansOnPlatform(client, args);
|
|
16868
|
-
|
|
16869
|
+
const localFields = new Set(localErrors.map((issue) => issue.field));
|
|
16870
|
+
const errors = [
|
|
16871
|
+
...localErrors,
|
|
16872
|
+
...(check2?.errors ?? []).filter((issue) => !localFields.has(issue.field))
|
|
16873
|
+
];
|
|
16874
|
+
if (errors.length === 0) {
|
|
16869
16875
|
return { blocked: false };
|
|
16870
16876
|
}
|
|
16871
|
-
const
|
|
16877
|
+
const warnings = check2?.warnings ?? [];
|
|
16872
16878
|
return {
|
|
16873
16879
|
blocked: true,
|
|
16874
16880
|
payload: {
|
|
@@ -16877,8 +16883,8 @@ async function assertGatewayPlansValidForPublish(client, args) {
|
|
|
16877
16883
|
...args.projectId ? { projectId: args.projectId } : {},
|
|
16878
16884
|
errors,
|
|
16879
16885
|
warnings,
|
|
16880
|
-
userMessage: `Deploy is blocked: apitogo.config.json has ${errors.length}
|
|
16881
|
-
nextStep: "Fix every issue listed in errors in apitogo.config.json
|
|
16886
|
+
userMessage: `Deploy is blocked: apitogo.config.json has ${errors.length} ${errors.length === 1 ? "error" : "errors"}.`,
|
|
16887
|
+
nextStep: "Fix every issue listed in errors in apitogo.config.json, then retry publish."
|
|
16882
16888
|
}
|
|
16883
16889
|
};
|
|
16884
16890
|
}
|
|
@@ -20988,19 +20994,23 @@ async function shouldSkipBackendRedeploy(client, projectId, manifest, ledger, ex
|
|
|
20988
20994
|
}
|
|
20989
20995
|
return { skip: false };
|
|
20990
20996
|
}
|
|
20991
|
-
function
|
|
20997
|
+
function prepareManifestForPublish(manifest) {
|
|
20992
20998
|
if (!manifest.plans?.length) {
|
|
20993
20999
|
throw new Error("apitogo.config.json must include at least one plan.");
|
|
20994
21000
|
}
|
|
20995
21001
|
const { manifest: normalized } = normalizeManifestForPlatform(manifest);
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21002
|
+
return {
|
|
21003
|
+
manifest: normalized,
|
|
21004
|
+
issues: validateManifestForPlatformPublish(normalized).issues
|
|
21005
|
+
};
|
|
21006
|
+
}
|
|
21007
|
+
function throwOnManifestIssues(issues) {
|
|
21008
|
+
if (issues.length === 0) {
|
|
21009
|
+
return;
|
|
21001
21010
|
}
|
|
21002
|
-
|
|
21003
|
-
|
|
21011
|
+
throw new Error(
|
|
21012
|
+
`apitogo.config.json is not platform-compatible: ${issues.map((issue) => `${issue.field}: ${issue.message}`).join("; ")}`
|
|
21013
|
+
);
|
|
21004
21014
|
}
|
|
21005
21015
|
async function runApplyFromSiteDirectory(client, config2, args, progress) {
|
|
21006
21016
|
const wait = args.wait !== false;
|
|
@@ -21055,18 +21065,17 @@ async function runApplyFromSiteDirectory(client, config2, args, progress) {
|
|
|
21055
21065
|
client,
|
|
21056
21066
|
projectIdHint
|
|
21057
21067
|
);
|
|
21058
|
-
const manifest =
|
|
21059
|
-
loadedManifest,
|
|
21060
|
-
secrets,
|
|
21061
|
-
emailOptions
|
|
21062
|
-
);
|
|
21063
|
-
await writeManifest(args.sourceDirectory, manifest);
|
|
21068
|
+
const { manifest, issues: manifestIssues } = prepareManifestForPublish(loadedManifest);
|
|
21064
21069
|
if (includeApihub) {
|
|
21065
21070
|
await publishProgress?.onStep("Validating gateway plans");
|
|
21066
21071
|
const plansGate = await assertGatewayPlansValidForPublish(client, {
|
|
21067
21072
|
projectId: args.createNewProject ? void 0 : projectIdHint,
|
|
21068
21073
|
plans: manifest.plans ?? [],
|
|
21069
|
-
planTier: args.platformPlan
|
|
21074
|
+
planTier: args.platformPlan,
|
|
21075
|
+
localErrors: manifestIssues.map(({ field, message }) => ({
|
|
21076
|
+
field,
|
|
21077
|
+
message
|
|
21078
|
+
}))
|
|
21070
21079
|
});
|
|
21071
21080
|
if (plansGate.blocked) {
|
|
21072
21081
|
return JSON.stringify(
|
|
@@ -21079,7 +21088,11 @@ async function runApplyFromSiteDirectory(client, config2, args, progress) {
|
|
|
21079
21088
|
2
|
|
21080
21089
|
);
|
|
21081
21090
|
}
|
|
21091
|
+
} else {
|
|
21092
|
+
throwOnManifestIssues(manifestIssues);
|
|
21082
21093
|
}
|
|
21094
|
+
validateSecretsForPublish(manifest, secrets, emailOptions);
|
|
21095
|
+
await writeManifest(args.sourceDirectory, manifest);
|
|
21083
21096
|
const stripeRequired = manifestRequiresStripe(manifest.plans);
|
|
21084
21097
|
const ledgerResume = resolveResumeStepFromLedger(ledger, PUBLISH_STEPS);
|
|
21085
21098
|
const effectiveResumeFromStep = args.resumeFromStep ?? ledgerResume;
|
|
@@ -21998,7 +22011,7 @@ function formatBlockedOrFailedResultForHuman(parsed) {
|
|
|
21998
22011
|
}
|
|
21999
22012
|
if (status2 === "blocked" && parsed.reason === "gateway_plans_invalid") {
|
|
22000
22013
|
const lines = [
|
|
22001
|
-
typeof parsed.userMessage === "string" ? parsed.userMessage : "Deploy is blocked: apitogo.config.json has
|
|
22014
|
+
typeof parsed.userMessage === "string" ? parsed.userMessage : "Deploy is blocked: apitogo.config.json has errors."
|
|
22002
22015
|
];
|
|
22003
22016
|
for (const issue of Array.isArray(parsed.errors) ? parsed.errors : []) {
|
|
22004
22017
|
lines.push(` - ${formatGatewayPlanIssue(issue)}`);
|
|
@@ -15,6 +15,7 @@ export declare function assertGatewayPlansValidForPublish(client: PlatformApiCli
|
|
|
15
15
|
projectId?: string;
|
|
16
16
|
plans: ManifestPlanInput[];
|
|
17
17
|
planTier?: string;
|
|
18
|
+
localErrors?: GatewayPlanValidationIssueDto[];
|
|
18
19
|
}): Promise<{
|
|
19
20
|
blocked: true;
|
|
20
21
|
payload: Record<string, unknown>;
|