@hyperframes/studio 0.8.63 → 0.8.64
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/assets/{hyperframes-player-FmXtbvEE.js → hyperframes-player-pWkneUHC.js} +1 -1
- package/dist/assets/{index-DCqmNhmi.js → index-BEyJVAiH.js} +1 -1
- package/dist/assets/{index-CjueZL58.js → index-DLjjm1nC.js} +40 -40
- package/dist/assets/{index-CISQydDK.js → index-RRyhgH2k.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/hooks/useSdkSession.lifecycle.test.tsx +78 -1
- package/src/hooks/useSdkSession.ts +75 -13
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>HyperFrames Studio</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DLjjm1nC.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BnsYeuxA.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -79464,18 +79464,26 @@ function notifyExternalFileReload(path) {
|
|
|
79464
79464
|
}
|
|
79465
79465
|
|
|
79466
79466
|
// src/hooks/useSdkSession.ts
|
|
79467
|
+
var EMPTY_READ_REASONS = /* @__PURE__ */ new Set([
|
|
79468
|
+
"absent_or_empty",
|
|
79469
|
+
"absent",
|
|
79470
|
+
"empty_file"
|
|
79471
|
+
]);
|
|
79467
79472
|
function reportReadFailure(read, projectId, pathInTree) {
|
|
79468
79473
|
trackStudioEvent("sdk_session_unavailable", {
|
|
79469
79474
|
stage: "read",
|
|
79470
79475
|
reason: read.reason,
|
|
79471
79476
|
...read.reason === "http_error" ? { status: read.status, why: read.why } : {},
|
|
79472
79477
|
...read.reason === "network" ? { elapsed_ms: read.elapsedMs, hidden: read.hidden } : {},
|
|
79473
|
-
|
|
79478
|
+
...read.reason === "invalid_json" ? { content_type: read.contentType } : {},
|
|
79479
|
+
// Only meaningful for the empty-read reasons — the graveyard-refuted "clear
|
|
79474
79480
|
// activeCompPath when it's not in the tree" fix's proposed next step,
|
|
79475
79481
|
// scoped to instrumentation only. `null` while the tree hasn't loaded
|
|
79476
79482
|
// yet: a false-negative there would read as "genuinely absent" when it is
|
|
79477
|
-
// really "haven't looked".
|
|
79478
|
-
|
|
79483
|
+
// really "haven't looked". Carried on all three so the split keeps the
|
|
79484
|
+
// signal that made it worth splitting: every measured case so far is
|
|
79485
|
+
// `path_in_tree: true`, a file the tree lists and this read cannot get.
|
|
79486
|
+
...EMPTY_READ_REASONS.has(read.reason) ? { path_in_tree: pathInTree } : {}
|
|
79479
79487
|
});
|
|
79480
79488
|
if (read.reason !== "http_error") return null;
|
|
79481
79489
|
return read.status === 404 ? projectId : null;
|
|
@@ -79492,6 +79500,13 @@ async function httpReadFailureWhy(res) {
|
|
|
79492
79500
|
const body = await res.json().catch(() => null);
|
|
79493
79501
|
return typeof body?.why === "string" ? body.why : void 0;
|
|
79494
79502
|
}
|
|
79503
|
+
function classifyProjectFileBody(data) {
|
|
79504
|
+
if (typeof data.content !== "string") return { ok: false, reason: "missing_content" };
|
|
79505
|
+
if (data.content !== "") return { ok: true, content: data.content };
|
|
79506
|
+
if (data.missing === true) return { ok: false, reason: "absent" };
|
|
79507
|
+
if (data.missing === false) return { ok: false, reason: "empty_file" };
|
|
79508
|
+
return { ok: false, reason: "absent_or_empty" };
|
|
79509
|
+
}
|
|
79495
79510
|
async function readProjectFileOptional(projectId, path) {
|
|
79496
79511
|
if (path.includes("\0") || path.includes("..")) return { ok: false, reason: "unsafe_path" };
|
|
79497
79512
|
let res;
|
|
@@ -79507,10 +79522,17 @@ async function readProjectFileOptional(projectId, path) {
|
|
|
79507
79522
|
const why = await httpReadFailureWhy(res);
|
|
79508
79523
|
return { ok: false, reason: "http_error", status: res.status, ...why ? { why } : {} };
|
|
79509
79524
|
}
|
|
79510
|
-
|
|
79511
|
-
|
|
79512
|
-
|
|
79513
|
-
|
|
79525
|
+
let data;
|
|
79526
|
+
try {
|
|
79527
|
+
data = await res.json();
|
|
79528
|
+
} catch {
|
|
79529
|
+
return {
|
|
79530
|
+
ok: false,
|
|
79531
|
+
reason: "invalid_json",
|
|
79532
|
+
contentType: res.headers.get("content-type") ?? ""
|
|
79533
|
+
};
|
|
79534
|
+
}
|
|
79535
|
+
return classifyProjectFileBody(data);
|
|
79514
79536
|
}
|
|
79515
79537
|
function isSessionOwnerActive(owner, projectId, path, targetPath) {
|
|
79516
79538
|
if (!owner) return false;
|