@dypt/cli 0.1.25 → 0.1.26

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 CHANGED
@@ -9,7 +9,7 @@ import { Argument, Command, Option } from "commander";
9
9
  // package.json
10
10
  var package_default = {
11
11
  name: "@dypt/cli",
12
- version: "0.1.25",
12
+ version: "0.1.26",
13
13
  description: "Command-line interface for dypt task management",
14
14
  license: "SEE LICENSE IN LICENSE",
15
15
  homepage: "https://dypt.app",
@@ -330,7 +330,28 @@ var CliTransportError = class extends Error {
330
330
  [this.category, this.retryableRead] = this.causeCode ? causes[this.causeCode] : ["unknown", false];
331
331
  }
332
332
  };
333
+ var CliHttpError = class extends Error {
334
+ constructor(httpStatus) {
335
+ const reason = httpStatus === 414 ? "Request-URI Too Long" : "Request Header Fields Too Large";
336
+ super(
337
+ `dypt request failed (HTTP ${httpStatus}: ${reason}). Reduce the request size or update the CLI.`
338
+ );
339
+ this.httpStatus = httpStatus;
340
+ this.code = "CLI_HTTP_ERROR";
341
+ this.name = "CliHttpError";
342
+ }
343
+ };
333
344
  function formatTransportFailure(error, json) {
345
+ const http = errorChain(error).find(
346
+ (item) => item instanceof CliHttpError
347
+ );
348
+ if (http) {
349
+ const { code: code2, message: message2, httpStatus } = http;
350
+ return {
351
+ exitCode: 1,
352
+ output: json ? JSON.stringify({ error: { code: code2, message: message2, httpStatus } }) : message2
353
+ };
354
+ }
334
355
  const transport = errorChain(error).find(
335
356
  (item) => item instanceof CliTransportError
336
357
  );
@@ -399,6 +420,9 @@ async function fetchWithMaintenanceCheck(input, init) {
399
420
  }
400
421
  const maintenanceError = await getMaintenanceError(response);
401
422
  if (maintenanceError) throw maintenanceError;
423
+ if (response.status === 414 || response.status === 431) {
424
+ throw new CliHttpError(response.status);
425
+ }
402
426
  return response;
403
427
  }
404
428
  function findCliReadRateLimitError(error) {
@@ -519,6 +543,9 @@ async function createCliTrpcClient(options = {}) {
519
543
  httpBatchLink({
520
544
  url: `${baseUrl}/api/trpc`,
521
545
  transformer: superjson,
546
+ methodOverride: "POST",
547
+ maxURLLength: 8192,
548
+ maxItems: 10,
522
549
  fetch: fetchWithMaintenanceCheck,
523
550
  headers() {
524
551
  const measurementId = process.env.DYPT_DB_MEASUREMENT;