@dreamboard-games/cli 0.1.30-alpha.32 → 0.1.30-alpha.34

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.
@@ -1771,12 +1771,18 @@ function createRetryingReadFetch(fetchImpl) {
1771
1771
  return (async (input, init2) => {
1772
1772
  const method = resolveFetchMethod(input, init2);
1773
1773
  if (method !== "GET" && method !== "HEAD") {
1774
- return fetchImpl(input, init2);
1774
+ return fetchWithOptionalTrace(fetchImpl, input, init2, {
1775
+ attempt: 0,
1776
+ willRetry: false
1777
+ });
1775
1778
  }
1776
1779
  let lastError;
1777
1780
  for (let attempt = 0; attempt <= TRANSIENT_READ_RETRY_DELAYS_MS.length; attempt += 1) {
1778
1781
  try {
1779
- return await fetchImpl(input, init2);
1782
+ return await fetchWithOptionalTrace(fetchImpl, input, init2, {
1783
+ attempt,
1784
+ willRetry: attempt < TRANSIENT_READ_RETRY_DELAYS_MS.length
1785
+ });
1780
1786
  } catch (error) {
1781
1787
  lastError = error;
1782
1788
  if (attempt >= TRANSIENT_READ_RETRY_DELAYS_MS.length || !isTransientFetchError(error)) {
@@ -1788,6 +1794,88 @@ function createRetryingReadFetch(fetchImpl) {
1788
1794
  throw lastError;
1789
1795
  });
1790
1796
  }
1797
+ async function fetchWithOptionalTrace(fetchImpl, input, init2, options) {
1798
+ if (!isHttpTraceEnabled()) {
1799
+ return fetchImpl(input, init2);
1800
+ }
1801
+ const request = describeRequest(input, init2);
1802
+ const startedAt = Date.now();
1803
+ try {
1804
+ const response = await fetchImpl(input, init2);
1805
+ writeHttpTrace({
1806
+ ...request,
1807
+ attempt: options.attempt,
1808
+ status: response.status,
1809
+ durationMs: Date.now() - startedAt
1810
+ });
1811
+ return response;
1812
+ } catch (error) {
1813
+ writeHttpTrace({
1814
+ ...request,
1815
+ attempt: options.attempt,
1816
+ durationMs: Date.now() - startedAt,
1817
+ error: error instanceof Error ? error.name : "UnknownError",
1818
+ willRetry: options.willRetry
1819
+ });
1820
+ throw error;
1821
+ }
1822
+ }
1823
+ function isHttpTraceEnabled() {
1824
+ return process.env.DREAMBOARD_CLI_HTTP_TRACE === "1";
1825
+ }
1826
+ function describeRequest(input, init2) {
1827
+ return {
1828
+ method: resolveFetchMethod(input, init2),
1829
+ url: redactUrl(input),
1830
+ hasAuthorization: hasAuthorizationHeader(input, init2)
1831
+ };
1832
+ }
1833
+ function redactUrl(input) {
1834
+ const rawUrl = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
1835
+ try {
1836
+ const url = new URL(rawUrl);
1837
+ return `${url.origin}${url.pathname}`;
1838
+ } catch {
1839
+ return "<unparseable-url>";
1840
+ }
1841
+ }
1842
+ function hasAuthorizationHeader(input, init2) {
1843
+ return headersContainAuthorization(init2?.headers) || typeof Request !== "undefined" && input instanceof Request && input.headers.has("Authorization");
1844
+ }
1845
+ function headersContainAuthorization(headers) {
1846
+ if (!headers) {
1847
+ return false;
1848
+ }
1849
+ if (headers instanceof Headers) {
1850
+ return headers.has("Authorization");
1851
+ }
1852
+ if (Array.isArray(headers)) {
1853
+ return headers.some(([name]) => name.toLowerCase() === "authorization");
1854
+ }
1855
+ return Object.keys(headers).some(
1856
+ (name) => name.toLowerCase() === "authorization"
1857
+ );
1858
+ }
1859
+ function writeHttpTrace(event) {
1860
+ const parts = [
1861
+ "[dreamboard-cli:http]",
1862
+ `method=${event.method}`,
1863
+ `url=${event.url}`,
1864
+ `auth=${event.hasAuthorization ? "present" : "missing"}`,
1865
+ `attempt=${event.attempt + 1}`,
1866
+ `durationMs=${event.durationMs}`
1867
+ ];
1868
+ if (typeof event.status === "number") {
1869
+ parts.push(`status=${event.status}`);
1870
+ }
1871
+ if (event.error) {
1872
+ parts.push(`error=${event.error}`);
1873
+ }
1874
+ if (event.willRetry) {
1875
+ parts.push("willRetry=true");
1876
+ }
1877
+ console.error(parts.join(" "));
1878
+ }
1791
1879
  function resolveFetchMethod(input, init2) {
1792
1880
  const method = init2?.method ?? (typeof Request !== "undefined" && input instanceof Request ? input.method : void 0);
1793
1881
  return (method ?? "GET").toUpperCase();
@@ -2020,7 +2108,7 @@ Usage:
2020
2108
  }
2021
2109
  async function materializePreparedWorkspace(args) {
2022
2110
  const inputPath = readRequiredOption(args, "--input");
2023
- const { materializeWorkspaceProject } = await import("./materialize-workspace-J2S4XIIC.mjs");
2111
+ const { materializeWorkspaceProject } = await import("./materialize-workspace-NX7NUNKW.mjs");
2024
2112
  const input = JSON.parse(await readFile(inputPath, "utf8"));
2025
2113
  await materializeWorkspaceProject({
2026
2114
  ...input,
@@ -2088,7 +2176,7 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
2088
2176
  { assertReducerContractPreflight },
2089
2177
  { getProjectLocalMaintainerRegistry }
2090
2178
  ] = await Promise.all([
2091
- import("./static-scaffold-56QBCO6P.mjs"),
2179
+ import("./static-scaffold-RJ6E6GQM.mjs"),
2092
2180
  import("./local-files-OF4QFISU.mjs"),
2093
2181
  import("./workspace-codegen-SPPVHURX.mjs"),
2094
2182
  import("./workspace-dependencies-5HEEKZFP.mjs"),