@merittdev/horus 0.19.0 → 0.19.1

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.cjs +51 -7
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3057,7 +3057,7 @@ var init_version = __esm({
3057
3057
  "../../packages/core/src/version.ts"() {
3058
3058
  "use strict";
3059
3059
  init_cjs_shims();
3060
- HORUS_VERSION = true ? "0.19.0" : "dev";
3060
+ HORUS_VERSION = true ? "0.19.1" : "dev";
3061
3061
  PINNED_SOURCE_VERSION = "2.1.0";
3062
3062
  }
3063
3063
  });
@@ -123308,6 +123308,15 @@ async function runConnect(type, opts) {
123308
123308
  const root = findRepoRoot(cwd) ?? cwd;
123309
123309
  const configPath = discoverLocalConfig(cwd) ?? localConfigPath(root);
123310
123310
  const filled = await fillInteractive(connectorType, opts);
123311
+ if (missingRequired(connectorType, filled)) {
123312
+ console.error(
123313
+ import_picocolors44.default.red(`Missing required field(s) for ${connectorType} \u2014 nothing saved.`) + import_picocolors44.default.dim(
123314
+ `
123315
+ Re-run ${import_picocolors44.default.bold(`horus connect ${connectorType}`)} and fill every prompt, or pass them as flags (e.g. --secret for the token).`
123316
+ )
123317
+ );
123318
+ return 1;
123319
+ }
123311
123320
  let patch;
123312
123321
  switch (connectorType) {
123313
123322
  case "elasticsearch":
@@ -123478,12 +123487,21 @@ ${import_picocolors44.default.bold(`Connect ${type}`)} ${import_picocolors44.def
123478
123487
  }
123479
123488
  break;
123480
123489
  }
123481
- case "shopify":
123482
- filled.store = filled.store ?? await ask("Store name (subdomain only, e.g. 946011-c0)", "my-store");
123490
+ case "shopify": {
123491
+ filled.store = filled.store ?? await ask("Store name (subdomain only, e.g. acme-store)", "my-store");
123483
123492
  filled.apiVersion = filled.apiVersion ?? await ask("API version", "2025-10");
123484
- filled.accessId = filled.accessId ?? (await ask("Access id (client_id) \u2014 leave blank for a static Admin API token", "", false) || void 0);
123485
- filled.secret = filled.secret ?? (await askPassword("Secret \u2014 client_secret, or the static Admin API access token") || void 0);
123493
+ if (filled.secret === void 0) {
123494
+ const method = await askShopifyAuthMethod();
123495
+ if (method === "client-credentials") {
123496
+ filled.accessId = filled.accessId ?? await askRequiredText("Access id (client_id)");
123497
+ filled.secret = await askPassword("Client secret", true) || void 0;
123498
+ } else {
123499
+ filled.accessId = void 0;
123500
+ filled.secret = await askPassword("Admin API access token (e.g. shpat_\u2026)", true) || void 0;
123501
+ }
123502
+ }
123486
123503
  break;
123504
+ }
123487
123505
  case "grafana":
123488
123506
  filled.url = filled.url ?? await ask("URL", "https://grafana.example.com");
123489
123507
  filled.username = filled.username ?? (await ask("Username", "", false) || void 0);
@@ -123567,17 +123585,25 @@ function ask(label, placeholder = "", required2 = true) {
123567
123585
  });
123568
123586
  });
123569
123587
  }
123570
- function askPassword(label) {
123588
+ function askPassword(label, required2 = false) {
123571
123589
  return new Promise((resolve13) => {
123572
123590
  const stdin = process.stdin;
123573
123591
  if (typeof stdin.setRawMode === "function") {
123574
- process.stdout.write(` ${label}${import_picocolors44.default.dim(" [optional]")}: `);
123592
+ const suffix = required2 ? "" : import_picocolors44.default.dim(" [optional]");
123593
+ process.stdout.write(` ${label}${suffix}: `);
123575
123594
  stdin.setRawMode(true);
123576
123595
  stdin.resume();
123577
123596
  let value = "";
123578
123597
  const onData = (chunk) => {
123579
123598
  const char2 = chunk.toString();
123580
123599
  if (char2 === "\r" || char2 === "\n") {
123600
+ if (required2 && value === "") {
123601
+ process.stdout.write(`
123602
+ ${import_picocolors44.default.yellow(" Required \u2014 please enter a value.")}
123603
+ `);
123604
+ process.stdout.write(` ${label}: `);
123605
+ return;
123606
+ }
123581
123607
  stdin.setRawMode(false);
123582
123608
  stdin.pause();
123583
123609
  stdin.removeListener("data", onData);
@@ -123601,6 +123627,24 @@ function askPassword(label) {
123601
123627
  }
123602
123628
  });
123603
123629
  }
123630
+ async function askRequiredText(label) {
123631
+ for (; ; ) {
123632
+ const v4 = (await ask(label, "", false)).trim();
123633
+ if (v4) return v4;
123634
+ console.log(import_picocolors44.default.yellow(" Required \u2014 please enter a value."));
123635
+ }
123636
+ }
123637
+ async function askShopifyAuthMethod() {
123638
+ console.log(` ${import_picocolors44.default.bold("Auth method")}`);
123639
+ console.log(` ${import_picocolors44.default.bold("1)")} Static Admin API access token ${import_picocolors44.default.dim("\u2014 a Custom App shpat_\u2026 token")}`);
123640
+ console.log(` ${import_picocolors44.default.bold("2)")} Client-Credentials app ${import_picocolors44.default.dim("\u2014 client id + secret, exchanged for a token")}`);
123641
+ for (; ; ) {
123642
+ const a2 = (await ask("Choose", "1")).trim();
123643
+ if (a2 === "1") return "static";
123644
+ if (a2 === "2") return "client-credentials";
123645
+ console.log(import_picocolors44.default.yellow(" Enter 1 or 2."));
123646
+ }
123647
+ }
123604
123648
  function buildEsPatch(opts) {
123605
123649
  if (!opts.indexPattern && !opts.indexPatterns?.length) {
123606
123650
  throw new Error("Index pattern is required for elasticsearch");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merittdev/horus",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Local-first, source-aware production-incident investigation engine",
5
5
  "type": "module",
6
6
  "bin": {