@editframe/dev-server 0.51.0

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.
@@ -0,0 +1,148 @@
1
+ # Editframe SDK License Agreement
2
+
3
+ **Effective Date:** January 12, 2026 **Version:** 2.0
4
+
5
+ This License Agreement ("License") governs your use of the Editframe SDK. By downloading, accessing, or using the SDK, you agree to these terms.
6
+
7
+ ---
8
+
9
+ ## 1. Definitions
10
+
11
+ **"Total Employees"** — All full-time employees, part-time employees, and contractor equivalents across your Organization and all affiliated entities under common control. Contractors are counted proportionally by time worked.
12
+
13
+ **"Organization"** — You, your company, and all affiliates, subsidiaries, or related entities under common control.
14
+
15
+ **"Client-Side SDK"** — The source-available browser-based video rendering components, including the custom video tag for local file playback.
16
+
17
+ **"Server-Side Rendering"** — Hosted cloud service for parallel rendering at scale, supporting simultaneous rendering of large volumes of videos including longer and more complex ones.
18
+
19
+ **"Premium Player"** — Cloud-based CDN streaming service with API-authenticated streaming capabilities, optimized for editing workflows.
20
+
21
+ **"Cloud Services"** — Server-Side Rendering and Premium Player collectively.
22
+
23
+ **"Commercial Use"** — Any use in connection with business operations, revenue-generating activities, or professional services, including internal tools, production environments, and client deliverables.
24
+
25
+ **"Evaluation Use"** — Good-faith testing and proof-of-concept development, limited to 30 days. Excludes production deployment and ongoing business use.
26
+
27
+ ---
28
+
29
+ ## 2. License Grant
30
+
31
+ ### 2.1 Free Tier (≤3 Employees)
32
+
33
+ A limited, non-exclusive, non-transferable, revocable license to use the Client-Side SDK.
34
+
35
+ **Eligible:**
36
+
37
+ - Organizations with ≤3 total employees (Commercial Use permitted)
38
+ - Evaluation Use (any size, 30 days, non-production)
39
+ - Registered non-profits (any size)
40
+ - Accredited educational institutions
41
+ - Personal non-commercial projects
42
+
43
+ **Permitted:**
44
+
45
+ - Install and use the Client-Side SDK
46
+ - Use the custom video tag for local file playback (no API key required)
47
+ - Create and distribute video outputs for personal or Commercial Use
48
+
49
+ **Not included:** Cloud Services. Cloud Services require a Cloud Tier subscription regardless of company size.
50
+
51
+ ### 2.2 Team Tier (4–10 Employees)
52
+
53
+ Includes all Free Tier rights. Full Client-Side SDK use for any business purpose including production. Does not include Cloud Services. See [editframe.com/pricing](https://editframe.com/pricing) for pricing.
54
+
55
+ ### 2.3 Cloud Tier (11–20 Employees, or Any Size Requiring Cloud)
56
+
57
+ Required for organizations with 11–20 employees, or any organization using Cloud Services.
58
+
59
+ Includes all Team Tier rights, plus Server-Side Rendering and Premium Player via API. Usage-based billing applies in addition to base subscription. See [editframe.com/pricing](https://editframe.com/pricing) for pricing.
60
+
61
+ ### 2.4 Enterprise (21+ Employees)
62
+
63
+ Contact [hello@editframe.com](mailto:hello@editframe.com). Includes all Cloud Tier features plus priority support and custom SLAs.
64
+
65
+ ---
66
+
67
+ ## 3. Restrictions
68
+
69
+ ### 3.1 Prohibited
70
+
71
+ - Do not offer the Client-Side SDK or CLI itself as a managed rendering API or infrastructure product to third parties
72
+ - Do not fork, redistribute, or sublicense the Client-Side SDK or CLI under different terms
73
+ - Do not use the SDK above your tier threshold without upgrading
74
+ - Do not share credentials or API keys across separate organizations
75
+ - Do not implement workarounds to avoid usage-based billing
76
+ - Do not reverse engineer, decompile, or extract proprietary algorithms from Server-Side Rendering or Premium Player
77
+ - Do not access Cloud Service APIs other than through official client libraries
78
+ - Do not disable, circumvent, or tamper with telemetry
79
+ - Do not remove or alter copyright notices or attribution
80
+ - Do not use the SDK for unlawful purposes or in violation of export control regulations
81
+
82
+ ### 3.2 Permitted
83
+
84
+ - Build any product that creates, processes, or delivers video — editors, workflows, motion design tools, content automation, and more
85
+ - Integrate the Client-Side SDK into platforms, coding environments, vibe coding tools, and AI agents (end users are individually responsible for compliance)
86
+ - Use the Client-Side SDK in CI/CD pipelines and development environments, provided you are not using it to render production video at scale
87
+
88
+ ---
89
+
90
+ ## 4. Intellectual Property
91
+
92
+ Editframe, Inc. retains all rights to the SDK. This License does not transfer ownership. You retain all rights to video outputs you create ("Your Content"). Feedback may be used by us without obligation.
93
+
94
+ ---
95
+
96
+ ## 5. Telemetry
97
+
98
+ The SDK includes always-on telemetry collecting render counts, durations, IP addresses, domains, and feature usage. Telemetry cannot be disabled. Required for usage-based billing and license compliance. No video content is collected. See [editframe.com/privacy](https://editframe.com/privacy).
99
+
100
+ High Client-Side rendering volume does not trigger payment requirements — eligibility is determined by company size only.
101
+
102
+ ---
103
+
104
+ ## 6. Support
105
+
106
+ - **Free:** Community support
107
+ - **Team/Cloud:** Email and Slack, 48-hour response
108
+ - **Enterprise:** Dedicated support, custom SLAs
109
+
110
+ ---
111
+
112
+ ## 7. Warranties
113
+
114
+ THE SDK IS PROVIDED "AS IS" WITHOUT WARRANTIES OF ANY KIND. WE DO NOT WARRANT THAT THE SDK WILL BE ERROR-FREE, SECURE, OR UNINTERRUPTED. YOU ASSUME ALL RISKS.
115
+
116
+ ---
117
+
118
+ ## 8. Limitation of Liability
119
+
120
+ WE SHALL NOT BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES. TOTAL LIABILITY SHALL NOT EXCEED AMOUNTS PAID IN THE 12 MONTHS PRECEDING THE CLAIM, OR $100 USD, WHICHEVER IS GREATER.
121
+
122
+ ---
123
+
124
+ ## 9. Termination
125
+
126
+ This License is effective upon first use. We may terminate immediately for breach, failure to maintain required subscription tier, or fraudulent conduct (10 days' notice where feasible). Upon termination, all rights cease and you must delete all SDK copies.
127
+
128
+ ---
129
+
130
+ ## 10. Compliance
131
+
132
+ Self-report your employee count accurately. Violations may result in termination, back-payment of owed fees, liquidated damages (3× unpaid fees), and legal action. Voluntary disclosure may result in waived penalties.
133
+
134
+ ---
135
+
136
+ ## 11. General
137
+
138
+ - **Governing Law:** Delaware
139
+ - **Jurisdiction:** New York County, NY
140
+ - **Export Controls:** You must comply with U.S. Export Administration Regulations
141
+ - **Assignment:** You may not assign this License without written consent
142
+ - **Entire Agreement:** This License, Terms of Service, and Privacy Policy constitute the full agreement
143
+
144
+ ---
145
+
146
+ [hello@editframe.com](mailto:hello@editframe.com) · editframe.com
147
+
148
+ **By using the SDK, you agree to these terms.**
package/LICENSE.md ADDED
@@ -0,0 +1,58 @@
1
+ # Editframe SDK License
2
+
3
+ The Editframe SDK is source-available and free for individuals and small teams, including for commercial use. We've kept the bar low intentionally — if you're building something, you should be able to just use it.
4
+
5
+ - [Free Tier](#free-tier)
6
+ - [Paid Tiers](#paid-tiers)
7
+
8
+ ---
9
+
10
+ ## Free Tier
11
+
12
+ Copyright © 2026 [Editframe](https://editframe.com)
13
+
14
+ ### Who Qualifies
15
+
16
+ - Individuals and freelancers
17
+ - Organizations with 3 or fewer total employees
18
+ - Non-profits and not-for-profit organizations (any size)
19
+ - Accredited educational institutions
20
+ - Organizations evaluating Editframe in good faith, prior to commercial deployment (30 days)
21
+
22
+ ### What You Can Build
23
+
24
+ Use and modify the SDK to build any product that creates, processes, or delivers video — editors, workflows, motion design tools, content automation, and more. Platforms, coding environments, vibe coding tools, and AI agents may freely integrate the SDK. End users are each responsible for their own license compliance.
25
+
26
+ ### What Is Not Permitted
27
+
28
+ You may not offer the Client-Side SDK or CLI itself as a managed rendering API or infrastructure product to third parties. You may not sell, sublicense, or redistribute the SDK or modifications to it as a standalone product.
29
+
30
+ ### Warranty
31
+
32
+ The SDK is provided as-is without warranty of any kind. See the [Full License Agreement](./LICENSE-FULL.md) for complete terms.
33
+
34
+ ---
35
+
36
+ ## Paid Tiers
37
+
38
+ Organizations outside the Free Tier must subscribe to a paid plan.
39
+
40
+ | Tier | Employees |
41
+ | :---- | :---- |
42
+ | Team | 4–10 |
43
+ | Cloud | 11–20, or any size needing Cloud Rendering & Player |
44
+ | Enterprise | 21+ |
45
+
46
+ All paid tiers include full SDK rights.
47
+
48
+ Cloud Rendering & Player — parallel rendering and CDN streaming optimized for editing workflows — requires a Cloud Tier subscription regardless of company size.
49
+
50
+ [View pricing →](https://editframe.com/pricing) · Enterprise: [hello@editframe.com](mailto:hello@editframe.com)
51
+
52
+ ---
53
+
54
+ Unsure which tier applies? See the [FAQ](https://editframe.com/faq) or reach out at [hello@editframe.com](mailto:hello@editframe.com).
55
+
56
+ [Full License Agreement](./LICENSE-FULL.md) · [Terms of Service](https://editframe.com/terms)
57
+
58
+ *© 2026 Editframe, Inc.*
@@ -0,0 +1,20 @@
1
+ import { ServerResponse } from "node:http";
2
+ import { IncomingMessage as IncomingMessage$1 } from "connect";
3
+
4
+ //#region src/efHandlers.d.ts
5
+ interface EfHandlers {
6
+ signUrl(req: IncomingMessage$1, res: ServerResponse): Promise<void>;
7
+ clearCache(req: IncomingMessage$1, res: ServerResponse, cacheRoot: string): Promise<void>;
8
+ writeSnapshot?(req: IncomingMessage$1, res: ServerResponse): Promise<void>;
9
+ compareSnapshot?(req: IncomingMessage$1, res: ServerResponse): Promise<void>;
10
+ compareTwoImages?(req: IncomingMessage$1, res: ServerResponse): Promise<void>;
11
+ }
12
+ interface ProdEfHandlersDeps {
13
+ createURLToken: (client: any, url: string) => Promise<string>;
14
+ getClient: () => any;
15
+ }
16
+ declare function createProdEfHandlers(deps: ProdEfHandlersDeps): EfHandlers;
17
+ declare function createVitestEfHandlers(root: string): EfHandlers;
18
+ //#endregion
19
+ export { EfHandlers, ProdEfHandlersDeps, createProdEfHandlers, createVitestEfHandlers };
20
+ //# sourceMappingURL=efHandlers.d.ts.map
@@ -0,0 +1,272 @@
1
+ import { handleClearCache } from "./middleware.js";
2
+ import debug from "debug";
3
+ import { existsSync } from "node:fs";
4
+ import path, { join } from "node:path";
5
+ import { mkdir, writeFile } from "node:fs/promises";
6
+ import { compare } from "odiff-bin";
7
+ //#region src/efHandlers.ts
8
+ async function collectJsonBody(req) {
9
+ const chunks = [];
10
+ for await (const chunk of req) chunks.push(chunk);
11
+ const body = Buffer.concat(chunks).toString("utf-8");
12
+ return JSON.parse(body);
13
+ }
14
+ function parseDataUrl(dataUrl) {
15
+ const matches = dataUrl.match(/^data:([^;]+);base64,(.+)$/);
16
+ if (!matches) throw new Error("Invalid data URL format");
17
+ const mimeType = matches[1];
18
+ const base64Data = matches[2];
19
+ const buffer = Buffer.from(base64Data, "base64");
20
+ let extension = "png";
21
+ if (mimeType === "image/jpeg" || mimeType === "image/jpg") extension = "jpg";
22
+ else if (mimeType === "image/webp") extension = "webp";
23
+ return {
24
+ buffer,
25
+ mimeType,
26
+ extension
27
+ };
28
+ }
29
+ function getSnapshotDir(root, testName) {
30
+ return path.resolve(root, "test", "__snapshots__", testName);
31
+ }
32
+ function getSnapshotPaths(root, testName, snapshotName) {
33
+ const dir = getSnapshotDir(root, testName);
34
+ return {
35
+ dir,
36
+ baseline: join(dir, `${snapshotName}.baseline.png`),
37
+ actual: join(dir, `${snapshotName}.actual.png`),
38
+ diff: join(dir, `${snapshotName}.diff.png`)
39
+ };
40
+ }
41
+ function createProdEfHandlers(deps) {
42
+ return {
43
+ async signUrl(req, res) {
44
+ const log = debug("ef:dev-server:sign-url");
45
+ if (req.method !== "POST") {
46
+ res.writeHead(405, { Allow: "POST" });
47
+ res.end();
48
+ return;
49
+ }
50
+ log("Signing URL token");
51
+ let body = "";
52
+ req.on("data", (chunk) => {
53
+ body += chunk.toString();
54
+ });
55
+ await new Promise((resolve) => {
56
+ req.on("end", async () => {
57
+ try {
58
+ const payload = JSON.parse(body);
59
+ log("Token signing request payload:", payload);
60
+ const { url, params } = payload;
61
+ if (!url) {
62
+ res.writeHead(400, { "Content-Type": "application/json" });
63
+ res.end(JSON.stringify({ error: "URL is required" }));
64
+ resolve();
65
+ return;
66
+ }
67
+ const client = deps.getClient();
68
+ let fullUrl = url;
69
+ if (params) {
70
+ const urlObj = new URL(url);
71
+ Object.entries(params).forEach(([key, value]) => {
72
+ urlObj.searchParams.set(key, String(value));
73
+ });
74
+ fullUrl = urlObj.toString();
75
+ }
76
+ log("Creating token for full URL:", fullUrl);
77
+ const token = await deps.createURLToken(client, fullUrl);
78
+ res.writeHead(200, { "Content-Type": "application/json" });
79
+ res.end(JSON.stringify({ token }));
80
+ } catch (error) {
81
+ log(`Error signing URL token: ${error}`);
82
+ res.writeHead(500, { "Content-Type": "application/json" });
83
+ res.end(JSON.stringify({ error: "Failed to sign URL token" }));
84
+ }
85
+ resolve();
86
+ });
87
+ });
88
+ },
89
+ clearCache: handleClearCache
90
+ };
91
+ }
92
+ function createVitestEfHandlers(root) {
93
+ return {
94
+ async signUrl(req, res) {
95
+ const log = debug("ef:dev-server:sign-url");
96
+ if (req.method !== "POST") {
97
+ res.writeHead(405, { Allow: "POST" });
98
+ res.end();
99
+ return;
100
+ }
101
+ log("Returning mock token response");
102
+ const requestChunks = [];
103
+ req.on("data", (chunk) => {
104
+ requestChunks.push(chunk);
105
+ });
106
+ await new Promise((resolve) => {
107
+ req.on("end", () => {
108
+ const mockToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwOi8vd2ViOjMwMDAvaGVhZC1tb292LTQ4MHAubXA0IiwiZXhwIjo5OTk5OTk5OTk5fQ.mock-signature";
109
+ res.writeHead(200, { "Content-Type": "application/json" });
110
+ res.end(JSON.stringify({ token: mockToken }));
111
+ resolve();
112
+ });
113
+ });
114
+ },
115
+ clearCache: handleClearCache,
116
+ async writeSnapshot(req, res) {
117
+ const log = debug("ef:dev-server:snapshot");
118
+ if (req.method !== "POST") {
119
+ res.writeHead(405, { Allow: "POST" });
120
+ res.end();
121
+ return;
122
+ }
123
+ try {
124
+ const { testName, snapshotName, dataUrl, isBaseline } = await collectJsonBody(req);
125
+ const paths = getSnapshotPaths(root, testName, snapshotName);
126
+ await mkdir(paths.dir, { recursive: true });
127
+ const { buffer } = parseDataUrl(dataUrl);
128
+ const targetPath = isBaseline ? paths.baseline : paths.actual;
129
+ await writeFile(targetPath, buffer);
130
+ log(`Wrote snapshot to ${targetPath}`);
131
+ res.writeHead(200, { "Content-Type": "application/json" });
132
+ res.end(JSON.stringify({
133
+ success: true,
134
+ path: targetPath
135
+ }));
136
+ } catch (error) {
137
+ log(`Error writing snapshot: ${error}`);
138
+ res.writeHead(500, { "Content-Type": "text/plain" });
139
+ res.end(error instanceof Error ? error.message : String(error));
140
+ }
141
+ },
142
+ async compareSnapshot(req, res) {
143
+ const log = debug("ef:dev-server:snapshot");
144
+ if (req.method !== "POST") {
145
+ res.writeHead(405, { Allow: "POST" });
146
+ res.end();
147
+ return;
148
+ }
149
+ try {
150
+ const { testName, snapshotName, dataUrl, threshold = .1, antialiasing = true, acceptableDiffPercentage = 1 } = await collectJsonBody(req);
151
+ const paths = getSnapshotPaths(root, testName, snapshotName);
152
+ await mkdir(paths.dir, { recursive: true });
153
+ const { buffer } = parseDataUrl(dataUrl);
154
+ await writeFile(paths.actual, buffer);
155
+ log(`Wrote actual snapshot to ${paths.actual}`);
156
+ if (!existsSync(paths.baseline)) {
157
+ await writeFile(paths.baseline, buffer);
158
+ log(`Created baseline at ${paths.baseline}`);
159
+ res.writeHead(200, { "Content-Type": "application/json" });
160
+ res.end(JSON.stringify({
161
+ match: true,
162
+ baselineCreated: true
163
+ }));
164
+ return;
165
+ }
166
+ log(`Comparing ${paths.actual} against ${paths.baseline}`);
167
+ const result = await compare(paths.baseline, paths.actual, paths.diff, {
168
+ threshold,
169
+ antialiasing
170
+ });
171
+ if (result.match) {
172
+ res.writeHead(200, { "Content-Type": "application/json" });
173
+ res.end(JSON.stringify({
174
+ match: true,
175
+ diffCount: 0,
176
+ diffPercentage: 0
177
+ }));
178
+ } else if (result.reason === "pixel-diff") {
179
+ const diffPercentage = result.diffPercentage ?? 0;
180
+ const match = diffPercentage <= acceptableDiffPercentage;
181
+ log(`Diff: ${result.diffCount} pixels (${diffPercentage.toFixed(2)}%), match: ${match}`);
182
+ res.writeHead(200, { "Content-Type": "application/json" });
183
+ res.end(JSON.stringify({
184
+ match,
185
+ diffCount: result.diffCount,
186
+ diffPercentage
187
+ }));
188
+ } else if (result.reason === "layout-diff") {
189
+ log(`Layout diff detected`);
190
+ res.writeHead(200, { "Content-Type": "application/json" });
191
+ res.end(JSON.stringify({
192
+ match: false,
193
+ error: "Images have different dimensions"
194
+ }));
195
+ } else {
196
+ res.writeHead(200, { "Content-Type": "application/json" });
197
+ res.end(JSON.stringify({
198
+ match: false,
199
+ error: `Comparison failed: ${result.reason}`
200
+ }));
201
+ }
202
+ } catch (error) {
203
+ log(`Error comparing snapshot: ${error}`);
204
+ res.writeHead(500, { "Content-Type": "text/plain" });
205
+ res.end(error instanceof Error ? error.message : String(error));
206
+ }
207
+ },
208
+ async compareTwoImages(req, res) {
209
+ const log = debug("ef:dev-server:snapshot");
210
+ if (req.method !== "POST") {
211
+ res.writeHead(405, { Allow: "POST" });
212
+ res.end();
213
+ return;
214
+ }
215
+ try {
216
+ const { testName, comparisonName, dataUrl1, dataUrl2, threshold = .1, acceptableDiffPercentage = 1 } = await collectJsonBody(req);
217
+ const dir = getSnapshotDir(root, testName);
218
+ await mkdir(dir, { recursive: true });
219
+ const image1Path = join(dir, `${comparisonName}.image1.png`);
220
+ const image2Path = join(dir, `${comparisonName}.image2.png`);
221
+ const diffPath = join(dir, `${comparisonName}.diff.png`);
222
+ const { buffer: buffer1 } = parseDataUrl(dataUrl1);
223
+ const { buffer: buffer2 } = parseDataUrl(dataUrl2);
224
+ await writeFile(image1Path, buffer1);
225
+ await writeFile(image2Path, buffer2);
226
+ log(`Comparing two images: ${image1Path} vs ${image2Path}`);
227
+ const result = await compare(image1Path, image2Path, diffPath, {
228
+ threshold,
229
+ antialiasing: true
230
+ });
231
+ if (result.match) {
232
+ res.writeHead(200, { "Content-Type": "application/json" });
233
+ res.end(JSON.stringify({
234
+ match: true,
235
+ diffCount: 0,
236
+ diffPercentage: 0
237
+ }));
238
+ } else if (result.reason === "pixel-diff") {
239
+ const diffPercentage = result.diffPercentage ?? 0;
240
+ const match = diffPercentage <= acceptableDiffPercentage;
241
+ log(`Diff: ${result.diffCount} pixels (${diffPercentage.toFixed(2)}%), match: ${match}`);
242
+ res.writeHead(200, { "Content-Type": "application/json" });
243
+ res.end(JSON.stringify({
244
+ match,
245
+ diffCount: result.diffCount,
246
+ diffPercentage
247
+ }));
248
+ } else if (result.reason === "layout-diff") {
249
+ res.writeHead(200, { "Content-Type": "application/json" });
250
+ res.end(JSON.stringify({
251
+ match: false,
252
+ error: "Images have different dimensions"
253
+ }));
254
+ } else {
255
+ res.writeHead(200, { "Content-Type": "application/json" });
256
+ res.end(JSON.stringify({
257
+ match: false,
258
+ error: `Comparison failed: ${result.reason}`
259
+ }));
260
+ }
261
+ } catch (error) {
262
+ log(`Error comparing images: ${error}`);
263
+ res.writeHead(500, { "Content-Type": "text/plain" });
264
+ res.end(error instanceof Error ? error.message : String(error));
265
+ }
266
+ }
267
+ };
268
+ }
269
+ //#endregion
270
+ export { createProdEfHandlers, createVitestEfHandlers };
271
+
272
+ //# sourceMappingURL=efHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"efHandlers.js","names":["odiffCompare"],"sources":["../src/efHandlers.ts"],"mappings":";;;;;;;AA2BA,eAAe,gBAAmB,KAAkC;CAClE,MAAM,SAAmB,EAAE;AAC3B,YAAW,MAAM,SAAS,IACxB,QAAO,KAAK,MAAgB;CAE9B,MAAM,OAAO,OAAO,OAAO,OAAO,CAAC,SAAS,QAAQ;AACpD,QAAO,KAAK,MAAM,KAAK;;AAGzB,SAAS,aAAa,SAIpB;CACA,MAAM,UAAU,QAAQ,MAAM,6BAA6B;AAC3D,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0BAA0B;CAE5C,MAAM,WAAW,QAAQ;CACzB,MAAM,aAAa,QAAQ;CAC3B,MAAM,SAAS,OAAO,KAAK,YAAY,SAAS;CAEhD,IAAI,YAAY;AAChB,KAAI,aAAa,gBAAgB,aAAa,YAC5C,aAAY;UACH,aAAa,aACtB,aAAY;AAGd,QAAO;EAAE;EAAQ;EAAU;EAAW;;AAGxC,SAAS,eAAe,MAAc,UAA0B;AAC9D,QAAO,KAAK,QAAQ,MAAM,QAAQ,iBAAiB,SAAS;;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AAO;AACd,QAAI,2BAA2B,QAAQ;AACvC,QAAI,UAAU,KAAK,EAAE,gBAAgB,cAAc,CAAC;AACpD,QAAI,IAAI,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;;EAGpE"}
@@ -0,0 +1,7 @@
1
+ import { IncomingMessage } from "connect";
2
+
3
+ //#region src/forbidRelativePaths.d.ts
4
+ declare const forbidRelativePaths: (req: IncomingMessage) => void;
5
+ //#endregion
6
+ export { forbidRelativePaths };
7
+ //# sourceMappingURL=forbidRelativePaths.d.ts.map
@@ -0,0 +1,8 @@
1
+ //#region src/forbidRelativePaths.ts
2
+ const forbidRelativePaths = (req) => {
3
+ if (req.url?.includes("..")) throw new Error("Relative paths are forbidden");
4
+ };
5
+ //#endregion
6
+ export { forbidRelativePaths };
7
+
8
+ //# sourceMappingURL=forbidRelativePaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidRelativePaths.js","names":[],"sources":["../src/forbidRelativePaths.ts"],"mappings":";AAEA,MAAa,uBAAuB,QAAyB;AAC3D,KAAI,IAAI,KAAK,SAAS,KAAK,CACzB,OAAM,IAAI,MAAM,+BAA+B"}
@@ -0,0 +1,8 @@
1
+ import { AssetFunctions, JitMiddlewareOptions, TrackFragmentIndex, createJitTranscodeMiddleware, generateLocalJitManifest, getSegmentDurationsMs, isLocalHost, resolveMediaPath, sendByteRange, sendMultipleByteRanges } from "./jitTranscodeMiddleware.js";
2
+ import { EfHandlers, ProdEfHandlersDeps, createProdEfHandlers, createVitestEfHandlers } from "./efHandlers.js";
3
+ import { DevServerOptions, RouterAssetFunctions, createEditframeRouter, injectApiHostScript } from "./router.js";
4
+ import { EditframeDevServerOptions, createEditframeDevServer } from "./server.js";
5
+ import { createAssetsApiMiddleware, createLocalFilesApiMiddleware, handleClearCache } from "./middleware.js";
6
+ import { sendTaskResult } from "./sendTaskResult.js";
7
+ import { forbidRelativePaths } from "./forbidRelativePaths.js";
8
+ export { type AssetFunctions, type DevServerOptions, type EditframeDevServerOptions, type EfHandlers, type JitMiddlewareOptions, type ProdEfHandlersDeps, type RouterAssetFunctions, type TrackFragmentIndex, createAssetsApiMiddleware, createEditframeDevServer, createEditframeRouter, createJitTranscodeMiddleware, createLocalFilesApiMiddleware, createProdEfHandlers, createVitestEfHandlers, forbidRelativePaths, generateLocalJitManifest, getSegmentDurationsMs, handleClearCache, injectApiHostScript, isLocalHost, resolveMediaPath, sendByteRange, sendMultipleByteRanges, sendTaskResult };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { forbidRelativePaths } from "./forbidRelativePaths.js";
2
+ import { createJitTranscodeMiddleware, generateLocalJitManifest, getSegmentDurationsMs, isLocalHost, resolveMediaPath, sendByteRange, sendMultipleByteRanges } from "./jitTranscodeMiddleware.js";
3
+ import { sendTaskResult } from "./sendTaskResult.js";
4
+ import { createAssetsApiMiddleware, createLocalFilesApiMiddleware, handleClearCache } from "./middleware.js";
5
+ import { createEditframeRouter, injectApiHostScript } from "./router.js";
6
+ import { createEditframeDevServer } from "./server.js";
7
+ import { createProdEfHandlers, createVitestEfHandlers } from "./efHandlers.js";
8
+ export { createAssetsApiMiddleware, createEditframeDevServer, createEditframeRouter, createJitTranscodeMiddleware, createLocalFilesApiMiddleware, createProdEfHandlers, createVitestEfHandlers, forbidRelativePaths, generateLocalJitManifest, getSegmentDurationsMs, handleClearCache, injectApiHostScript, isLocalHost, resolveMediaPath, sendByteRange, sendMultipleByteRanges, sendTaskResult };