veryfront 0.1.37 → 0.1.39

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.
@@ -1,49 +0,0 @@
1
- /**
2
- * Studio Endpoints Handler
3
- * Handles studio bridge script and other studio-specific endpoints
4
- */
5
- import * as dntShim from "../../../../_dnt.shims.js";
6
-
7
-
8
- import { BaseHandler } from "../../../security/index.js";
9
- import type {
10
- HandlerContext,
11
- HandlerMetadata,
12
- HandlerPriority,
13
- HandlerResult,
14
- } from "../types.js";
15
- import { HTTP_OK, PRIORITY_HIGH_DEV } from "../../../utils/constants/index.js";
16
- import { generateStudioBridgeScript } from "../../../studio/bridge-template.js";
17
-
18
- export class StudioEndpointsHandler extends BaseHandler {
19
- metadata: HandlerMetadata = {
20
- name: "StudioEndpointsHandler",
21
- priority: PRIORITY_HIGH_DEV as HandlerPriority,
22
- patterns: [{ pattern: "/_veryfront/studio-bridge.js", exact: true }],
23
- enabled: () => true, // Always enabled - studio_embed check is in the script
24
- };
25
-
26
- handle(req: dntShim.Request, ctx: HandlerContext): Promise<HandlerResult> {
27
- if (!this.shouldHandle(req, ctx)) {
28
- return Promise.resolve(this.continue());
29
- }
30
-
31
- const url = new URL(req.url);
32
- if (url.pathname !== "/_veryfront/studio-bridge.js") {
33
- return Promise.resolve(this.continue());
34
- }
35
-
36
- const builder = this.createResponseBuilder(ctx);
37
-
38
- const projectId = url.searchParams.get("projectId") ?? "";
39
- const pageId = url.searchParams.get("pageId") ?? "";
40
- const pagePath = url.searchParams.get("pagePath") ?? undefined;
41
- const wsUrl = url.searchParams.get("wsUrl") ?? undefined;
42
- const yjsGuid = url.searchParams.get("yjsGuid") ?? undefined;
43
-
44
- const script = generateStudioBridgeScript({ projectId, pageId, pagePath, wsUrl, yjsGuid });
45
- const response = builder.withCache("no-cache").javascript(script, HTTP_OK);
46
-
47
- return Promise.resolve(this.respond(response));
48
- }
49
- }