hyperframes 0.8.161 → 0.8.162
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/{add-7U5TQGSQ.js → add-UW7GCPQF.js} +5 -5
- package/dist/{asset-N3JO5LHY.js → asset-TWBPYQOL.js} +2 -2
- package/dist/{audio-QNPSENQR.js → audio-DJIE4YLH.js} +42 -20
- package/dist/{auth-HINUM4A7.js → auth-VTCEZYBT.js} +1 -1
- package/dist/{autoUpdate-AAMND4XK.js → autoUpdate-JA3SV472.js} +2 -2
- package/dist/{backgroundChecks-FXIEHPND.js → backgroundChecks-J3WJDPQJ.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{beats-UZNREIRU.js → beats-QVJVXZV5.js} +4 -4
- package/dist/{benchmark-YM3QXPH6.js → benchmark-WNBAKOXS.js} +5 -5
- package/dist/{browser-SD3T2XMH.js → browser-VJOTRIXL.js} +3 -3
- package/dist/{catalog-6PF7KZAZ.js → catalog-SAC4GFIN.js} +5 -5
- package/dist/{catch-up-5LTQTD3X.js → catch-up-T5RIRFJF.js} +4 -4
- package/dist/{check-NE2YXJR2.js → check-IRETF27J.js} +11 -11
- package/dist/{checkBrowser-XDTXDEYO.js → checkBrowser-5IXR4QCK.js} +7 -7
- package/dist/{chunk-IL6C7T5X.js → chunk-3LQEZ4EI.js} +1 -1
- package/dist/{chunk-WNXVPPMV.js → chunk-3NSVHCOH.js} +2 -2
- package/dist/{chunk-AY2FEJDR.js → chunk-5K34RPE5.js} +2 -2
- package/dist/{chunk-IYLHJV34.js → chunk-5UBZPG74.js} +1 -143
- package/dist/{chunk-AHNJMWMU.js → chunk-AAUK5GDI.js} +2 -2
- package/dist/{chunk-G5AZMSQP.js → chunk-FF5TAEPT.js} +1 -1
- package/dist/{chunk-TXG6W4X4.js → chunk-GNFWKGSQ.js} +2 -2
- package/dist/{chunk-H4VXLZ6O.js → chunk-GS5EXZBV.js} +2 -2
- package/dist/chunk-J4L5TPLS.js +101 -0
- package/dist/{chunk-CGOGEA62.js → chunk-JJYFRAI4.js} +1 -1
- package/dist/{chunk-PYMYGIZ4.js → chunk-KAKBRDU4.js} +2 -2
- package/dist/{chunk-VYTGK5YA.js → chunk-KIJO75L4.js} +1 -1
- package/dist/{chunk-SAS6XBY5.js → chunk-NQR5SBXX.js} +1 -1
- package/dist/{chunk-PZH7FTRZ.js → chunk-S6OLD4SL.js} +2 -2
- package/dist/{chunk-7ZKEOQ5N.js → chunk-T5BG7PYZ.js} +1 -1
- package/dist/{chunk-I6CVW5CA.js → chunk-T65MIV36.js} +2 -2
- package/dist/chunk-TDPVEMBS.js +156 -0
- package/dist/{chunk-WDUEIP22.js → chunk-YJKUE3LV.js} +1 -1
- package/dist/{chunk-HM4PLNTX.js → chunk-YLBV2PXM.js} +1 -1
- package/dist/{chunk-KZPG4DXX.js → chunk-ZEWX3GHP.js} +1 -1
- package/dist/{clean-4Y4G3YV3.js → clean-WB62QULT.js} +3 -3
- package/dist/cli.js +47 -47
- package/dist/{cloud-BWXJB2B7.js → cloud-E5WB4DWZ.js} +4 -4
- package/dist/{compare-OLLJBVNL.js → compare-GHFVHZ5A.js} +4 -4
- package/dist/{component-ULSAC45J.js → component-ZGCC3MHX.js} +3 -3
- package/dist/{compositions-G2JTQBTJ.js → compositions-THPEDDIX.js} +5 -5
- package/dist/{delete-BONV4XUI.js → delete-6FWT7DZX.js} +4 -3
- package/dist/{doctor-EMLC4VZ4.js → doctor-RDGDOUC4.js} +3 -3
- package/dist/{events-LF2J436R.js → events-CU6FDXHC.js} +3 -3
- package/dist/{events-ZFGAA5UD.js → events-VHXICDA2.js} +2 -2
- package/dist/{feedback-WKCUQE6T.js → feedback-PUPN6EKP.js} +4 -4
- package/dist/{figma-VJKG252Z.js → figma-ZKWBF7QH.js} +3 -3
- package/dist/fontLocalizeCli.js +1 -1
- package/dist/{get-OINAGI2B.js → get-JHIBQRPM.js} +4 -3
- package/dist/{grade-compare-DY5VFXPK.js → grade-compare-GPLUXDPW.js} +4 -4
- package/dist/{help-HHB7JRZA.js → help-GO6RGM37.js} +1 -1
- package/dist/{history-D44JJBBC.js → history-RUTC4SH5.js} +6 -6
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-2WZLISAR.js → info-773VXW37.js} +5 -5
- package/dist/{init-UYZS2WXQ.js → init-YXSIRYZI.js} +6 -6
- package/dist/{inspect-IEFCB4PT.js → inspect-L4RRJEAA.js} +6 -6
- package/dist/{keyframes-FS43QHM2.js → keyframes-P5IOQ6AM.js} +5 -5
- package/dist/{layout-AK2A7Q46.js → layout-OH2VTN5E.js} +6 -6
- package/dist/{lint-JRJUSZO7.js → lint-YEEPVE6Q.js} +6 -6
- package/dist/{list-BKKGPT7E.js → list-QURRZTVN.js} +4 -3
- package/dist/{login-QJZTUDDO.js → login-DFT4L5YY.js} +4 -4
- package/dist/{media-treatment-473OM7G7.js → media-treatment-ERQ2PBIN.js} +5 -5
- package/dist/{normalize-audio-M3KVTFTQ.js → normalize-audio-R23VODOA.js} +4 -4
- package/dist/{open-363TDMEP.js → open-GEOB4L3S.js} +4 -4
- package/dist/{play-2UB33EGB.js → play-BYUS37GA.js} +4 -4
- package/dist/{present-F3ASSDJX.js → present-BZLRNHDY.js} +4 -4
- package/dist/{preview-EF76WIHK.js → preview-TXML6PQ7.js} +5 -5
- package/dist/{render-GUBYSVQD.js → render-57SXH6NS.js} +7 -7
- package/dist/{render-GL72Z2W2.js → render-JTY7XQFQ.js} +10 -85
- package/dist/{skills-7XI4DHLN.js → skills-2LBVMKVY.js} +5 -5
- package/dist/{skillsUpdateCheck-34WOCMHV.js → skillsUpdateCheck-5DRXL565.js} +3 -3
- package/dist/{snapshot-SGTO2OQ4.js → snapshot-V2L77FCF.js} +6 -6
- package/dist/studio/assets/{hyperframes-player-C8VFb4NS.js → hyperframes-player-CAclPB6q.js} +1 -1
- package/dist/studio/assets/{index-J8Bpbg6o.js → index-B82aOvgB.js} +4 -4
- package/dist/studio/assets/{index-RZnZPb-B.js → index-DCwGKghK.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studioServer-VIIVGFZH.js → studioServer-B7H7EQ4U.js} +4 -4
- package/dist/{telemetry-YKVYLJSB.js → telemetry-WVHWY3DU.js} +3 -3
- package/dist/{timeline-LDRA7QZ3.js → timeline-EDXJ5L45.js} +5 -5
- package/dist/{tokens-ZAOFRU55.js → tokens-UNJONAXT.js} +2 -2
- package/dist/{transcribe-CJXUHTAS.js → transcribe-VX7ZE2IZ.js} +3 -3
- package/dist/{updateCheck-TIRFQBSI.js → updateCheck-NLH5E44Q.js} +2 -2
- package/dist/{upgrade-7R5G3MNO.js → upgrade-RGQJA2B4.js} +2 -2
- package/dist/{validate-VGEPWGQO.js → validate-4AN4PDV7.js} +6 -6
- package/package.json +1 -1
|
@@ -4,74 +4,6 @@ import { dirname as __hf_dirname } from "node:path";
|
|
|
4
4
|
var require = __hf_createRequire(import.meta.url);
|
|
5
5
|
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
forceRefreshCredentials,
|
|
9
|
-
resolveCloudAuthHeaders,
|
|
10
|
-
resolveCloudBaseUrl
|
|
11
|
-
} from "./chunk-KMAAOHLO.js";
|
|
12
|
-
import {
|
|
13
|
-
errorBox
|
|
14
|
-
} from "./chunk-K2FLNJVB.js";
|
|
15
|
-
import {
|
|
16
|
-
failCommand
|
|
17
|
-
} from "./chunk-PBN6GBJE.js";
|
|
18
|
-
|
|
19
|
-
// src/cloud/poll.ts
|
|
20
|
-
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
21
|
-
var DEFAULT_MAX_WAIT_MS = 60 * 60 * 1e3;
|
|
22
|
-
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
|
|
23
|
-
var PollTimeoutError = class extends Error {
|
|
24
|
-
lastDetail;
|
|
25
|
-
constructor(lastDetail, elapsedMs) {
|
|
26
|
-
super(
|
|
27
|
-
`Render ${lastDetail.render_id} did not reach a terminal state within ${Math.round(elapsedMs / 1e3)}s`
|
|
28
|
-
);
|
|
29
|
-
this.name = "PollTimeoutError";
|
|
30
|
-
this.lastDetail = lastDetail;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
function isTerminal(status) {
|
|
34
|
-
return TERMINAL_STATUSES.has(status);
|
|
35
|
-
}
|
|
36
|
-
async function pollUntilTerminal(client, renderId, options = {}) {
|
|
37
|
-
const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
38
|
-
const maxWaitMs = options.maxWaitMs ?? DEFAULT_MAX_WAIT_MS;
|
|
39
|
-
const now = options.now ?? (() => Date.now());
|
|
40
|
-
const sleep = options.sleep ?? defaultAbortableSleep(options.signal);
|
|
41
|
-
const started = now();
|
|
42
|
-
while (true) {
|
|
43
|
-
if (options.signal?.aborted) {
|
|
44
|
-
throw signalAbortError(options.signal);
|
|
45
|
-
}
|
|
46
|
-
const detail = await client.getRender({ render_id: renderId, signal: options.signal });
|
|
47
|
-
const elapsed = now() - started;
|
|
48
|
-
options.onTick?.(detail, elapsed);
|
|
49
|
-
if (isTerminal(detail.status)) {
|
|
50
|
-
return detail;
|
|
51
|
-
}
|
|
52
|
-
if (elapsed >= maxWaitMs) {
|
|
53
|
-
throw new PollTimeoutError(detail, elapsed);
|
|
54
|
-
}
|
|
55
|
-
await sleep(intervalMs);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function signalAbortError(signal) {
|
|
59
|
-
const reason = signal.reason;
|
|
60
|
-
return reason instanceof Error ? reason : new Error("Poll aborted");
|
|
61
|
-
}
|
|
62
|
-
function defaultAbortableSleep(signal) {
|
|
63
|
-
return (ms) => new Promise((resolve, reject) => {
|
|
64
|
-
const onAbort = () => {
|
|
65
|
-
clearTimeout(timer);
|
|
66
|
-
reject(signalAbortError(signal));
|
|
67
|
-
};
|
|
68
|
-
const timer = setTimeout(() => {
|
|
69
|
-
signal?.removeEventListener("abort", onAbort);
|
|
70
|
-
resolve();
|
|
71
|
-
}, ms);
|
|
72
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
7
|
|
|
76
8
|
// src/cloud/_gen/client.ts
|
|
77
9
|
var HyperframesApiError = class extends Error {
|
|
@@ -276,81 +208,7 @@ var HyperframesCloudClient = class {
|
|
|
276
208
|
}
|
|
277
209
|
};
|
|
278
210
|
|
|
279
|
-
// src/cloud/index.ts
|
|
280
|
-
async function createCloudClient() {
|
|
281
|
-
const client = new HyperframesCloudClient({
|
|
282
|
-
baseUrl: resolveCloudBaseUrl(),
|
|
283
|
-
getAuthHeaders: resolveCloudAuthHeaders
|
|
284
|
-
});
|
|
285
|
-
return wrapWith401Retry(client);
|
|
286
|
-
}
|
|
287
|
-
function wrapWith401Retry(client) {
|
|
288
|
-
return new Proxy(client, {
|
|
289
|
-
get(target, prop, receiver) {
|
|
290
|
-
const value = Reflect.get(target, prop, receiver);
|
|
291
|
-
if (typeof value !== "function") return value;
|
|
292
|
-
const original = value.bind(target);
|
|
293
|
-
return async (...args) => {
|
|
294
|
-
try {
|
|
295
|
-
return await original(...args);
|
|
296
|
-
} catch (err) {
|
|
297
|
-
if (err instanceof HyperframesApiError && err.status === 401) {
|
|
298
|
-
try {
|
|
299
|
-
await forceRefreshCredentials();
|
|
300
|
-
} catch {
|
|
301
|
-
throw err;
|
|
302
|
-
}
|
|
303
|
-
return await original(...args);
|
|
304
|
-
}
|
|
305
|
-
throw err;
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// src/cloud/errors.ts
|
|
313
|
-
var ERROR_CODE_HINTS = {
|
|
314
|
-
hyperframes_project_too_large: "The zip exceeded the 200 MB limit. Run `hyperframes cloud render --dry-run`, then add only verified-unneeded paths to `.hyperframesignore` or pre-host required large media.",
|
|
315
|
-
hyperframes_render_not_found: "The render_id no longer exists \u2014 either soft-deleted or never created.",
|
|
316
|
-
invalid_parameter: "Check the listed parameter against `hyperframes cloud render --help` for the accepted values.",
|
|
317
|
-
authentication_failed: "Run `hyperframes auth status` to confirm your credential; `hyperframes auth login` to re-auth.",
|
|
318
|
-
rate_limit_exceeded: "Retry after the duration in the Retry-After header."
|
|
319
|
-
};
|
|
320
|
-
function reportApiError(stage, err, options = {}) {
|
|
321
|
-
const hints = { ...ERROR_CODE_HINTS, ...options.extraHints };
|
|
322
|
-
if (err instanceof HyperframesApiError) {
|
|
323
|
-
if (err.status === 404 && options.notFound) {
|
|
324
|
-
errorBox("Not found", options.notFound);
|
|
325
|
-
failCommand();
|
|
326
|
-
}
|
|
327
|
-
const hint = err.code ? hints[err.code] : void 0;
|
|
328
|
-
const title = `${stage} (HTTP ${err.status})`;
|
|
329
|
-
if (hint) {
|
|
330
|
-
errorBox(title, err.message, hint);
|
|
331
|
-
} else if (options.suggestion) {
|
|
332
|
-
errorBox(title, err.message, options.suggestion);
|
|
333
|
-
} else if (err.code) {
|
|
334
|
-
errorBox(title, err.message, `code: ${err.code}`);
|
|
335
|
-
} else {
|
|
336
|
-
errorBox(title, err.message);
|
|
337
|
-
}
|
|
338
|
-
failCommand();
|
|
339
|
-
}
|
|
340
|
-
if (err instanceof Error) {
|
|
341
|
-
errorBox(stage, err.message, options.suggestion);
|
|
342
|
-
failCommand();
|
|
343
|
-
}
|
|
344
|
-
errorBox(stage, String(err), options.suggestion);
|
|
345
|
-
failCommand();
|
|
346
|
-
}
|
|
347
|
-
|
|
348
211
|
export {
|
|
349
|
-
DEFAULT_POLL_INTERVAL_MS,
|
|
350
|
-
DEFAULT_MAX_WAIT_MS,
|
|
351
|
-
PollTimeoutError,
|
|
352
|
-
pollUntilTerminal,
|
|
353
212
|
HyperframesApiError,
|
|
354
|
-
|
|
355
|
-
reportApiError
|
|
213
|
+
HyperframesCloudClient
|
|
356
214
|
};
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-FH7WODJH.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveProject
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YJKUE3LV.js";
|
|
23
23
|
import {
|
|
24
24
|
defineCommand
|
|
25
25
|
} from "./chunk-S3S4TGEH.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
printDeprecationNotice,
|
|
35
35
|
withMeta
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-T5BG7PYZ.js";
|
|
37
37
|
import {
|
|
38
38
|
decodeWellFormedEscapes
|
|
39
39
|
} from "./chunk-BSQ7XANM.js";
|
|
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
trackLintReport,
|
|
9
9
|
trackLintRuleStreak
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YLBV2PXM.js";
|
|
11
11
|
import {
|
|
12
12
|
shouldTrack
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZEWX3GHP.js";
|
|
14
14
|
import {
|
|
15
15
|
LINT_RULE_COUNT,
|
|
16
16
|
LINT_RULE_GROUP_COUNTS
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-ERTJPFCH.js";
|
|
21
21
|
import {
|
|
22
22
|
resolveProject
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YJKUE3LV.js";
|
|
24
24
|
import {
|
|
25
25
|
serveStaticProjectHtml
|
|
26
26
|
} from "./chunk-RGYEL7QD.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
import {
|
|
38
38
|
printDeprecationNotice,
|
|
39
39
|
withMeta
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-T5BG7PYZ.js";
|
|
41
41
|
import {
|
|
42
42
|
normalizeErrorMessage
|
|
43
43
|
} from "./chunk-KNU5COPB.js";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
HyperframesApiError
|
|
9
|
+
} from "./chunk-5UBZPG74.js";
|
|
10
|
+
|
|
11
|
+
// src/cloud/upload.ts
|
|
12
|
+
import { createHash } from "crypto";
|
|
13
|
+
var COMPLETE_MAX_RETRIES = 5;
|
|
14
|
+
var COMPLETE_RETRY_BASE_MS = 500;
|
|
15
|
+
var CONTENT_TYPE_ZIP = "application/zip";
|
|
16
|
+
function sha256Hex(bytes) {
|
|
17
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
18
|
+
}
|
|
19
|
+
function sleep(ms) {
|
|
20
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
21
|
+
}
|
|
22
|
+
function normalizeUploadHeaders(raw) {
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const [k, v] of Object.entries(raw ?? {})) {
|
|
25
|
+
if (typeof v === "string") out[k] = v;
|
|
26
|
+
else if (typeof v === "number" || typeof v === "boolean") out[k] = String(v);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
async function putBytesToPresignedUrl(fetchImpl, uploadUrl, uploadHeaders, bytes, contentType) {
|
|
31
|
+
const headers = {
|
|
32
|
+
"content-type": contentType,
|
|
33
|
+
...normalizeUploadHeaders(uploadHeaders)
|
|
34
|
+
};
|
|
35
|
+
const res = await fetchImpl(uploadUrl, {
|
|
36
|
+
method: "PUT",
|
|
37
|
+
headers,
|
|
38
|
+
body: bytes
|
|
39
|
+
});
|
|
40
|
+
if (!res.ok) {
|
|
41
|
+
const detail = await res.text().catch(() => "");
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Direct upload PUT failed: ${res.status} ${res.statusText}${detail ? ` \u2014 ${detail.slice(0, 300)}` : ""}`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function completeWithRetry(client, asset_id, checksum_sha256) {
|
|
48
|
+
let lastErr;
|
|
49
|
+
for (let attempt = 0; attempt < COMPLETE_MAX_RETRIES; attempt++) {
|
|
50
|
+
try {
|
|
51
|
+
return await client.completeAssetUpload({
|
|
52
|
+
asset_id,
|
|
53
|
+
body: { checksum_sha256 }
|
|
54
|
+
});
|
|
55
|
+
} catch (err) {
|
|
56
|
+
const retryable = err instanceof HyperframesApiError && err.status === 409;
|
|
57
|
+
if (!retryable || attempt === COMPLETE_MAX_RETRIES - 1) {
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
lastErr = err;
|
|
61
|
+
await sleep(COMPLETE_RETRY_BASE_MS * (attempt + 1));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
throw lastErr ?? new Error("completeAssetUpload retries exhausted");
|
|
65
|
+
}
|
|
66
|
+
async function uploadAssetViaDirectUpload(opts) {
|
|
67
|
+
const start = Date.now();
|
|
68
|
+
const { bytes, filename, idempotencyKey } = opts;
|
|
69
|
+
const size_bytes = bytes.byteLength;
|
|
70
|
+
const checksum_sha256 = sha256Hex(bytes);
|
|
71
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
72
|
+
opts.onProgress?.({ phase: "initialize" });
|
|
73
|
+
const initialize = await opts.client.createAssetUpload({
|
|
74
|
+
body: { filename, content_type: opts.contentType, size_bytes, checksum_sha256 },
|
|
75
|
+
idempotencyKey
|
|
76
|
+
});
|
|
77
|
+
opts.onProgress?.({ phase: "upload", percent: 0 });
|
|
78
|
+
await putBytesToPresignedUrl(
|
|
79
|
+
fetchImpl,
|
|
80
|
+
initialize.upload_url,
|
|
81
|
+
initialize.upload_headers,
|
|
82
|
+
bytes,
|
|
83
|
+
opts.contentType
|
|
84
|
+
);
|
|
85
|
+
opts.onProgress?.({ phase: "upload", percent: 100 });
|
|
86
|
+
opts.onProgress?.({ phase: "complete" });
|
|
87
|
+
const completed = await completeWithRetry(opts.client, initialize.asset_id, checksum_sha256);
|
|
88
|
+
return {
|
|
89
|
+
asset_id: completed.asset_id,
|
|
90
|
+
size_bytes,
|
|
91
|
+
duration_ms: Date.now() - start
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function uploadZipViaDirectUpload(opts) {
|
|
95
|
+
return uploadAssetViaDirectUpload({ ...opts, contentType: CONTENT_TYPE_ZIP });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
uploadAssetViaDirectUpload,
|
|
100
|
+
uploadZipViaDirectUpload
|
|
101
|
+
};
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
typeDirPath,
|
|
21
21
|
updateRecord,
|
|
22
22
|
withFigmaErrors
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3LQEZ4EI.js";
|
|
24
24
|
import {
|
|
25
25
|
defineCommand
|
|
26
26
|
} from "./chunk-S3S4TGEH.js";
|
|
@@ -229,7 +229,7 @@ var asset_default = defineCommand({
|
|
|
229
229
|
rendered > 0 ? `(${results.length} nodes, ${rendered} rendered in 1 figma request)` : `(${results.length} nodes, all reused from cache \u2014 no figma request)`
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
-
const { trackFigmaImport } = await import("./telemetry-
|
|
232
|
+
const { trackFigmaImport } = await import("./telemetry-WVHWY3DU.js");
|
|
233
233
|
trackFigmaImport({
|
|
234
234
|
phase: "asset",
|
|
235
235
|
reused: results.every((r) => r.reused),
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
VERSION
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3NSVHCOH.js";
|
|
10
10
|
|
|
11
11
|
// src/registry/compatibility.ts
|
|
12
12
|
import { compareVersions } from "compare-versions";
|
|
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
RegistryCompatibilityError,
|
|
9
9
|
gateRegistryItemsCompatibility
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NQR5SBXX.js";
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_PROJECT_CONFIG,
|
|
13
13
|
createProjectConfig,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
} from "./chunk-EVRUR7DW.js";
|
|
30
30
|
import {
|
|
31
31
|
trackRegistryItemAdded
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-YLBV2PXM.js";
|
|
33
33
|
import {
|
|
34
34
|
defineCommand
|
|
35
35
|
} from "./chunk-S3S4TGEH.js";
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
getUpdateMeta,
|
|
34
34
|
withMeta
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-T5BG7PYZ.js";
|
|
36
36
|
import {
|
|
37
37
|
CONFIG_PATH,
|
|
38
38
|
withFileLock
|
|
39
39
|
} from "./chunk-XUXGIA7H.js";
|
|
40
40
|
import {
|
|
41
41
|
VERSION
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-3NSVHCOH.js";
|
|
43
43
|
import {
|
|
44
44
|
OPTIONAL_PACKAGES,
|
|
45
45
|
installedOptionalPackageVersion
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
HyperframesApiError,
|
|
9
|
+
HyperframesCloudClient
|
|
10
|
+
} from "./chunk-5UBZPG74.js";
|
|
11
|
+
import {
|
|
12
|
+
forceRefreshCredentials,
|
|
13
|
+
resolveCloudAuthHeaders,
|
|
14
|
+
resolveCloudBaseUrl
|
|
15
|
+
} from "./chunk-KMAAOHLO.js";
|
|
16
|
+
import {
|
|
17
|
+
errorBox
|
|
18
|
+
} from "./chunk-K2FLNJVB.js";
|
|
19
|
+
import {
|
|
20
|
+
failCommand
|
|
21
|
+
} from "./chunk-PBN6GBJE.js";
|
|
22
|
+
|
|
23
|
+
// src/cloud/poll.ts
|
|
24
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
25
|
+
var DEFAULT_MAX_WAIT_MS = 60 * 60 * 1e3;
|
|
26
|
+
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
|
|
27
|
+
var PollTimeoutError = class extends Error {
|
|
28
|
+
lastDetail;
|
|
29
|
+
constructor(lastDetail, elapsedMs) {
|
|
30
|
+
super(
|
|
31
|
+
`Render ${lastDetail.render_id} did not reach a terminal state within ${Math.round(elapsedMs / 1e3)}s`
|
|
32
|
+
);
|
|
33
|
+
this.name = "PollTimeoutError";
|
|
34
|
+
this.lastDetail = lastDetail;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function isTerminal(status) {
|
|
38
|
+
return TERMINAL_STATUSES.has(status);
|
|
39
|
+
}
|
|
40
|
+
async function pollUntilTerminal(client, renderId, options = {}) {
|
|
41
|
+
const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
42
|
+
const maxWaitMs = options.maxWaitMs ?? DEFAULT_MAX_WAIT_MS;
|
|
43
|
+
const now = options.now ?? (() => Date.now());
|
|
44
|
+
const sleep = options.sleep ?? defaultAbortableSleep(options.signal);
|
|
45
|
+
const started = now();
|
|
46
|
+
while (true) {
|
|
47
|
+
if (options.signal?.aborted) {
|
|
48
|
+
throw signalAbortError(options.signal);
|
|
49
|
+
}
|
|
50
|
+
const detail = await client.getRender({ render_id: renderId, signal: options.signal });
|
|
51
|
+
const elapsed = now() - started;
|
|
52
|
+
options.onTick?.(detail, elapsed);
|
|
53
|
+
if (isTerminal(detail.status)) {
|
|
54
|
+
return detail;
|
|
55
|
+
}
|
|
56
|
+
if (elapsed >= maxWaitMs) {
|
|
57
|
+
throw new PollTimeoutError(detail, elapsed);
|
|
58
|
+
}
|
|
59
|
+
await sleep(intervalMs);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function signalAbortError(signal) {
|
|
63
|
+
const reason = signal.reason;
|
|
64
|
+
return reason instanceof Error ? reason : new Error("Poll aborted");
|
|
65
|
+
}
|
|
66
|
+
function defaultAbortableSleep(signal) {
|
|
67
|
+
return (ms) => new Promise((resolve, reject) => {
|
|
68
|
+
const onAbort = () => {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
reject(signalAbortError(signal));
|
|
71
|
+
};
|
|
72
|
+
const timer = setTimeout(() => {
|
|
73
|
+
signal?.removeEventListener("abort", onAbort);
|
|
74
|
+
resolve();
|
|
75
|
+
}, ms);
|
|
76
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/cloud/index.ts
|
|
81
|
+
async function createCloudClient() {
|
|
82
|
+
const client = new HyperframesCloudClient({
|
|
83
|
+
baseUrl: resolveCloudBaseUrl(),
|
|
84
|
+
getAuthHeaders: resolveCloudAuthHeaders
|
|
85
|
+
});
|
|
86
|
+
return wrapWith401Retry(client);
|
|
87
|
+
}
|
|
88
|
+
function wrapWith401Retry(client) {
|
|
89
|
+
return new Proxy(client, {
|
|
90
|
+
get(target, prop, receiver) {
|
|
91
|
+
const value = Reflect.get(target, prop, receiver);
|
|
92
|
+
if (typeof value !== "function") return value;
|
|
93
|
+
const original = value.bind(target);
|
|
94
|
+
return async (...args) => {
|
|
95
|
+
try {
|
|
96
|
+
return await original(...args);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
if (err instanceof HyperframesApiError && err.status === 401) {
|
|
99
|
+
try {
|
|
100
|
+
await forceRefreshCredentials();
|
|
101
|
+
} catch {
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
return await original(...args);
|
|
105
|
+
}
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/cloud/errors.ts
|
|
114
|
+
var ERROR_CODE_HINTS = {
|
|
115
|
+
hyperframes_project_too_large: "The zip exceeded the 200 MB limit. Run `hyperframes cloud render --dry-run`, then add only verified-unneeded paths to `.hyperframesignore` or pre-host required large media.",
|
|
116
|
+
hyperframes_render_not_found: "The render_id no longer exists \u2014 either soft-deleted or never created.",
|
|
117
|
+
invalid_parameter: "Check the listed parameter against `hyperframes cloud render --help` for the accepted values.",
|
|
118
|
+
authentication_failed: "Run `hyperframes auth status` to confirm your credential; `hyperframes auth login` to re-auth.",
|
|
119
|
+
rate_limit_exceeded: "Retry after the duration in the Retry-After header."
|
|
120
|
+
};
|
|
121
|
+
function reportApiError(stage, err, options = {}) {
|
|
122
|
+
const hints = { ...ERROR_CODE_HINTS, ...options.extraHints };
|
|
123
|
+
if (err instanceof HyperframesApiError) {
|
|
124
|
+
if (err.status === 404 && options.notFound) {
|
|
125
|
+
errorBox("Not found", options.notFound);
|
|
126
|
+
failCommand();
|
|
127
|
+
}
|
|
128
|
+
const hint = err.code ? hints[err.code] : void 0;
|
|
129
|
+
const title = `${stage} (HTTP ${err.status})`;
|
|
130
|
+
if (hint) {
|
|
131
|
+
errorBox(title, err.message, hint);
|
|
132
|
+
} else if (options.suggestion) {
|
|
133
|
+
errorBox(title, err.message, options.suggestion);
|
|
134
|
+
} else if (err.code) {
|
|
135
|
+
errorBox(title, err.message, `code: ${err.code}`);
|
|
136
|
+
} else {
|
|
137
|
+
errorBox(title, err.message);
|
|
138
|
+
}
|
|
139
|
+
failCommand();
|
|
140
|
+
}
|
|
141
|
+
if (err instanceof Error) {
|
|
142
|
+
errorBox(stage, err.message, options.suggestion);
|
|
143
|
+
failCommand();
|
|
144
|
+
}
|
|
145
|
+
errorBox(stage, String(err), options.suggestion);
|
|
146
|
+
failCommand();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
DEFAULT_POLL_INTERVAL_MS,
|
|
151
|
+
DEFAULT_MAX_WAIT_MS,
|
|
152
|
+
PollTimeoutError,
|
|
153
|
+
pollUntilTerminal,
|
|
154
|
+
createCloudClient,
|
|
155
|
+
reportApiError
|
|
156
|
+
};
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
redactHome
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T65MIV36.js";
|
|
10
10
|
import "./chunk-Z27A7NUB.js";
|
|
11
11
|
import "./chunk-5ETJX6WM.js";
|
|
12
12
|
import {
|
|
@@ -47,12 +47,12 @@ import "./chunk-TJSTGSAW.js";
|
|
|
47
47
|
import "./chunk-XRKMITSS.js";
|
|
48
48
|
import {
|
|
49
49
|
withMeta
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-T5BG7PYZ.js";
|
|
51
51
|
import "./chunk-K4WIOZFP.js";
|
|
52
52
|
import "./chunk-XUXGIA7H.js";
|
|
53
53
|
import "./chunk-WERLJGIC.js";
|
|
54
54
|
import "./chunk-ISN5GRYI.js";
|
|
55
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-3NSVHCOH.js";
|
|
56
56
|
import "./chunk-3DKN5WKL.js";
|
|
57
57
|
import "./chunk-EOVYQ3IG.js";
|
|
58
58
|
import "./chunk-6BEFEWFB.js";
|