@pmate/cli 0.50.0 → 0.50.2

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 +13 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20164,7 +20164,7 @@ function logResponseError(status, message) {
20164
20164
  };
20165
20165
  if (status === 422 && message === "Requested window extends beyond the safe retained log window")
20166
20166
  return new DeveloperLogError("logs_retention", status, "Requested time window is outside retained logs");
20167
- if (status === 422 && ["Analysis exceeds 100 pages; reduce the time window", "Analysis exceeds 10000 records; reduce the time window", "Analysis budget exceeded; reduce the time window", "More than 100 groups; narrow query or choose a coarser dimension"].includes(String(message)))
20167
+ if (status === 422 && ["Log query budget exceeded; reduce the time window", "Analysis exceeds 100 pages; reduce the time window", "Analysis exceeds 10000 records; reduce the time window", "Analysis budget exceeded; reduce the time window", "More than 100 groups; narrow query or choose a coarser dimension"].includes(String(message)))
20168
20168
  return new DeveloperLogError("logs_budget_exceeded", status, "Analysis limit exceeded; use metric=count for counts, or narrow the window/dimensions for detailed metrics");
20169
20169
  const [code, detail] = errors[status] ?? ["logs_unavailable", "Log service temporarily unavailable"];
20170
20170
  return new DeveloperLogError(code, status, `${detail} (HTTP ${status})`);
@@ -20239,6 +20239,13 @@ var import_dotenv = require("dotenv");
20239
20239
 
20240
20240
  // src/services/ServiceRegistryClient.ts
20241
20241
  init_sessionStore();
20242
+ var ServiceRegistryHttpError = class extends Error {
20243
+ constructor(status, message) {
20244
+ super(message);
20245
+ this.status = status;
20246
+ this.name = "ServiceRegistryHttpError";
20247
+ }
20248
+ };
20242
20249
  var ServiceRegistryNotFoundError = class extends Error {
20243
20250
  constructor(namespace, name) {
20244
20251
  super(`Service not found: ${namespace}/${name}`);
@@ -20456,7 +20463,7 @@ var ServiceRegistryClient = class {
20456
20463
  );
20457
20464
  }
20458
20465
  if (!response.ok || !payload?.success || payload.data === void 0) {
20459
- throw new Error(payload?.message || `Request failed with status ${response.status}`);
20466
+ throw new ServiceRegistryHttpError(response.status, payload?.message || `Request failed with status ${response.status}`);
20460
20467
  }
20461
20468
  return payload.data;
20462
20469
  }
@@ -20484,7 +20491,7 @@ var ServiceRegistryClient = class {
20484
20491
  );
20485
20492
  }
20486
20493
  if (!response.ok || !payload?.success || payload.data === void 0) {
20487
- throw new Error(payload?.message || `Request failed with status ${response.status}`);
20494
+ throw new ServiceRegistryHttpError(response.status, payload?.message || `Request failed with status ${response.status}`);
20488
20495
  }
20489
20496
  return payload.data;
20490
20497
  }
@@ -22566,10 +22573,12 @@ var ServiceCommandHandler = class {
22566
22573
  throw new Error(`Unsupported runtime ${runtime.type} for ${service.id} env ${env.name}`);
22567
22574
  }
22568
22575
  async appendDeployHistory(registry, serviceId, environment, status, message, metadata) {
22576
+ const createdAt = Date.now();
22569
22577
  let lastError;
22570
22578
  for (let attempt = 1; attempt <= 5; attempt += 1) {
22571
22579
  try {
22572
22580
  await registry.appendDeployHistory(serviceId, {
22581
+ createdAt,
22573
22582
  environment,
22574
22583
  status,
22575
22584
  ...message ? { message } : {},
@@ -23208,6 +23217,7 @@ function splitPrimaryDomain(host) {
23208
23217
  };
23209
23218
  }
23210
23219
  function shouldRetryDeployHistoryAppend(error) {
23220
+ if (error instanceof ServiceRegistryHttpError) return [502, 503, 504].includes(error.status);
23211
23221
  const message = error instanceof Error ? error.message : String(error);
23212
23222
  return message.includes("status 502") || message.includes("status 503") || message.includes("status 504") || message.includes("fetch failed") || message.includes("ECONNRESET") || message.includes("ETIMEDOUT");
23213
23223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.50.0",
3
+ "version": "0.50.2",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {