@pmate/cli 0.24.27 → 0.24.28

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 +31 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20101,20 +20101,31 @@ var ServiceCommandHandler = class {
20101
20101
  throw new Error(`Unsupported runtime ${runtime.type} for ${service.id} env ${env.name}`);
20102
20102
  }
20103
20103
  async appendDeployHistory(registry, serviceId, environment, status, message) {
20104
- try {
20105
- await registry.appendDeployHistory(serviceId, {
20106
- environment,
20107
- status,
20108
- ...message ? { message } : {}
20109
- });
20110
- } catch (error) {
20111
- ui.warn("Failed to append deploy history", {
20112
- serviceId,
20113
- environment,
20114
- status,
20115
- message: error instanceof Error ? error.message : String(error)
20116
- });
20104
+ let lastError;
20105
+ for (let attempt = 1; attempt <= 5; attempt += 1) {
20106
+ try {
20107
+ await registry.appendDeployHistory(serviceId, {
20108
+ environment,
20109
+ status,
20110
+ ...message ? { message } : {}
20111
+ });
20112
+ return;
20113
+ } catch (error2) {
20114
+ lastError = error2;
20115
+ if (attempt < 5 && shouldRetryDeployHistoryAppend(error2)) {
20116
+ await sleep3(attempt * 1e3);
20117
+ continue;
20118
+ }
20119
+ break;
20120
+ }
20117
20121
  }
20122
+ const error = lastError;
20123
+ ui.warn("Failed to append deploy history", {
20124
+ serviceId,
20125
+ environment,
20126
+ status,
20127
+ message: error instanceof Error ? error.message : String(error)
20128
+ });
20118
20129
  }
20119
20130
  resolveBaseUrl(baseUrl) {
20120
20131
  return (baseUrl || process.env.PMATE_APPS_API_BASE_URL || "https://apps-api.pmate.chat").replace(/\/+$/, "");
@@ -20544,6 +20555,13 @@ function splitPrimaryDomain(host) {
20544
20555
  domain: parts.slice(-2).join(".")
20545
20556
  };
20546
20557
  }
20558
+ function shouldRetryDeployHistoryAppend(error) {
20559
+ const message = error instanceof Error ? error.message : String(error);
20560
+ return message.includes("status 502") || message.includes("status 503") || message.includes("status 504") || message.includes("fetch failed") || message.includes("ECONNRESET") || message.includes("ETIMEDOUT");
20561
+ }
20562
+ function sleep3(ms) {
20563
+ return new Promise((resolve) => setTimeout(resolve, ms));
20564
+ }
20547
20565
 
20548
20566
  // src/commands/VercelCommandHandler.ts
20549
20567
  var import_node_child_process12 = require("child_process");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.24.27",
3
+ "version": "0.24.28",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {