@lukoweb/apitogo 0.1.115 → 0.1.116
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
|
@@ -5801,7 +5801,7 @@ import {
|
|
|
5801
5801
|
// package.json
|
|
5802
5802
|
var package_default = {
|
|
5803
5803
|
name: "@lukoweb/apitogo",
|
|
5804
|
-
version: "0.1.
|
|
5804
|
+
version: "0.1.116",
|
|
5805
5805
|
type: "module",
|
|
5806
5806
|
sideEffects: [
|
|
5807
5807
|
"**/*.css",
|
|
@@ -16552,6 +16552,100 @@ var config_default = {
|
|
|
16552
16552
|
// src/cli/apply/handler.ts
|
|
16553
16553
|
import path63 from "node:path";
|
|
16554
16554
|
|
|
16555
|
+
// src/cli/platform/helpers/progress.ts
|
|
16556
|
+
var RECENT_JOB_MESSAGE_LIMIT = 5;
|
|
16557
|
+
function recentJobMessages(messages) {
|
|
16558
|
+
if (!messages?.length) {
|
|
16559
|
+
return [];
|
|
16560
|
+
}
|
|
16561
|
+
return messages.slice(-RECENT_JOB_MESSAGE_LIMIT);
|
|
16562
|
+
}
|
|
16563
|
+
function newMessagesSince(previousCount, messages) {
|
|
16564
|
+
if (!messages?.length || messages.length <= previousCount) {
|
|
16565
|
+
return [];
|
|
16566
|
+
}
|
|
16567
|
+
return messages.slice(previousCount);
|
|
16568
|
+
}
|
|
16569
|
+
function deriveCurrentStep(platformStatus, messages, stepLabel) {
|
|
16570
|
+
const latest = messages?.at(-1)?.message?.trim();
|
|
16571
|
+
if (latest) {
|
|
16572
|
+
return latest;
|
|
16573
|
+
}
|
|
16574
|
+
const normalized = platformStatus.toLowerCase();
|
|
16575
|
+
if (normalized === "pending" || normalized === "none") {
|
|
16576
|
+
return stepLabel ? `${stepLabel} queued` : "Queued";
|
|
16577
|
+
}
|
|
16578
|
+
if (normalized === "in_progress" || normalized === "running") {
|
|
16579
|
+
return stepLabel ? `${stepLabel} in progress` : "In progress";
|
|
16580
|
+
}
|
|
16581
|
+
if (normalized === "completed" || normalized === "healthy") {
|
|
16582
|
+
return stepLabel ? `${stepLabel} completed` : "Completed";
|
|
16583
|
+
}
|
|
16584
|
+
if (normalized === "failed" || normalized === "cancelled") {
|
|
16585
|
+
return stepLabel ? `${stepLabel} failed` : "Failed";
|
|
16586
|
+
}
|
|
16587
|
+
return stepLabel ?? platformStatus;
|
|
16588
|
+
}
|
|
16589
|
+
function buildProgressSummary(options) {
|
|
16590
|
+
return {
|
|
16591
|
+
stepsCompleted: options.stepLabel,
|
|
16592
|
+
lastMessage: options.messages?.at(-1)?.message ?? null,
|
|
16593
|
+
elapsedMs: Date.now() - options.startedAtMs,
|
|
16594
|
+
terminalStatus: options.terminalStatus
|
|
16595
|
+
};
|
|
16596
|
+
}
|
|
16597
|
+
function createConsoleProgressReporter(stream = process.stderr) {
|
|
16598
|
+
return createScopedConsoleProgressReporter(stream, void 0);
|
|
16599
|
+
}
|
|
16600
|
+
function createScopedConsoleProgressReporter(stream, stepLabel) {
|
|
16601
|
+
let lastMessageCount = 0;
|
|
16602
|
+
let lastLine;
|
|
16603
|
+
const reporter = {
|
|
16604
|
+
async onStep(step, detail) {
|
|
16605
|
+
const message = detail?.message ?? (detail?.platformStatus ? `${step}: ${detail.platformStatus}` : step);
|
|
16606
|
+
const line = stepLabel ? `[${stepLabel}] ${message}` : message;
|
|
16607
|
+
if (line === lastLine) return;
|
|
16608
|
+
lastLine = line;
|
|
16609
|
+
stream.write(`${line}
|
|
16610
|
+
`);
|
|
16611
|
+
},
|
|
16612
|
+
async onNewMessages(messages) {
|
|
16613
|
+
for (const entry of messages) {
|
|
16614
|
+
const line = stepLabel ? `[${stepLabel}] ${entry.message}` : entry.message;
|
|
16615
|
+
stream.write(`${line}
|
|
16616
|
+
`);
|
|
16617
|
+
}
|
|
16618
|
+
},
|
|
16619
|
+
isCancelled: () => false,
|
|
16620
|
+
child(label) {
|
|
16621
|
+
return createScopedConsoleProgressReporter(stream, label);
|
|
16622
|
+
}
|
|
16623
|
+
};
|
|
16624
|
+
const baseOnNewMessages = reporter.onNewMessages.bind(reporter);
|
|
16625
|
+
reporter.onNewMessages = async (messages) => {
|
|
16626
|
+
const delta = newMessagesSince(lastMessageCount, messages);
|
|
16627
|
+
lastMessageCount = messages.length;
|
|
16628
|
+
await baseOnNewMessages(delta);
|
|
16629
|
+
};
|
|
16630
|
+
return reporter;
|
|
16631
|
+
}
|
|
16632
|
+
async function reportPollProgress(progress, stepLabel, value) {
|
|
16633
|
+
if (!progress) {
|
|
16634
|
+
return;
|
|
16635
|
+
}
|
|
16636
|
+
if (progress.isCancelled()) {
|
|
16637
|
+
throw new Error("Operation cancelled.");
|
|
16638
|
+
}
|
|
16639
|
+
const latestMessage = value.messages?.at(-1)?.message;
|
|
16640
|
+
await progress.onStep(stepLabel, {
|
|
16641
|
+
platformStatus: value.status,
|
|
16642
|
+
message: latestMessage
|
|
16643
|
+
});
|
|
16644
|
+
if (value.messages?.length) {
|
|
16645
|
+
await progress.onNewMessages(value.messages);
|
|
16646
|
+
}
|
|
16647
|
+
}
|
|
16648
|
+
|
|
16555
16649
|
// src/cli/platform/tools/dev-portal-publish.ts
|
|
16556
16650
|
init_gateway_limits();
|
|
16557
16651
|
|
|
@@ -17164,59 +17258,6 @@ function resolveDevPortalUrls(project, backendFqdn, providerIds = [], platformSi
|
|
|
17164
17258
|
};
|
|
17165
17259
|
}
|
|
17166
17260
|
|
|
17167
|
-
// src/cli/platform/helpers/progress.ts
|
|
17168
|
-
var RECENT_JOB_MESSAGE_LIMIT = 5;
|
|
17169
|
-
function recentJobMessages(messages) {
|
|
17170
|
-
if (!messages?.length) {
|
|
17171
|
-
return [];
|
|
17172
|
-
}
|
|
17173
|
-
return messages.slice(-RECENT_JOB_MESSAGE_LIMIT);
|
|
17174
|
-
}
|
|
17175
|
-
function deriveCurrentStep(platformStatus, messages, stepLabel) {
|
|
17176
|
-
const latest = messages?.at(-1)?.message?.trim();
|
|
17177
|
-
if (latest) {
|
|
17178
|
-
return latest;
|
|
17179
|
-
}
|
|
17180
|
-
const normalized = platformStatus.toLowerCase();
|
|
17181
|
-
if (normalized === "pending" || normalized === "none") {
|
|
17182
|
-
return stepLabel ? `${stepLabel} queued` : "Queued";
|
|
17183
|
-
}
|
|
17184
|
-
if (normalized === "in_progress" || normalized === "running") {
|
|
17185
|
-
return stepLabel ? `${stepLabel} in progress` : "In progress";
|
|
17186
|
-
}
|
|
17187
|
-
if (normalized === "completed" || normalized === "healthy") {
|
|
17188
|
-
return stepLabel ? `${stepLabel} completed` : "Completed";
|
|
17189
|
-
}
|
|
17190
|
-
if (normalized === "failed" || normalized === "cancelled") {
|
|
17191
|
-
return stepLabel ? `${stepLabel} failed` : "Failed";
|
|
17192
|
-
}
|
|
17193
|
-
return stepLabel ?? platformStatus;
|
|
17194
|
-
}
|
|
17195
|
-
function buildProgressSummary(options) {
|
|
17196
|
-
return {
|
|
17197
|
-
stepsCompleted: options.stepLabel,
|
|
17198
|
-
lastMessage: options.messages?.at(-1)?.message ?? null,
|
|
17199
|
-
elapsedMs: Date.now() - options.startedAtMs,
|
|
17200
|
-
terminalStatus: options.terminalStatus
|
|
17201
|
-
};
|
|
17202
|
-
}
|
|
17203
|
-
async function reportPollProgress(progress, stepLabel, value) {
|
|
17204
|
-
if (!progress) {
|
|
17205
|
-
return;
|
|
17206
|
-
}
|
|
17207
|
-
if (progress.isCancelled()) {
|
|
17208
|
-
throw new Error("Operation cancelled.");
|
|
17209
|
-
}
|
|
17210
|
-
const latestMessage = value.messages?.at(-1)?.message;
|
|
17211
|
-
await progress.onStep(stepLabel, {
|
|
17212
|
-
platformStatus: value.status,
|
|
17213
|
-
message: latestMessage
|
|
17214
|
-
});
|
|
17215
|
-
if (value.messages?.length) {
|
|
17216
|
-
await progress.onNewMessages(value.messages);
|
|
17217
|
-
}
|
|
17218
|
-
}
|
|
17219
|
-
|
|
17220
17261
|
// src/cli/platform/helpers/status.ts
|
|
17221
17262
|
function normalizeInfrastructureStatus(platformStatus) {
|
|
17222
17263
|
switch (platformStatus.toLowerCase()) {
|
|
@@ -21370,16 +21411,22 @@ async function apply(argv) {
|
|
|
21370
21411
|
}
|
|
21371
21412
|
}
|
|
21372
21413
|
const platformPlan = argv.platformPlan?.trim();
|
|
21373
|
-
const
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21414
|
+
const progress = createConsoleProgressReporter();
|
|
21415
|
+
const runOnce = (plan) => runApplyFromSiteDirectory(
|
|
21416
|
+
client,
|
|
21417
|
+
config2,
|
|
21418
|
+
{
|
|
21419
|
+
sourceDirectory,
|
|
21420
|
+
projectId: argv.projectId?.trim(),
|
|
21421
|
+
projectName: argv.projectName?.trim(),
|
|
21422
|
+
platformPlan: plan,
|
|
21423
|
+
only,
|
|
21424
|
+
force: argv.force,
|
|
21425
|
+
resumeFromStep: argv.resumeFrom?.trim(),
|
|
21426
|
+
wait: argv.wait !== false
|
|
21427
|
+
},
|
|
21428
|
+
progress
|
|
21429
|
+
);
|
|
21383
21430
|
let result;
|
|
21384
21431
|
try {
|
|
21385
21432
|
result = await runOnce(platformPlan);
|
|
@@ -22334,14 +22381,19 @@ async function createProject(argv) {
|
|
|
22334
22381
|
const client = new PlatformApiClient(config2);
|
|
22335
22382
|
let result;
|
|
22336
22383
|
try {
|
|
22337
|
-
result = await handleBootstrapProject(
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22384
|
+
result = await handleBootstrapProject(
|
|
22385
|
+
client,
|
|
22386
|
+
config2,
|
|
22387
|
+
{
|
|
22388
|
+
name,
|
|
22389
|
+
description: argv.description?.trim(),
|
|
22390
|
+
modules: modules.length > 0 ? modules : ["apihub"],
|
|
22391
|
+
selectFreePlan: false,
|
|
22392
|
+
wait: argv.wait !== false,
|
|
22393
|
+
configureGatewayBaseline: false
|
|
22394
|
+
},
|
|
22395
|
+
createConsoleProgressReporter()
|
|
22396
|
+
);
|
|
22345
22397
|
} catch (error) {
|
|
22346
22398
|
await printCriticalFailureToConsoleAndExit(
|
|
22347
22399
|
error instanceof Error ? error.message : String(error)
|
|
@@ -22896,10 +22948,15 @@ async function teardown(argv) {
|
|
|
22896
22948
|
}
|
|
22897
22949
|
let result;
|
|
22898
22950
|
try {
|
|
22899
|
-
result = await handleTeardownProject(
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22951
|
+
result = await handleTeardownProject(
|
|
22952
|
+
client,
|
|
22953
|
+
config2,
|
|
22954
|
+
{
|
|
22955
|
+
projectId,
|
|
22956
|
+
wait: argv.wait !== false
|
|
22957
|
+
},
|
|
22958
|
+
createConsoleProgressReporter()
|
|
22959
|
+
);
|
|
22903
22960
|
} catch (error) {
|
|
22904
22961
|
await printCriticalFailureToConsoleAndExit(
|
|
22905
22962
|
error instanceof Error ? error.message : String(error)
|
|
@@ -38,6 +38,7 @@ export declare function buildProgressSummary(options: {
|
|
|
38
38
|
terminalStatus: string;
|
|
39
39
|
};
|
|
40
40
|
export declare function createMcpProgressReporter(extra?: McpToolExtra): ProgressReporter;
|
|
41
|
+
export declare function createConsoleProgressReporter(stream?: NodeJS.WritableStream): ProgressReporter;
|
|
41
42
|
export interface PollableJobValue {
|
|
42
43
|
status: string;
|
|
43
44
|
messages?: JobLogMessage[];
|