@hardfin/cli 0.1.1-dev.61 → 0.1.1-dev.62

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d233e4e5-e149-5533-80be-917bfd948db3")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="32c6ff44-5b5a-5c1d-a718-7808ccc648a2")}catch(e){}}();
4
4
  import module from "node:module";
5
5
  //#region src/cli.ts
6
6
  module.enableCompileCache?.();
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
14
14
  try {
15
15
  const answer = await toQuickAnswer(process.argv.slice(2));
16
16
  if (answer === void 0) {
17
- const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-CkKf46kC.js");
17
+ const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-JKHwms47.js");
18
18
  try {
19
19
  await toCli().parseAsync(process.argv);
20
20
  } catch (error) {
@@ -33,7 +33,7 @@ async function toCrash(error) {
33
33
  isCrashing = true;
34
34
  const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
35
35
  try {
36
- const { toReported, writeCrash } = await import("./program-CkKf46kC.js");
36
+ const { toReported, writeCrash } = await import("./program-JKHwms47.js");
37
37
  writeCrash(error, isJSON);
38
38
  await toReported(error, isJSON, void 0, "fatal");
39
39
  } catch {
@@ -54,4 +54,4 @@ async function toQuickAnswer(args) {
54
54
  export {};
55
55
 
56
56
  //# sourceMappingURL=cli.js.map
57
- //# debugId=d233e4e5-e149-5533-80be-917bfd948db3
57
+ //# debugId=32c6ff44-5b5a-5c1d-a718-7808ccc648a2
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d29068e8-3e79-5da9-aa3a-0c5201101ca3")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fece96d1-a65a-5493-9c5b-d782b0f80b3f")}catch(e){}}();
4
4
  import { a as defineCommand, i as GLOBAL_FLAGS, r as ExitCode, t as toInvocation } from "./scrub-BZ0egWxC.js";
5
5
  import { n as toAnswer$1, r as toCompletion, t as PATH_VALUES } from "./completion-tree-DLC6ARLR.js";
6
6
  import { createRequire } from "node:module";
7
7
  import { Command, CommanderError, Option } from "commander";
8
8
  import { z } from "zod";
9
- import { accessSync, chmodSync, closeSync, constants, existsSync, mkdirSync, openAsBlob, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
9
+ import { accessSync, chmodSync, closeSync, constants, existsSync, mkdirSync, openAsBlob, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
10
10
  import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
11
11
  import { parseEnv } from "node:util";
12
12
  import { fileURLToPath } from "node:url";
@@ -1554,12 +1554,35 @@ var InputFailure = class extends Error {
1554
1554
  this.name = "InputFailure";
1555
1555
  }
1556
1556
  };
1557
+ /** toStandardInput reads everything piped to the command, however slowly it arrives. */
1558
+ function toStandardInput() {
1559
+ const chunks = [];
1560
+ const chunk = Buffer.alloc(65536);
1561
+ const pause = new Int32Array(new SharedArrayBuffer(4));
1562
+ for (;;) {
1563
+ let size;
1564
+ try {
1565
+ size = readSync(0, chunk, 0, chunk.length, null);
1566
+ } catch (error) {
1567
+ const code = error.code;
1568
+ if (code === "EAGAIN") {
1569
+ Atomics.wait(pause, 0, 0, 5);
1570
+ continue;
1571
+ }
1572
+ if (code === "EOF") break;
1573
+ throw error;
1574
+ }
1575
+ if (size === 0) break;
1576
+ chunks.push(Buffer.from(chunk.subarray(0, size)));
1577
+ }
1578
+ return Buffer.concat(chunks).toString("utf8");
1579
+ }
1557
1580
  /** toJSONInput reads the JSON a command was given with --input, from a file or from standard input. */
1558
1581
  function toJSONInput(source) {
1559
1582
  const name = source === "-" ? "standard input" : source;
1560
1583
  let text;
1561
1584
  try {
1562
- text = readFileSync(source === "-" ? 0 : source, "utf8");
1585
+ text = source === "-" ? toStandardInput() : readFileSync(source, "utf8");
1563
1586
  } catch {
1564
1587
  return new InputFailure(`${name} cannot be read`);
1565
1588
  }
@@ -1749,6 +1772,7 @@ const NOT_A_KEY = /* @__PURE__ */ new Set([
1749
1772
  /** toPath fills the path template from the positional arguments, in order. */
1750
1773
  function toPath(operation, args) {
1751
1774
  if (args.length !== operation.pathParameters.length || args.some((argument) => NOT_A_KEY.has(argument))) return;
1775
+ if (args.some((argument) => /[/\\]/.test(argument))) return;
1752
1776
  let path = operation.path;
1753
1777
  for (const [index, parameter] of operation.pathParameters.entries()) path = path.replace(`{${parameter.name}}`, encodeURIComponent(args[index] ?? ""));
1754
1778
  return path;
@@ -1882,7 +1906,7 @@ function toTyped(text, types) {
1882
1906
  if (types === void 0 || types.includes("string")) return text;
1883
1907
  if ((types.includes("integer") || types.includes("number")) && NUMBER.test(text)) {
1884
1908
  const value = Number(text);
1885
- if (types.includes("number") || Number.isInteger(value)) return value;
1909
+ if (types.includes("number") || Number.isSafeInteger(value)) return value;
1886
1910
  }
1887
1911
  if (types.includes("boolean") && (text === "true" || text === "false")) return text === "true";
1888
1912
  return NOT_TAKEN;
@@ -7464,5 +7488,5 @@ async function toReported(error, isJSON, resolved, level = "error") {
7464
7488
  //#endregion
7465
7489
  export { toCli, toParseExitCode, toReported, wasReportAttempted, writeCrash };
7466
7490
 
7467
- //# sourceMappingURL=program-CkKf46kC.js.map
7468
- //# debugId=d29068e8-3e79-5da9-aa3a-0c5201101ca3
7491
+ //# sourceMappingURL=program-JKHwms47.js.map
7492
+ //# debugId=fece96d1-a65a-5493-9c5b-d782b0f80b3f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardfin/cli",
3
- "version": "0.1.1-dev.61",
3
+ "version": "0.1.1-dev.62",
4
4
  "description": "Command line interface for the Hardfin API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hardfin, Inc.",