ardent-cli 0.0.46 → 0.0.48

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1153,17 +1153,18 @@ var DiscoveryTimeoutError = class extends Error {
1153
1153
  };
1154
1154
  var DiscoveryOperationFailedError = class extends Error {
1155
1155
  operationError;
1156
- constructor(operationError) {
1156
+ constructor(operationError, recoveryGuidance) {
1157
1157
  super(
1158
- `Discovery failed: ${operationError ?? "unknown error"}. Inspect the connector with \`ardent connector list\`, fix the underlying issue, then re-run \`ardent connector create\` or \`ardent connector rediscover\`.`
1158
+ `Discovery failed: ${operationError ?? "unknown error"}. Inspect the connector with \`ardent connector list\`, fix the underlying issue, then ${recoveryGuidance}.`
1159
1159
  );
1160
1160
  this.name = "DiscoveryOperationFailedError";
1161
1161
  this.operationError = operationError;
1162
1162
  }
1163
1163
  };
1164
1164
  async function runDiscoveryWithPolling(connectorId, options) {
1165
- const maxWaitMs = options?.maxWaitMs ?? 10 * 60 * 1e3;
1166
- const pollIntervalMs = options?.pollIntervalMs ?? 3 * 1e3;
1165
+ const maxWaitMs = options.maxWaitMs ?? 10 * 60 * 1e3;
1166
+ const pollIntervalMs = options.pollIntervalMs ?? 3 * 1e3;
1167
+ const recoveryGuidance = options.recoveryGuidance;
1167
1168
  let dispatch;
1168
1169
  try {
1169
1170
  dispatch = await api.post(
@@ -1178,7 +1179,7 @@ async function runDiscoveryWithPolling(connectorId, options) {
1178
1179
  }
1179
1180
  throw err;
1180
1181
  }
1181
- if (options?.onPrerequisites) {
1182
+ if (options.onPrerequisites) {
1182
1183
  options.onPrerequisites(dispatch.prerequisites, dispatch.source_metadata);
1183
1184
  }
1184
1185
  const operationId = dispatch.operation_id;
@@ -1210,7 +1211,7 @@ async function runDiscoveryWithPolling(connectorId, options) {
1210
1211
  };
1211
1212
  }
1212
1213
  if (op.status === "failed") {
1213
- throw new DiscoveryOperationFailedError(op.error);
1214
+ throw new DiscoveryOperationFailedError(op.error, recoveryGuidance);
1214
1215
  }
1215
1216
  }
1216
1217
  throw new DiscoveryTimeoutError(
@@ -2205,6 +2206,7 @@ async function createAction2(type, url, options) {
2205
2206
  let discoverPollResult;
2206
2207
  try {
2207
2208
  discoverPollResult = await runDiscoveryWithPolling(connectorId, {
2209
+ recoveryGuidance: `delete the connector with \`ardent connector delete ${connectorName}\`, then run \`ardent connector create\` again`,
2208
2210
  onPrerequisites: (prereqs) => {
2209
2211
  if (prereqs.pass) {
2210
2212
  console.log("Connected \u2713 \u2014 scanning your schema\u2026");
@@ -2640,6 +2642,13 @@ function allChecksPass(checks) {
2640
2642
  }
2641
2643
  return true;
2642
2644
  }
2645
+ function extractWarnings(checks) {
2646
+ const raw = checks["warnings"];
2647
+ if (!Array.isArray(raw)) return [];
2648
+ return raw.filter(
2649
+ (warning) => typeof warning === "string" && warning.length > 0
2650
+ );
2651
+ }
2643
2652
  async function preflightAction(type, url, options) {
2644
2653
  if (type !== "postgresql") {
2645
2654
  console.error(
@@ -2719,6 +2728,14 @@ async function preflightAction(type, url, options) {
2719
2728
  for (const line of renderChecks(response.checks)) {
2720
2729
  console.log(line);
2721
2730
  }
2731
+ const advisories = extractWarnings(response.checks);
2732
+ if (advisories.length > 0) {
2733
+ console.log("");
2734
+ console.log("Advisories (non-blocking):");
2735
+ for (const advisory of advisories) {
2736
+ console.log(` \u26A0 ${advisory}`);
2737
+ }
2738
+ }
2722
2739
  if (response.source_provider) {
2723
2740
  console.log("");
2724
2741
  console.log(`Detected source provider: ${response.source_provider}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ardent-cli",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "Git for Data infrastructure",
5
5
  "type": "module",
6
6
  "bin": {