ardent-cli 0.0.51 → 0.0.52
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 +52 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -544,6 +544,12 @@ var STAGE_DISPLAY = {
|
|
|
544
544
|
"scanning_database": "Scanning schema",
|
|
545
545
|
"writing_schema": "Saving discovered schema",
|
|
546
546
|
"merging_results": "Combining results",
|
|
547
|
+
// connector delete DBOS workflow
|
|
548
|
+
"deleting": "Starting delete",
|
|
549
|
+
"cleaning_resources": "Removing connector resources",
|
|
550
|
+
"scheduling_secret_purge": "Scheduling credential removal",
|
|
551
|
+
"finalizing_delete": "Finalizing delete",
|
|
552
|
+
"purging_secrets": "Removing stored credentials",
|
|
547
553
|
// branch.create.v1 workflow (ARD-1244)
|
|
548
554
|
"provisioning": "Provisioning the branch",
|
|
549
555
|
"configuring": "Storing connection credentials",
|
|
@@ -2658,6 +2664,9 @@ async function listAction2() {
|
|
|
2658
2664
|
}
|
|
2659
2665
|
|
|
2660
2666
|
// src/commands/connector/delete.ts
|
|
2667
|
+
var CONNECTOR_DELETE_MAX_WAIT_MS = 60 * 60 * 1e3;
|
|
2668
|
+
var CONNECTOR_DELETE_POLL_INTERVAL_MS = 5 * 1e3;
|
|
2669
|
+
var CONNECTOR_DELETE_TRANSIENT_WARN_EVERY = 6;
|
|
2661
2670
|
async function deleteAction2(name, options = {}) {
|
|
2662
2671
|
const cached = getCacheEntry("connectors");
|
|
2663
2672
|
let connector = cached?.data.find((c) => c.name === name);
|
|
@@ -2685,7 +2694,11 @@ async function deleteAction2(name, options = {}) {
|
|
|
2685
2694
|
console.log("Deleting connector...");
|
|
2686
2695
|
const force = options.force ?? false;
|
|
2687
2696
|
const path = force ? `/v1/connectors/${connector.id}?force=true` : `/v1/connectors/${connector.id}`;
|
|
2688
|
-
await api.delete(path);
|
|
2697
|
+
const dispatch = await api.delete(path);
|
|
2698
|
+
const operationId = dispatch.operation_id;
|
|
2699
|
+
if (operationId && dispatch.status !== "completed") {
|
|
2700
|
+
await waitForConnectorDelete(operationId);
|
|
2701
|
+
}
|
|
2689
2702
|
const currentCache = getCacheEntry("connectors");
|
|
2690
2703
|
if (currentCache?.data) {
|
|
2691
2704
|
const updatedConnectors = currentCache.data.filter((c) => c.id !== connector.id);
|
|
@@ -2720,6 +2733,44 @@ async function deleteAction2(name, options = {}) {
|
|
|
2720
2733
|
process.exit(1);
|
|
2721
2734
|
}
|
|
2722
2735
|
}
|
|
2736
|
+
async function waitForConnectorDelete(operationId) {
|
|
2737
|
+
const startedAt = Date.now();
|
|
2738
|
+
let lastStage = null;
|
|
2739
|
+
let consecutiveTransientFailures = 0;
|
|
2740
|
+
while (Date.now() - startedAt < CONNECTOR_DELETE_MAX_WAIT_MS) {
|
|
2741
|
+
await new Promise((resolve) => setTimeout(resolve, CONNECTOR_DELETE_POLL_INTERVAL_MS));
|
|
2742
|
+
let operation;
|
|
2743
|
+
try {
|
|
2744
|
+
operation = await api.get(`/v1/operations/${operationId}`);
|
|
2745
|
+
} catch (pollErr) {
|
|
2746
|
+
if (isTransientOperationPollError(pollErr)) {
|
|
2747
|
+
consecutiveTransientFailures += 1;
|
|
2748
|
+
if (consecutiveTransientFailures % CONNECTOR_DELETE_TRANSIENT_WARN_EVERY === 0) {
|
|
2749
|
+
console.warn(
|
|
2750
|
+
` \u26A0 Status check has failed ${consecutiveTransientFailures} times in a row. Delete is still running server-side and the CLI will keep waiting.`
|
|
2751
|
+
);
|
|
2752
|
+
}
|
|
2753
|
+
continue;
|
|
2754
|
+
}
|
|
2755
|
+
throw pollErr;
|
|
2756
|
+
}
|
|
2757
|
+
consecutiveTransientFailures = 0;
|
|
2758
|
+
if (operation.stage && operation.stage !== lastStage) {
|
|
2759
|
+
const progressLabel = operation.progress != null ? ` (${operation.progress}%)` : "";
|
|
2760
|
+
console.log(` ${operationStageDisplay(operation.stage)}${progressLabel}`);
|
|
2761
|
+
lastStage = operation.stage;
|
|
2762
|
+
}
|
|
2763
|
+
if (operation.status === "completed") {
|
|
2764
|
+
return;
|
|
2765
|
+
}
|
|
2766
|
+
if (operation.status === "failed") {
|
|
2767
|
+
throw new Error(operation.error ?? "Connector delete failed. Contact Ardent support.");
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
throw new Error(
|
|
2771
|
+
`Connector delete did not complete within ${CONNECTOR_DELETE_MAX_WAIT_MS / 6e4} minutes. It may still be running server-side. If you contact Ardent support, reference operation id ${operationId}.`
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2723
2774
|
|
|
2724
2775
|
// src/commands/connector/preflight.ts
|
|
2725
2776
|
var CHECK_RENDER_ORDER = [
|