@wix/ditto-codegen-public 1.0.519 → 1.0.521

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.
@@ -20,7 +20,7 @@ const INSTALL_TIMEOUT_MS = 180_000;
20
20
  const CHILD_TIMEOUT_MS = 120_000;
21
21
  const UPLOAD_TIMEOUT_MS = 120_000;
22
22
  const IMPORT_POLL_MS = 1_000;
23
- const IMPORT_TIMEOUT_MS = 30_000;
23
+ const IMPORT_TIMEOUT_MS = 15_000;
24
24
  const IMAGE_ENV = {
25
25
  PATH: "/usr/local/bin:/usr/bin:/bin",
26
26
  HOME: WORK_DIR,
@@ -278,14 +278,17 @@ async function importFile(url: string, token: string) {
278
278
  `${MEDIA_FILES_API}/get-file-by-id?fileId=${encodeURIComponent(file.uri)}`,
279
279
  { headers: { Authorization: token }, signal },
280
280
  );
281
- if (!response.ok) throw await httpError("Get File Descriptor", response);
282
- const { file: descriptor } = (await response.json()) as {
283
- file?: { operationStatus?: string };
284
- };
285
- if (descriptor?.operationStatus === "READY") return file;
286
- if (descriptor?.operationStatus === "FAILED")
287
- throw new Error("Wix could not import the image from this URL");
288
- await sleep(IMPORT_POLL_MS, undefined, { signal });
281
+ // A copy of a Wix Media URL answers 404 until it exists, for about 2 s.
282
+ if (response.status !== 404) {
283
+ if (!response.ok) throw await httpError("Get File Descriptor", response);
284
+ const { file: descriptor } = (await response.json()) as {
285
+ file?: { operationStatus?: string };
286
+ };
287
+ if (descriptor?.operationStatus === "READY") return file;
288
+ if (descriptor?.operationStatus === "FAILED")
289
+ throw new Error("Wix could not import the image from this URL");
290
+ }
291
+ await sleep(IMPORT_POLL_MS);
289
292
  }
290
293
  throw new Error(
291
294
  `Wix did not finish importing the image in ${IMPORT_TIMEOUT_MS / 1000} s`,
package/dist/out.js CHANGED
@@ -13923,8 +13923,7 @@ var require_checkpoint = __commonJS({
13923
13923
  var http_client_1 = require_index_node();
13924
13924
  var ditto_codegen_types_12 = require_dist4();
13925
13925
  var MAX_CHECKPOINT_ERROR_LENGTH = 1e3;
13926
- var BUSY_CODES = /* @__PURE__ */ new Set(["RESTORE_BUSY", "CHECKPOINT_BUSY"]);
13927
- var OPERATION_IN_PROGRESS_RETRY_DELAYS_MS = [5e3, 1e4, 15e3];
13926
+ var CHECKPOINT_RETRY_DELAYS_MS = [5e3, 1e4, 15e3];
13928
13927
  var TRUNCATION_SUFFIX = "\u2026";
13929
13928
  var COMMON_CONFIG_BY_ENVIRONMENT = {
13930
13929
  STUDIO_2: { host: "STUDIO2", brand: "studio" }
@@ -13987,20 +13986,23 @@ Likely cause: a context provider's or function library's moduleSpecifier either
13987
13986
  return false;
13988
13987
  return Object.keys(requestHeaders).some((key) => key.toLowerCase() === "authorization");
13989
13988
  };
13990
- var isOperationInProgress = (error) => {
13991
- const code = readApplicationErrorCode(error);
13992
- return code !== void 0 && BUSY_CODES.has(code);
13993
- };
13989
+ var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([409, 503]);
13990
+ var isRetryable = (error) => http_client_1.HttpClient.isHttpError(error) && error.response?.status !== void 0 && RETRYABLE_STATUSES.has(error.response.status) && !isCheckpointConflict(error);
13994
13991
  var requestCheckpoint = async (client, siteBranchId, logger) => {
13995
13992
  for (let attempt = 0; ; attempt++) {
13996
13993
  try {
13997
13994
  return await client.request((0, http_1.createCheckpoint)({ siteBranchId }));
13998
13995
  } catch (error) {
13999
- const delayMs = OPERATION_IN_PROGRESS_RETRY_DELAYS_MS[attempt];
14000
- if (delayMs === void 0 || !isOperationInProgress(error))
13996
+ const delayMs = CHECKPOINT_RETRY_DELAYS_MS[attempt];
13997
+ if (delayMs === void 0 || !isRetryable(error))
14001
13998
  throw error;
14002
- logger.warn("[Checkpoint] another operation is running, retrying", {
13999
+ const httpError = http_client_1.HttpClient.isHttpError(error) ? error : void 0;
14000
+ logger.warn("[Checkpoint] retrying", {
14003
14001
  siteBranchId,
14002
+ requestId: httpError?.requestId || void 0,
14003
+ status: httpError?.response?.status,
14004
+ code: httpError?.code,
14005
+ error: readCheckpointErrorMessage(error),
14004
14006
  attempt: attempt + 1,
14005
14007
  delayMs
14006
14008
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.519",
3
+ "version": "1.0.521",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "36cc95a70649db03d44124988e86973d73a1e9fbe596505714b438eb"
32
+ "falconPackageHash": "7d7a98bac7875bae6bd349a85272d345fbd8286c19cc4615f5adaa5c"
33
33
  }