@valbuild/server 0.60.11 → 0.60.13
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.
@@ -2560,7 +2560,7 @@ class ProxyValServer extends ValServer {
|
|
2560
2560
|
};
|
2561
2561
|
}
|
2562
2562
|
const params = `commit=${encodeURIComponent(commit)}&root=${encodeURIComponent(this.apiOptions.root || "/")}&cwd=${encodeURIComponent(this.cwd)}`;
|
2563
|
-
const url = new URL(`/v1/commit/${this.options.
|
2563
|
+
const url = new URL(`/v1/commit/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2564
2564
|
|
2565
2565
|
// Creates a fresh copy of the fs. We cannot touch the existing fs, since there might be parallel operations?
|
2566
2566
|
// We could perhaps free up the other fs while doing this operation, but uncertain if we can actually do that and if that would actually help on memory.
|
@@ -2615,13 +2615,11 @@ class ProxyValServer extends ValServer {
|
|
2615
2615
|
async initRemoteFS(commit, remoteFS, token) {
|
2616
2616
|
const params = new URLSearchParams(this.apiOptions.root ? {
|
2617
2617
|
root: this.apiOptions.root,
|
2618
|
-
commit
|
2619
|
-
cwd: this.cwd
|
2618
|
+
commit
|
2620
2619
|
} : {
|
2621
|
-
commit
|
2622
|
-
cwd: this.cwd
|
2620
|
+
commit
|
2623
2621
|
});
|
2624
|
-
const url = new URL(`/v1/fs/${this.options.
|
2622
|
+
const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2625
2623
|
try {
|
2626
2624
|
const fetchRes = await fetch(url, {
|
2627
2625
|
headers: getAuthHeaders(token, "application/json")
|
@@ -2658,7 +2656,8 @@ class ProxyValServer extends ValServer {
|
|
2658
2656
|
}
|
2659
2657
|
};
|
2660
2658
|
}
|
2661
|
-
remoteFS.initializeWith(json.directories)
|
2659
|
+
remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__namespace["default"].join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
|
2660
|
+
), content])));
|
2662
2661
|
return {
|
2663
2662
|
status: 200
|
2664
2663
|
};
|
@@ -2800,7 +2799,7 @@ class ProxyValServer extends ValServer {
|
|
2800
2799
|
}
|
2801
2800
|
async session(cookies) {
|
2802
2801
|
return withAuth(this.options.valSecret, cookies, "session", async data => {
|
2803
|
-
const url = new URL(`/api/val/${this.options.
|
2802
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/session`, this.options.valBuildUrl);
|
2804
2803
|
const fetchRes = await fetch(url, {
|
2805
2804
|
headers: getAuthHeaders(data.token, "application/json")
|
2806
2805
|
});
|
@@ -2825,7 +2824,7 @@ class ProxyValServer extends ValServer {
|
|
2825
2824
|
});
|
2826
2825
|
}
|
2827
2826
|
async consumeCode(code) {
|
2828
|
-
const url = new URL(`/api/val/${this.options.
|
2827
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/token`, this.options.valBuildUrl);
|
2829
2828
|
url.searchParams.set("code", encodeURIComponent(code));
|
2830
2829
|
return fetch(url, {
|
2831
2830
|
method: "POST",
|
@@ -2851,13 +2850,13 @@ class ProxyValServer extends ValServer {
|
|
2851
2850
|
});
|
2852
2851
|
}
|
2853
2852
|
getAuthorizeUrl(publicValApiRoute, token) {
|
2854
|
-
const url = new URL(`/auth/${this.options.
|
2853
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2855
2854
|
url.searchParams.set("redirect_uri", encodeURIComponent(`${publicValApiRoute}/callback`));
|
2856
2855
|
url.searchParams.set("state", token);
|
2857
2856
|
return url.toString();
|
2858
2857
|
}
|
2859
2858
|
getAppErrorUrl(error) {
|
2860
|
-
const url = new URL(`/auth/${this.options.
|
2859
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2861
2860
|
url.searchParams.set("error", encodeURIComponent(error));
|
2862
2861
|
return url.toString();
|
2863
2862
|
}
|
@@ -2872,7 +2871,7 @@ class ProxyValServer extends ValServer {
|
|
2872
2871
|
token
|
2873
2872
|
}) => {
|
2874
2873
|
const patchIds = query.id || [];
|
2875
|
-
const url = new URL(`/v1/patches/${this.options.
|
2874
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~`, this.options.valContentUrl);
|
2876
2875
|
const fetchRes = await fetch(url, {
|
2877
2876
|
method: "DELETE",
|
2878
2877
|
headers: getAuthHeaders(token, "application/json"),
|
@@ -2905,7 +2904,7 @@ class ProxyValServer extends ValServer {
|
|
2905
2904
|
}
|
2906
2905
|
const patchIds = query.id || [];
|
2907
2906
|
const params = patchIds.length > 0 ? `commit=${encodeURIComponent(commit)}&${patchIds.map(id => `id=${encodeURIComponent(id)}`).join("&")}` : `commit=${encodeURIComponent(commit)}`;
|
2908
|
-
const url = new URL(`/v1/patches/${this.options.
|
2907
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2909
2908
|
// Proxy patch to val.build
|
2910
2909
|
const fetchRes = await fetch(url, {
|
2911
2910
|
method: "GET",
|
@@ -2949,7 +2948,7 @@ class ProxyValServer extends ValServer {
|
|
2949
2948
|
};
|
2950
2949
|
}
|
2951
2950
|
const patches = parsedPatches.data;
|
2952
|
-
const url = new URL(`/v1/patches/${this.options.
|
2951
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2953
2952
|
// Proxy patch to val.build
|
2954
2953
|
const fetchRes = await fetch(url, {
|
2955
2954
|
method: "POST",
|
@@ -2968,7 +2967,7 @@ class ProxyValServer extends ValServer {
|
|
2968
2967
|
}
|
2969
2968
|
async getFiles(filePath, query, cookies) {
|
2970
2969
|
return withAuth(this.options.valSecret, cookies, "getFiles", async data => {
|
2971
|
-
const url = new URL(`/v1/files/${this.options.
|
2970
|
+
const url = new URL(`/v1/files/${this.options.remote}${filePath}`, this.options.valContentUrl);
|
2972
2971
|
if (typeof query.sha256 === "string") {
|
2973
2972
|
url.searchParams.append("sha256", query.sha256);
|
2974
2973
|
} else {
|
@@ -3253,9 +3252,9 @@ async function initHandlerOptions(route, opts) {
|
|
3253
3252
|
if (!maybeGitBranch) {
|
3254
3253
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
3255
3254
|
}
|
3256
|
-
const
|
3257
|
-
if (!
|
3258
|
-
throw new Error("
|
3255
|
+
const maybeValRemote = opts.remote || process.env.VAL_REMOTE;
|
3256
|
+
if (!maybeValRemote) {
|
3257
|
+
throw new Error("Proxy mode does not work unless the 'remote' option in val.config is defined or the VAL_REMOTE env var is set.");
|
3259
3258
|
}
|
3260
3259
|
return {
|
3261
3260
|
mode: "proxy",
|
@@ -3268,7 +3267,7 @@ async function initHandlerOptions(route, opts) {
|
|
3268
3267
|
commit: maybeGitCommit,
|
3269
3268
|
branch: maybeGitBranch
|
3270
3269
|
},
|
3271
|
-
|
3270
|
+
remote: maybeValRemote,
|
3272
3271
|
valEnableRedirectUrl: opts.valEnableRedirectUrl || process.env.VAL_ENABLE_REDIRECT_URL,
|
3273
3272
|
valDisableRedirectUrl: opts.valDisableRedirectUrl || process.env.VAL_DISABLE_REDIRECT_URL
|
3274
3273
|
};
|
@@ -2560,7 +2560,7 @@ class ProxyValServer extends ValServer {
|
|
2560
2560
|
};
|
2561
2561
|
}
|
2562
2562
|
const params = `commit=${encodeURIComponent(commit)}&root=${encodeURIComponent(this.apiOptions.root || "/")}&cwd=${encodeURIComponent(this.cwd)}`;
|
2563
|
-
const url = new URL(`/v1/commit/${this.options.
|
2563
|
+
const url = new URL(`/v1/commit/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2564
2564
|
|
2565
2565
|
// Creates a fresh copy of the fs. We cannot touch the existing fs, since there might be parallel operations?
|
2566
2566
|
// We could perhaps free up the other fs while doing this operation, but uncertain if we can actually do that and if that would actually help on memory.
|
@@ -2615,13 +2615,11 @@ class ProxyValServer extends ValServer {
|
|
2615
2615
|
async initRemoteFS(commit, remoteFS, token) {
|
2616
2616
|
const params = new URLSearchParams(this.apiOptions.root ? {
|
2617
2617
|
root: this.apiOptions.root,
|
2618
|
-
commit
|
2619
|
-
cwd: this.cwd
|
2618
|
+
commit
|
2620
2619
|
} : {
|
2621
|
-
commit
|
2622
|
-
cwd: this.cwd
|
2620
|
+
commit
|
2623
2621
|
});
|
2624
|
-
const url = new URL(`/v1/fs/${this.options.
|
2622
|
+
const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2625
2623
|
try {
|
2626
2624
|
const fetchRes = await fetch(url, {
|
2627
2625
|
headers: getAuthHeaders(token, "application/json")
|
@@ -2658,7 +2656,8 @@ class ProxyValServer extends ValServer {
|
|
2658
2656
|
}
|
2659
2657
|
};
|
2660
2658
|
}
|
2661
|
-
remoteFS.initializeWith(json.directories)
|
2659
|
+
remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__namespace["default"].join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
|
2660
|
+
), content])));
|
2662
2661
|
return {
|
2663
2662
|
status: 200
|
2664
2663
|
};
|
@@ -2800,7 +2799,7 @@ class ProxyValServer extends ValServer {
|
|
2800
2799
|
}
|
2801
2800
|
async session(cookies) {
|
2802
2801
|
return withAuth(this.options.valSecret, cookies, "session", async data => {
|
2803
|
-
const url = new URL(`/api/val/${this.options.
|
2802
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/session`, this.options.valBuildUrl);
|
2804
2803
|
const fetchRes = await fetch(url, {
|
2805
2804
|
headers: getAuthHeaders(data.token, "application/json")
|
2806
2805
|
});
|
@@ -2825,7 +2824,7 @@ class ProxyValServer extends ValServer {
|
|
2825
2824
|
});
|
2826
2825
|
}
|
2827
2826
|
async consumeCode(code) {
|
2828
|
-
const url = new URL(`/api/val/${this.options.
|
2827
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/token`, this.options.valBuildUrl);
|
2829
2828
|
url.searchParams.set("code", encodeURIComponent(code));
|
2830
2829
|
return fetch(url, {
|
2831
2830
|
method: "POST",
|
@@ -2851,13 +2850,13 @@ class ProxyValServer extends ValServer {
|
|
2851
2850
|
});
|
2852
2851
|
}
|
2853
2852
|
getAuthorizeUrl(publicValApiRoute, token) {
|
2854
|
-
const url = new URL(`/auth/${this.options.
|
2853
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2855
2854
|
url.searchParams.set("redirect_uri", encodeURIComponent(`${publicValApiRoute}/callback`));
|
2856
2855
|
url.searchParams.set("state", token);
|
2857
2856
|
return url.toString();
|
2858
2857
|
}
|
2859
2858
|
getAppErrorUrl(error) {
|
2860
|
-
const url = new URL(`/auth/${this.options.
|
2859
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2861
2860
|
url.searchParams.set("error", encodeURIComponent(error));
|
2862
2861
|
return url.toString();
|
2863
2862
|
}
|
@@ -2872,7 +2871,7 @@ class ProxyValServer extends ValServer {
|
|
2872
2871
|
token
|
2873
2872
|
}) => {
|
2874
2873
|
const patchIds = query.id || [];
|
2875
|
-
const url = new URL(`/v1/patches/${this.options.
|
2874
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~`, this.options.valContentUrl);
|
2876
2875
|
const fetchRes = await fetch(url, {
|
2877
2876
|
method: "DELETE",
|
2878
2877
|
headers: getAuthHeaders(token, "application/json"),
|
@@ -2905,7 +2904,7 @@ class ProxyValServer extends ValServer {
|
|
2905
2904
|
}
|
2906
2905
|
const patchIds = query.id || [];
|
2907
2906
|
const params = patchIds.length > 0 ? `commit=${encodeURIComponent(commit)}&${patchIds.map(id => `id=${encodeURIComponent(id)}`).join("&")}` : `commit=${encodeURIComponent(commit)}`;
|
2908
|
-
const url = new URL(`/v1/patches/${this.options.
|
2907
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2909
2908
|
// Proxy patch to val.build
|
2910
2909
|
const fetchRes = await fetch(url, {
|
2911
2910
|
method: "GET",
|
@@ -2949,7 +2948,7 @@ class ProxyValServer extends ValServer {
|
|
2949
2948
|
};
|
2950
2949
|
}
|
2951
2950
|
const patches = parsedPatches.data;
|
2952
|
-
const url = new URL(`/v1/patches/${this.options.
|
2951
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2953
2952
|
// Proxy patch to val.build
|
2954
2953
|
const fetchRes = await fetch(url, {
|
2955
2954
|
method: "POST",
|
@@ -2968,7 +2967,7 @@ class ProxyValServer extends ValServer {
|
|
2968
2967
|
}
|
2969
2968
|
async getFiles(filePath, query, cookies) {
|
2970
2969
|
return withAuth(this.options.valSecret, cookies, "getFiles", async data => {
|
2971
|
-
const url = new URL(`/v1/files/${this.options.
|
2970
|
+
const url = new URL(`/v1/files/${this.options.remote}${filePath}`, this.options.valContentUrl);
|
2972
2971
|
if (typeof query.sha256 === "string") {
|
2973
2972
|
url.searchParams.append("sha256", query.sha256);
|
2974
2973
|
} else {
|
@@ -3253,9 +3252,9 @@ async function initHandlerOptions(route, opts) {
|
|
3253
3252
|
if (!maybeGitBranch) {
|
3254
3253
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
3255
3254
|
}
|
3256
|
-
const
|
3257
|
-
if (!
|
3258
|
-
throw new Error("
|
3255
|
+
const maybeValRemote = opts.remote || process.env.VAL_REMOTE;
|
3256
|
+
if (!maybeValRemote) {
|
3257
|
+
throw new Error("Proxy mode does not work unless the 'remote' option in val.config is defined or the VAL_REMOTE env var is set.");
|
3259
3258
|
}
|
3260
3259
|
return {
|
3261
3260
|
mode: "proxy",
|
@@ -3268,7 +3267,7 @@ async function initHandlerOptions(route, opts) {
|
|
3268
3267
|
commit: maybeGitCommit,
|
3269
3268
|
branch: maybeGitBranch
|
3270
3269
|
},
|
3271
|
-
|
3270
|
+
remote: maybeValRemote,
|
3272
3271
|
valEnableRedirectUrl: opts.valEnableRedirectUrl || process.env.VAL_ENABLE_REDIRECT_URL,
|
3273
3272
|
valDisableRedirectUrl: opts.valDisableRedirectUrl || process.env.VAL_DISABLE_REDIRECT_URL
|
3274
3273
|
};
|
@@ -2529,7 +2529,7 @@ class ProxyValServer extends ValServer {
|
|
2529
2529
|
};
|
2530
2530
|
}
|
2531
2531
|
const params = `commit=${encodeURIComponent(commit)}&root=${encodeURIComponent(this.apiOptions.root || "/")}&cwd=${encodeURIComponent(this.cwd)}`;
|
2532
|
-
const url = new URL(`/v1/commit/${this.options.
|
2532
|
+
const url = new URL(`/v1/commit/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2533
2533
|
|
2534
2534
|
// Creates a fresh copy of the fs. We cannot touch the existing fs, since there might be parallel operations?
|
2535
2535
|
// We could perhaps free up the other fs while doing this operation, but uncertain if we can actually do that and if that would actually help on memory.
|
@@ -2584,13 +2584,11 @@ class ProxyValServer extends ValServer {
|
|
2584
2584
|
async initRemoteFS(commit, remoteFS, token) {
|
2585
2585
|
const params = new URLSearchParams(this.apiOptions.root ? {
|
2586
2586
|
root: this.apiOptions.root,
|
2587
|
-
commit
|
2588
|
-
cwd: this.cwd
|
2587
|
+
commit
|
2589
2588
|
} : {
|
2590
|
-
commit
|
2591
|
-
cwd: this.cwd
|
2589
|
+
commit
|
2592
2590
|
});
|
2593
|
-
const url = new URL(`/v1/fs/${this.options.
|
2591
|
+
const url = new URL(`/v1/fs/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2594
2592
|
try {
|
2595
2593
|
const fetchRes = await fetch(url, {
|
2596
2594
|
headers: getAuthHeaders(token, "application/json")
|
@@ -2627,7 +2625,8 @@ class ProxyValServer extends ValServer {
|
|
2627
2625
|
}
|
2628
2626
|
};
|
2629
2627
|
}
|
2630
|
-
remoteFS.initializeWith(json.directories)
|
2628
|
+
remoteFS.initializeWith(Object.fromEntries(Object.entries(json.directories).map(([dir, content]) => [path__default.join(this.cwd, ...dir.split("/") // content is always posix - not sure that matters...
|
2629
|
+
), content])));
|
2631
2630
|
return {
|
2632
2631
|
status: 200
|
2633
2632
|
};
|
@@ -2769,7 +2768,7 @@ class ProxyValServer extends ValServer {
|
|
2769
2768
|
}
|
2770
2769
|
async session(cookies) {
|
2771
2770
|
return withAuth(this.options.valSecret, cookies, "session", async data => {
|
2772
|
-
const url = new URL(`/api/val/${this.options.
|
2771
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/session`, this.options.valBuildUrl);
|
2773
2772
|
const fetchRes = await fetch(url, {
|
2774
2773
|
headers: getAuthHeaders(data.token, "application/json")
|
2775
2774
|
});
|
@@ -2794,7 +2793,7 @@ class ProxyValServer extends ValServer {
|
|
2794
2793
|
});
|
2795
2794
|
}
|
2796
2795
|
async consumeCode(code) {
|
2797
|
-
const url = new URL(`/api/val/${this.options.
|
2796
|
+
const url = new URL(`/api/val/${this.options.remote}/auth/token`, this.options.valBuildUrl);
|
2798
2797
|
url.searchParams.set("code", encodeURIComponent(code));
|
2799
2798
|
return fetch(url, {
|
2800
2799
|
method: "POST",
|
@@ -2820,13 +2819,13 @@ class ProxyValServer extends ValServer {
|
|
2820
2819
|
});
|
2821
2820
|
}
|
2822
2821
|
getAuthorizeUrl(publicValApiRoute, token) {
|
2823
|
-
const url = new URL(`/auth/${this.options.
|
2822
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2824
2823
|
url.searchParams.set("redirect_uri", encodeURIComponent(`${publicValApiRoute}/callback`));
|
2825
2824
|
url.searchParams.set("state", token);
|
2826
2825
|
return url.toString();
|
2827
2826
|
}
|
2828
2827
|
getAppErrorUrl(error) {
|
2829
|
-
const url = new URL(`/auth/${this.options.
|
2828
|
+
const url = new URL(`/auth/${this.options.remote}/authorize`, this.options.valBuildUrl);
|
2830
2829
|
url.searchParams.set("error", encodeURIComponent(error));
|
2831
2830
|
return url.toString();
|
2832
2831
|
}
|
@@ -2841,7 +2840,7 @@ class ProxyValServer extends ValServer {
|
|
2841
2840
|
token
|
2842
2841
|
}) => {
|
2843
2842
|
const patchIds = query.id || [];
|
2844
|
-
const url = new URL(`/v1/patches/${this.options.
|
2843
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~`, this.options.valContentUrl);
|
2845
2844
|
const fetchRes = await fetch(url, {
|
2846
2845
|
method: "DELETE",
|
2847
2846
|
headers: getAuthHeaders(token, "application/json"),
|
@@ -2874,7 +2873,7 @@ class ProxyValServer extends ValServer {
|
|
2874
2873
|
}
|
2875
2874
|
const patchIds = query.id || [];
|
2876
2875
|
const params = patchIds.length > 0 ? `commit=${encodeURIComponent(commit)}&${patchIds.map(id => `id=${encodeURIComponent(id)}`).join("&")}` : `commit=${encodeURIComponent(commit)}`;
|
2877
|
-
const url = new URL(`/v1/patches/${this.options.
|
2876
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2878
2877
|
// Proxy patch to val.build
|
2879
2878
|
const fetchRes = await fetch(url, {
|
2880
2879
|
method: "GET",
|
@@ -2918,7 +2917,7 @@ class ProxyValServer extends ValServer {
|
|
2918
2917
|
};
|
2919
2918
|
}
|
2920
2919
|
const patches = parsedPatches.data;
|
2921
|
-
const url = new URL(`/v1/patches/${this.options.
|
2920
|
+
const url = new URL(`/v1/patches/${this.options.remote}/heads/${this.options.git.branch}/~?${params}`, this.options.valContentUrl);
|
2922
2921
|
// Proxy patch to val.build
|
2923
2922
|
const fetchRes = await fetch(url, {
|
2924
2923
|
method: "POST",
|
@@ -2937,7 +2936,7 @@ class ProxyValServer extends ValServer {
|
|
2937
2936
|
}
|
2938
2937
|
async getFiles(filePath, query, cookies) {
|
2939
2938
|
return withAuth(this.options.valSecret, cookies, "getFiles", async data => {
|
2940
|
-
const url = new URL(`/v1/files/${this.options.
|
2939
|
+
const url = new URL(`/v1/files/${this.options.remote}${filePath}`, this.options.valContentUrl);
|
2941
2940
|
if (typeof query.sha256 === "string") {
|
2942
2941
|
url.searchParams.append("sha256", query.sha256);
|
2943
2942
|
} else {
|
@@ -3222,9 +3221,9 @@ async function initHandlerOptions(route, opts) {
|
|
3222
3221
|
if (!maybeGitBranch) {
|
3223
3222
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
3224
3223
|
}
|
3225
|
-
const
|
3226
|
-
if (!
|
3227
|
-
throw new Error("
|
3224
|
+
const maybeValRemote = opts.remote || process.env.VAL_REMOTE;
|
3225
|
+
if (!maybeValRemote) {
|
3226
|
+
throw new Error("Proxy mode does not work unless the 'remote' option in val.config is defined or the VAL_REMOTE env var is set.");
|
3228
3227
|
}
|
3229
3228
|
return {
|
3230
3229
|
mode: "proxy",
|
@@ -3237,7 +3236,7 @@ async function initHandlerOptions(route, opts) {
|
|
3237
3236
|
commit: maybeGitCommit,
|
3238
3237
|
branch: maybeGitBranch
|
3239
3238
|
},
|
3240
|
-
|
3239
|
+
remote: maybeValRemote,
|
3241
3240
|
valEnableRedirectUrl: opts.valEnableRedirectUrl || process.env.VAL_ENABLE_REDIRECT_URL,
|
3242
3241
|
valDisableRedirectUrl: opts.valDisableRedirectUrl || process.env.VAL_DISABLE_REDIRECT_URL
|
3243
3242
|
};
|
package/package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"./package.json": "./package.json"
|
13
13
|
},
|
14
14
|
"types": "dist/valbuild-server.cjs.d.ts",
|
15
|
-
"version": "0.60.
|
15
|
+
"version": "0.60.13",
|
16
16
|
"scripts": {
|
17
17
|
"typecheck": "tsc --noEmit",
|
18
18
|
"test": "jest",
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"concurrently": "^7.6.0"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@valbuild/core": "~0.60.
|
28
|
-
"@valbuild/shared": "~0.60.
|
29
|
-
"@valbuild/ui": "~0.60.
|
27
|
+
"@valbuild/core": "~0.60.13",
|
28
|
+
"@valbuild/shared": "~0.60.13",
|
29
|
+
"@valbuild/ui": "~0.60.13",
|
30
30
|
"express": "^4.18.2",
|
31
31
|
"image-size": "^1.0.2",
|
32
32
|
"minimatch": "^3.0.4",
|