veryfront 0.1.115 → 0.1.116

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.115",
3
+ "version": "0.1.116",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -4,6 +4,7 @@ import type { HandlerContext, HandlerMetadata, HandlerResult } from "../../types
4
4
  export declare class DevFileHandler extends BaseHandler {
5
5
  metadata: HandlerMetadata;
6
6
  handle(req: dntShim.Request, ctx: HandlerContext): Promise<HandlerResult>;
7
+ private handleWithContext;
7
8
  private createErrorModule;
8
9
  }
9
10
  //# sourceMappingURL=dev-file.handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-file.handler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/dev-file.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AASxB,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAwC/E,OAAO,CAAC,iBAAiB;CAM1B"}
1
+ {"version":3,"file":"dev-file.handler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/dev-file.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AAWxB,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YA4CjE,iBAAiB;IAmC/B,OAAO,CAAC,iBAAiB;CAM1B"}
@@ -3,6 +3,8 @@ import { BaseHandler } from "../../response/base.js";
3
3
  import { validateDevFilePath } from "./path-validator.js";
4
4
  import { bundleDevFile } from "./esbuild-bundler.js";
5
5
  import { HTTP_INTERNAL_SERVER_ERROR, HTTP_NOT_FOUND, PRIORITY_MEDIUM_DEV_FILES, } from "../../../../utils/constants/index.js";
6
+ import { isExtendedFSAdapter } from "../../../../platform/adapters/fs/wrapper.js";
7
+ import { getHostEnv } from "../../../../platform/compat/process.js";
6
8
  export class DevFileHandler extends BaseHandler {
7
9
  metadata = {
8
10
  name: "DevFileHandler",
@@ -18,6 +20,32 @@ export class DevFileHandler extends BaseHandler {
18
20
  if (req.method !== "GET" || !pathname.startsWith("/_veryfront/fs/")) {
19
21
  return this.continue();
20
22
  }
23
+ const fsAdapter = ctx.adapter.fs;
24
+ const isExtended = isExtendedFSAdapter(fsAdapter);
25
+ if (!ctx.isLocalProject && ctx.projectSlug && isExtended && fsAdapter.isMultiProjectMode()) {
26
+ const effectiveToken = ctx.proxyToken || getHostEnv("VERYFRONT_API_TOKEN") || "";
27
+ const branch = ctx.parsedDomain?.branch ?? null;
28
+ return await fsAdapter.runWithContext(ctx.projectSlug, effectiveToken, () => this.handleWithContext(req, pathname, ctx), ctx.projectId, {
29
+ productionMode: false,
30
+ releaseId: ctx.releaseId,
31
+ branch,
32
+ environmentName: ctx.environmentName,
33
+ });
34
+ }
35
+ if (isExtended && fsAdapter.isContextualMode()) {
36
+ try {
37
+ if (ctx.proxyToken)
38
+ fsAdapter.setRequestToken(ctx.proxyToken);
39
+ fsAdapter.setRequestBranch(ctx.parsedDomain?.branch ?? null);
40
+ fsAdapter.setProductionMode(false, ctx.releaseId);
41
+ }
42
+ catch (_) {
43
+ /* expected: some fs adapter operations may not be supported */
44
+ }
45
+ }
46
+ return await this.handleWithContext(req, pathname, ctx);
47
+ }
48
+ async handleWithContext(req, pathname, ctx) {
21
49
  const encoded = pathname.slice("/_veryfront/fs/".length).replace(/\.js$/, "");
22
50
  const absPath = await validateDevFilePath(encoded, ctx);
23
51
  if (absPath.startsWith("Error:")) {
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.115";
1
+ export declare const VERSION = "0.1.116";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.115";
3
+ export const VERSION = "0.1.116";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.115",
3
+ "version": "0.1.116",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.115",
3
+ "version": "0.1.116",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -13,6 +13,8 @@ import {
13
13
  HTTP_NOT_FOUND,
14
14
  PRIORITY_MEDIUM_DEV_FILES,
15
15
  } from "../../../../utils/constants/index.js";
16
+ import { isExtendedFSAdapter } from "../../../../platform/adapters/fs/wrapper.js";
17
+ import { getHostEnv } from "../../../../platform/compat/process.js";
16
18
 
17
19
  export class DevFileHandler extends BaseHandler {
18
20
  metadata: HandlerMetadata = {
@@ -32,6 +34,45 @@ export class DevFileHandler extends BaseHandler {
32
34
  return this.continue();
33
35
  }
34
36
 
37
+ const fsAdapter = ctx.adapter.fs;
38
+ const isExtended = isExtendedFSAdapter(fsAdapter);
39
+
40
+ if (!ctx.isLocalProject && ctx.projectSlug && isExtended && fsAdapter.isMultiProjectMode()) {
41
+ const effectiveToken = ctx.proxyToken || getHostEnv("VERYFRONT_API_TOKEN") || "";
42
+ const branch = ctx.parsedDomain?.branch ?? null;
43
+
44
+ return await fsAdapter.runWithContext(
45
+ ctx.projectSlug,
46
+ effectiveToken,
47
+ () => this.handleWithContext(req, pathname, ctx),
48
+ ctx.projectId,
49
+ {
50
+ productionMode: false,
51
+ releaseId: ctx.releaseId,
52
+ branch,
53
+ environmentName: ctx.environmentName,
54
+ },
55
+ );
56
+ }
57
+
58
+ if (isExtended && fsAdapter.isContextualMode()) {
59
+ try {
60
+ if (ctx.proxyToken) fsAdapter.setRequestToken(ctx.proxyToken);
61
+ fsAdapter.setRequestBranch(ctx.parsedDomain?.branch ?? null);
62
+ fsAdapter.setProductionMode(false, ctx.releaseId);
63
+ } catch (_) {
64
+ /* expected: some fs adapter operations may not be supported */
65
+ }
66
+ }
67
+
68
+ return await this.handleWithContext(req, pathname, ctx);
69
+ }
70
+
71
+ private async handleWithContext(
72
+ req: dntShim.Request,
73
+ pathname: string,
74
+ ctx: HandlerContext,
75
+ ): Promise<HandlerResult> {
35
76
  const encoded = pathname.slice("/_veryfront/fs/".length).replace(/\.js$/, "");
36
77
  const absPath = await validateDevFilePath(encoded, ctx);
37
78
 
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.115";
3
+ export const VERSION = "0.1.116";