@devkong/cli 0.0.67-alpha.3 → 0.0.67-alpha.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/index.js
CHANGED
|
@@ -63094,12 +63094,12 @@ var ManagementClient = class {
|
|
|
63094
63094
|
const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
|
|
63095
63095
|
return (await axios_default.get(url2, await this.requestConfigProvider())).data;
|
|
63096
63096
|
}
|
|
63097
|
-
async getAuditLog(objectType2, objectId) {
|
|
63097
|
+
async getAuditLog(objectType2, objectId, createdAfter) {
|
|
63098
63098
|
const url2 = joinUrlAndPath(this.baseUrl, "v1/audit");
|
|
63099
63099
|
const config = await this.requestConfigProvider();
|
|
63100
63100
|
const response = await axios_default.get(url2, {
|
|
63101
63101
|
...config,
|
|
63102
|
-
params: { ...config.params, objectType: objectType2, objectId }
|
|
63102
|
+
params: { ...config.params, objectType: objectType2, objectId, createdAfter }
|
|
63103
63103
|
});
|
|
63104
63104
|
return response.data;
|
|
63105
63105
|
}
|
|
@@ -63453,8 +63453,12 @@ function analyzeDeployment(events) {
|
|
|
63453
63453
|
}
|
|
63454
63454
|
async function getDeploymentLog(management, query) {
|
|
63455
63455
|
const [aliasEvents, baseEvents] = await Promise.all([
|
|
63456
|
-
management.getAuditLog(
|
|
63457
|
-
|
|
63456
|
+
management.getAuditLog(
|
|
63457
|
+
query.objectType,
|
|
63458
|
+
`${query.basedOnId}-${query.aliasName}`,
|
|
63459
|
+
query.createdAfter
|
|
63460
|
+
),
|
|
63461
|
+
management.getAuditLog(query.objectType, query.basedOnId, query.createdAfter)
|
|
63458
63462
|
]);
|
|
63459
63463
|
return [...aliasEvents, ...baseEvents].sort((a, b) => b.created.localeCompare(a.created));
|
|
63460
63464
|
}
|
|
@@ -63525,6 +63529,7 @@ var SetAliasCommand = class {
|
|
|
63525
63529
|
}
|
|
63526
63530
|
async execute(aliasName, extensionVersion, timeoutSeconds) {
|
|
63527
63531
|
validateName(aliasName);
|
|
63532
|
+
const startedAt = utcNow(DEFAULT_TIMEZONE);
|
|
63528
63533
|
await new Listr(
|
|
63529
63534
|
[
|
|
63530
63535
|
{
|
|
@@ -63578,23 +63583,25 @@ var SetAliasCommand = class {
|
|
|
63578
63583
|
{
|
|
63579
63584
|
title: "Wait for deployment",
|
|
63580
63585
|
task: async (ctx, task) => {
|
|
63581
|
-
|
|
63582
|
-
const printNewEvents = (events) => {
|
|
63583
|
-
for (const event of [...events].reverse()) {
|
|
63584
|
-
const key = `${event.created}|${event.action}`;
|
|
63585
|
-
if (seen.has(key)) {
|
|
63586
|
-
continue;
|
|
63587
|
-
}
|
|
63588
|
-
seen.add(key);
|
|
63589
|
-
task.output = `${event.eventType === "error" ? "\u2717" : "\u2713"} ${event.action}`;
|
|
63590
|
-
}
|
|
63591
|
-
};
|
|
63586
|
+
let stopped = false;
|
|
63592
63587
|
const result = await pollDeployment(this.managementClient, {
|
|
63593
63588
|
objectType: "EXTENSION_ALIAS",
|
|
63594
63589
|
basedOnId: ctx.kongJson.id,
|
|
63595
63590
|
aliasName,
|
|
63591
|
+
createdAfter: startedAt,
|
|
63596
63592
|
timeoutSeconds,
|
|
63597
|
-
onProgress: (progress) =>
|
|
63593
|
+
onProgress: (progress) => {
|
|
63594
|
+
if (stopped) {
|
|
63595
|
+
return;
|
|
63596
|
+
}
|
|
63597
|
+
const latest = progress.events[0];
|
|
63598
|
+
if (latest) {
|
|
63599
|
+
task.output = `${latest.eventType === "error" ? "\u2717" : "\u2713"} ${latest.action}`;
|
|
63600
|
+
}
|
|
63601
|
+
if (progress.status === "failed") {
|
|
63602
|
+
stopped = true;
|
|
63603
|
+
}
|
|
63604
|
+
}
|
|
63598
63605
|
});
|
|
63599
63606
|
if (result.status === "failed") {
|
|
63600
63607
|
throw new AppError(deploymentErrorMessage(result.events));
|
|
@@ -63603,7 +63610,7 @@ var SetAliasCommand = class {
|
|
|
63603
63610
|
task.output = `Still deploying after ${result.waitedSeconds}s \u2014 check the UI for completion.`;
|
|
63604
63611
|
}
|
|
63605
63612
|
},
|
|
63606
|
-
rendererOptions: {
|
|
63613
|
+
rendererOptions: { persistentOutput: true }
|
|
63607
63614
|
}
|
|
63608
63615
|
],
|
|
63609
63616
|
{
|
package/package.json
CHANGED
|
@@ -12,6 +12,8 @@ export interface DeploymentQuery {
|
|
|
12
12
|
objectType: DeployObjectType;
|
|
13
13
|
basedOnId: string;
|
|
14
14
|
aliasName: string;
|
|
15
|
+
/** Only fetch audit events created at/after this UTC timestamp (ISO-8601). */
|
|
16
|
+
createdAfter?: string;
|
|
15
17
|
}
|
|
16
18
|
export interface DeploymentResult {
|
|
17
19
|
/**
|
|
@@ -11,5 +11,5 @@ export declare class ManagementClient {
|
|
|
11
11
|
getExtensionSnapshot(extensionId: AppExtension["id"], extensionSnapshotVersion: AppSnapshot["version"]): Promise<Optional<AppSnapshotDetails>>;
|
|
12
12
|
getExtensionSnapshotVersions(extensionId: AppExtension["id"]): Promise<AppSnapshot[]>;
|
|
13
13
|
getExtensionSnapshotAliases(extensionId: AppExtension["id"]): Promise<AppExtensionAlias[]>;
|
|
14
|
-
getAuditLog(objectType: DeployObjectType, objectId: string): Promise<AppAuditLog[]>;
|
|
14
|
+
getAuditLog(objectType: DeployObjectType, objectId: string, createdAfter?: string): Promise<AppAuditLog[]>;
|
|
15
15
|
}
|