@valbuild/server 0.148.1 → 0.148.3
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/CHANGELOG.md +40 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +1 -1
- package/browser/dist/valbuild-server-browser.cjs.prod.js +1 -1
- package/browser/dist/valbuild-server-browser.esm.js +1 -1
- package/dist/{ValRouterCore-7ca3dc68.esm.js → ValRouterCore-2579e663.esm.js} +79 -35
- package/dist/{ValRouterCore-42772c21.cjs.prod.js → ValRouterCore-dfb7b578.cjs.prod.js} +78 -34
- package/dist/{ValRouterCore-9bdaaf89.cjs.dev.js → ValRouterCore-fec2cbca.cjs.dev.js} +78 -34
- package/dist/{getJsonEntryAtCommit-40b6d9c1.esm.js → getJsonEntryAtCommit-66544899.esm.js} +1 -1
- package/dist/{getJsonEntryAtCommit-2e36e805.cjs.prod.js → getJsonEntryAtCommit-6bbe1c9d.cjs.prod.js} +1 -1
- package/dist/{getJsonEntryAtCommit-64f67a50.cjs.dev.js → getJsonEntryAtCommit-80bf8f02.cjs.dev.js} +1 -1
- package/dist/valbuild-server.cjs.dev.js +32 -32
- package/dist/valbuild-server.cjs.prod.js +32 -32
- package/dist/valbuild-server.esm.js +33 -33
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.148.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#881](https://github.com/valbuild/val/pull/881) [`0139436`](https://github.com/valbuild/val/commit/0139436426142d91cbb29ec6c696dfb86f34ab9d) Thanks [@freekh](https://github.com/freekh)! - The content analytics script. With analytics on (it is off by default, and turned on in a hosted project's settings), a TanStack site counts which content each visitor's page **rendered** and which they actually **viewed** (at least half on screen for a second), and sends it to `/api/val/analytics`.
|
|
8
|
+
|
|
9
|
+
- No cookies, no storage, no visitor IDs. Each page view also says where it came from (the referring site's host and any `utm_source` / `utm_medium` / `utm_campaign`) and whether it was a phone, tablet or desktop.
|
|
10
|
+
- A page is sent as its route's pattern (`/posts/$postId`), never its address, so a path that holds something about one visitor (an order number, a token) is never stored. `startValAnalytics` takes this as `routeFor`; `ValProvider` passes TanStack's matched route.
|
|
11
|
+
- Editors are never counted: nothing is sent in draft mode, in the Studio, with Val enabled, or at a proposal's address, and nothing from automated browsers. A page the browser prerenders counts nothing until it is shown.
|
|
12
|
+
- The script is the new `@valbuild/react/analytics` entry, loaded only for visitors of a site with analytics on, after the page has hydrated. It imports nothing else from Val.
|
|
13
|
+
- Storing the counts and showing them is part of Val's hosting, which takes these beacons before they reach the site. Anywhere else, `/api/val/analytics` checks each beacon and stores nothing; in local development, with `VAL_DEBUG=1`, it logs a line per beacon, so you can see it working.
|
|
14
|
+
- `ValProvider`'s Studio check now matches `/val` and what is below it only, not every route starting with those letters (`/values`). The same fix is in `@valbuild/next`.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`0139436`](https://github.com/valbuild/val/commit/0139436426142d91cbb29ec6c696dfb86f34ab9d), [`5eff8a0`](https://github.com/valbuild/val/commit/5eff8a055a4ef50d476797c28f9c3e50deb73c89)]:
|
|
17
|
+
- @valbuild/shared@0.148.3
|
|
18
|
+
- @valbuild/ui@0.148.3
|
|
19
|
+
|
|
20
|
+
## 0.148.2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#889](https://github.com/valbuild/val/pull/889) [`dc7c8cc`](https://github.com/valbuild/val/commit/dc7c8ccd82f643e662d00225fabec411b5d39e3a) Thanks [@freekh](https://github.com/freekh)! - Val is quieter in your app's console. Errors and warnings you can act on still
|
|
25
|
+
print, now prefixed with `[val]` so you can filter them. Val's own debug
|
|
26
|
+
output, which used to reach your terminal and browser console, is now off by
|
|
27
|
+
default. That includes the `Invalid JWT` line that printed on every request
|
|
28
|
+
with an expired session cookie, the "verifying draft mode" and polling notices,
|
|
29
|
+
and the Studio's sync and WebSocket chatter.
|
|
30
|
+
|
|
31
|
+
To turn the debug output back on, for example when reporting a bug:
|
|
32
|
+
|
|
33
|
+
- on the server, set `VAL_DEBUG=1`
|
|
34
|
+
- in the browser, run `localStorage.setItem("val:debug", "1")` in the console.
|
|
35
|
+
It takes effect immediately, with no reload. Remove the key to turn it off
|
|
36
|
+
again.
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`dc7c8cc`](https://github.com/valbuild/val/commit/dc7c8ccd82f643e662d00225fabec411b5d39e3a)]:
|
|
39
|
+
- @valbuild/core@0.148.2
|
|
40
|
+
- @valbuild/shared@0.148.2
|
|
41
|
+
- @valbuild/ui@0.148.2
|
|
42
|
+
|
|
3
43
|
## 0.148.1
|
|
4
44
|
|
|
5
45
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@valbuild/core');
|
|
6
|
-
var ValRouterCore = require('../../dist/ValRouterCore-
|
|
6
|
+
var ValRouterCore = require('../../dist/ValRouterCore-fec2cbca.cjs.dev.js');
|
|
7
7
|
require('@valbuild/shared/internal');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('zod-validation-error');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@valbuild/core');
|
|
6
|
-
var ValRouterCore = require('../../dist/ValRouterCore-
|
|
6
|
+
var ValRouterCore = require('../../dist/ValRouterCore-dfb7b578.cjs.prod.js');
|
|
7
7
|
require('@valbuild/shared/internal');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('zod-validation-error');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CONTENT_HOST } from '@valbuild/core';
|
|
2
|
-
import { j as ValOpsMemory, E as bytesToBase64, y as ValServer, z as createValRequestHandler } from '../../dist/ValRouterCore-
|
|
2
|
+
import { j as ValOpsMemory, E as bytesToBase64, y as ValServer, z as createValRequestHandler } from '../../dist/ValRouterCore-2579e663.esm.js';
|
|
3
3
|
import '@valbuild/shared/internal';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'zod-validation-error';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Internal, VAL_EXTENSION, extractValModules, computeValModuleShas, ImageSchema, DEFAULT_CONTENT_HOST, hasRemoteFileSchema } from '@valbuild/core';
|
|
2
|
-
import { isSchemaSourceFixError, resolveSchemaSourceFixForError, SerializedSchema, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, newestCommitSha, parseJob, VAL_STUDIO_HEADER, getErrorMessageFromUnknownJson, Api } from '@valbuild/shared/internal';
|
|
2
|
+
import { isSchemaSourceFixError, resolveSchemaSourceFixForError, SerializedSchema, AnalyticsBeacon, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, newestCommitSha, parseJob, VAL_STUDIO_HEADER, getErrorMessageFromUnknownJson, Api } from '@valbuild/shared/internal';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { fromError } from 'zod-validation-error';
|
|
5
5
|
import { result, array } from '@valbuild/core/fp';
|
|
@@ -1457,7 +1457,7 @@ encode = bytesToBase64) {
|
|
|
1457
1457
|
}]) => {
|
|
1458
1458
|
if (remote) return;
|
|
1459
1459
|
const bytes = await ops.getBase64EncodedBinaryFileFromPatch(filePath, patchId, remote).catch(error => {
|
|
1460
|
-
|
|
1460
|
+
Internal.log.error("Could not read a committed file", filePath, error);
|
|
1461
1461
|
return null;
|
|
1462
1462
|
});
|
|
1463
1463
|
if (bytes === null) unread.push(filePath);else files[filePath] = encode(bytes);
|
|
@@ -2425,7 +2425,7 @@ class ValOps {
|
|
|
2425
2425
|
for (const [moduleFilePathS, source] of Object.entries(sources)) {
|
|
2426
2426
|
const moduleFilePath = moduleFilePathS;
|
|
2427
2427
|
if (errors[moduleFilePath] !== undefined) {
|
|
2428
|
-
|
|
2428
|
+
Internal.log.error("not adopting the committed source of a module whose patches " + "did not apply cleanly. Its content here stays as it was until the " + "modules are re-evaluated.", {
|
|
2429
2429
|
moduleFilePath,
|
|
2430
2430
|
errors: errors[moduleFilePath]
|
|
2431
2431
|
});
|
|
@@ -2975,7 +2975,7 @@ class ValOps {
|
|
|
2975
2975
|
if (!errors[path]) {
|
|
2976
2976
|
errors[path] = [];
|
|
2977
2977
|
}
|
|
2978
|
-
|
|
2978
|
+
Internal.log.error("Module not found", path);
|
|
2979
2979
|
errors[path].push({
|
|
2980
2980
|
patchId: patchData.patchId,
|
|
2981
2981
|
skipped: true,
|
|
@@ -2988,7 +2988,7 @@ class ValOps {
|
|
|
2988
2988
|
}
|
|
2989
2989
|
const patchId = patchData.patchId;
|
|
2990
2990
|
if (errors[path]) {
|
|
2991
|
-
|
|
2991
|
+
Internal.log.error("Cannot apply patch: previous errors exists", path, errors[path]);
|
|
2992
2992
|
errors[path].push({
|
|
2993
2993
|
patchId: patchId,
|
|
2994
2994
|
skipped: true,
|
|
@@ -3152,7 +3152,7 @@ class ValOps {
|
|
|
3152
3152
|
// applyPatch mutates the source. On add operations it adds more than once? There is something strange going on... deepClone seems to fix, but is that the right solution?
|
|
3153
3153
|
jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
|
|
3154
3154
|
if (result.isErr(patchRes)) {
|
|
3155
|
-
|
|
3155
|
+
Internal.log.error("Could not apply patch", JSON.stringify({
|
|
3156
3156
|
path,
|
|
3157
3157
|
patchId,
|
|
3158
3158
|
error: patchRes.error,
|
|
@@ -3799,7 +3799,7 @@ class ValOps {
|
|
|
3799
3799
|
return result.ok(entries);
|
|
3800
3800
|
};
|
|
3801
3801
|
const collectPatchError = (err, patchId, op) => {
|
|
3802
|
-
|
|
3802
|
+
Internal.log.error("Could not patch", JSON.stringify({
|
|
3803
3803
|
path,
|
|
3804
3804
|
patchId,
|
|
3805
3805
|
error: err,
|
|
@@ -4328,7 +4328,7 @@ class ValOps {
|
|
|
4328
4328
|
// sends it again later, so an error line here would be one a minute.
|
|
4329
4329
|
return result.err(saveRes.error);
|
|
4330
4330
|
}
|
|
4331
|
-
|
|
4331
|
+
Internal.log.error(`Could not save source patch at path: '${path}'. Error: ${saveRes.error.errorType === "other" ? saveRes.error.message : saveRes.error.errorType}`);
|
|
4332
4332
|
if (saveRes.error.errorType === "patch-head-conflict") {
|
|
4333
4333
|
return result.err({
|
|
4334
4334
|
errorType: "patch-head-conflict"
|
|
@@ -5568,11 +5568,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5568
5568
|
token
|
|
5569
5569
|
};
|
|
5570
5570
|
} else {
|
|
5571
|
-
|
|
5571
|
+
Internal.log.debug("Failed to get data from code: ", res.status);
|
|
5572
5572
|
return null;
|
|
5573
5573
|
}
|
|
5574
5574
|
}).catch(err => {
|
|
5575
|
-
|
|
5575
|
+
Internal.log.debug("Failed to get user from code: ", err);
|
|
5576
5576
|
return null;
|
|
5577
5577
|
});
|
|
5578
5578
|
};
|
|
@@ -6005,6 +6005,50 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6005
6005
|
};
|
|
6006
6006
|
}
|
|
6007
6007
|
},
|
|
6008
|
+
/**
|
|
6009
|
+
* Content analytics beacons, outside the hosted platform.
|
|
6010
|
+
*
|
|
6011
|
+
* On a site Val hosts, the platform's loader answers this route before a
|
|
6012
|
+
* request reaches the app, and counts. Everywhere else nothing counts yet:
|
|
6013
|
+
* this checks the beacon and answers, so a site with analytics on does not
|
|
6014
|
+
* fill its visitors' consoles with 404s. In local dev it also logs a line
|
|
6015
|
+
* per beacon, which is how the showcase shows analytics working.
|
|
6016
|
+
*/
|
|
6017
|
+
"/analytics": {
|
|
6018
|
+
POST: async req => {
|
|
6019
|
+
const parsed = AnalyticsBeacon.safeParse(req.body);
|
|
6020
|
+
if (!parsed.success) {
|
|
6021
|
+
const body = req.body;
|
|
6022
|
+
const version = typeof body === "object" && body !== null && "v" in body ? body.v : undefined;
|
|
6023
|
+
if (typeof version === "number" && version !== 1) {
|
|
6024
|
+
// A newer format than this server knows: not an error.
|
|
6025
|
+
return {
|
|
6026
|
+
status: 200,
|
|
6027
|
+
json: {
|
|
6028
|
+
counted: false
|
|
6029
|
+
}
|
|
6030
|
+
};
|
|
6031
|
+
}
|
|
6032
|
+
return {
|
|
6033
|
+
status: 400,
|
|
6034
|
+
json: {
|
|
6035
|
+
message: "Not a valid Val analytics beacon"
|
|
6036
|
+
}
|
|
6037
|
+
};
|
|
6038
|
+
}
|
|
6039
|
+
if (options.mode === "fs") {
|
|
6040
|
+
const beacon = parsed.data;
|
|
6041
|
+
const count = paths => Object.values(paths).reduce((n, list) => n + list.length, 0);
|
|
6042
|
+
Internal.log.debug(`analytics: ${beacon.route}${beacon.view ? " (page view)" : ""}: ${count(beacon.rendered)} rendered, ${count(beacon.viewed)} viewed`);
|
|
6043
|
+
}
|
|
6044
|
+
return {
|
|
6045
|
+
status: 200,
|
|
6046
|
+
json: {
|
|
6047
|
+
counted: false
|
|
6048
|
+
}
|
|
6049
|
+
};
|
|
6050
|
+
}
|
|
6051
|
+
},
|
|
6008
6052
|
"/draft/stat": {
|
|
6009
6053
|
GET: async req => {
|
|
6010
6054
|
const cookies = req.cookies;
|
|
@@ -6292,7 +6336,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6292
6336
|
// the environment when @valbuild/server was built. See getSettings.
|
|
6293
6337
|
const settingsRes = await getSettings(options.project, remoteFileAuth, options.valContentUrl);
|
|
6294
6338
|
if (!settingsRes.success) {
|
|
6295
|
-
|
|
6339
|
+
Internal.log.warn("Could not get remote files settings: " + settingsRes.message);
|
|
6296
6340
|
return {
|
|
6297
6341
|
status: 400,
|
|
6298
6342
|
json: {
|
|
@@ -6737,7 +6781,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6737
6781
|
let contentBaseUrl = null;
|
|
6738
6782
|
let contentAuthNonce = null;
|
|
6739
6783
|
if (!options.project) {
|
|
6740
|
-
|
|
6784
|
+
Internal.log.debug("Direct content-host uploads (AI images) disabled: no `project` set in val.config (and VAL_PROJECT env var is not set).");
|
|
6741
6785
|
} else if (!isFsOps(serverOps)) {
|
|
6742
6786
|
/*
|
|
6743
6787
|
* Presigning needs a content host to presign AGAINST, and a local
|
|
@@ -6750,11 +6794,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6750
6794
|
* the patch upload base url -- still works, and the only thing lost
|
|
6751
6795
|
* is the browser posting AI images straight to the content host.
|
|
6752
6796
|
*/
|
|
6753
|
-
|
|
6797
|
+
Internal.log.debug("Direct content-host uploads (AI images) disabled: this store has no content host to presign against.");
|
|
6754
6798
|
} else {
|
|
6755
6799
|
const authDataRes = await getRemoteFileAuth();
|
|
6756
6800
|
if (authDataRes.status !== 200) {
|
|
6757
|
-
|
|
6801
|
+
Internal.log.warn("Direct content-host uploads (AI images) disabled: " + authDataRes.json.message);
|
|
6758
6802
|
} else {
|
|
6759
6803
|
const corsOrigin = "*"; // TODO: add cors origin
|
|
6760
6804
|
const presignedAuthNonce = await serverOps.getPresignedAuthNonce(options.project, corsOrigin, authDataRes.json.remoteFileAuth);
|
|
@@ -6762,7 +6806,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6762
6806
|
contentBaseUrl = presignedAuthNonce.data.baseUrl;
|
|
6763
6807
|
contentAuthNonce = presignedAuthNonce.data.nonce;
|
|
6764
6808
|
} else {
|
|
6765
|
-
|
|
6809
|
+
Internal.log.warn("Direct content-host uploads (AI images) disabled: " + presignedAuthNonce.error.message);
|
|
6766
6810
|
}
|
|
6767
6811
|
}
|
|
6768
6812
|
}
|
|
@@ -6937,7 +6981,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6937
6981
|
});
|
|
6938
6982
|
if (fetchedPatchesRes.error) {
|
|
6939
6983
|
// Error is singular
|
|
6940
|
-
|
|
6984
|
+
Internal.log.error("Failed to get patches", fetchedPatchesRes.error);
|
|
6941
6985
|
return {
|
|
6942
6986
|
status: 500,
|
|
6943
6987
|
json: {
|
|
@@ -6948,7 +6992,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6948
6992
|
}
|
|
6949
6993
|
if (fetchedPatchesRes.errors && Object.keys(fetchedPatchesRes.errors).length > 0) {
|
|
6950
6994
|
// Errors is plural. Different property than above.
|
|
6951
|
-
|
|
6995
|
+
Internal.log.error("Failed to get patches", fetchedPatchesRes.errors);
|
|
6952
6996
|
return {
|
|
6953
6997
|
status: 500,
|
|
6954
6998
|
json: {
|
|
@@ -6999,7 +7043,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6999
7043
|
const ids = query.id;
|
|
7000
7044
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
7001
7045
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
7002
|
-
|
|
7046
|
+
Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
7003
7047
|
return {
|
|
7004
7048
|
status: 500,
|
|
7005
7049
|
json: {
|
|
@@ -7058,7 +7102,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7058
7102
|
}
|
|
7059
7103
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7060
7104
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7061
|
-
|
|
7105
|
+
Internal.log.error("Module errors", moduleErrors);
|
|
7062
7106
|
return {
|
|
7063
7107
|
status: 500,
|
|
7064
7108
|
json: {
|
|
@@ -7076,7 +7120,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7076
7120
|
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
|
7077
7121
|
}
|
|
7078
7122
|
} catch (e) {
|
|
7079
|
-
|
|
7123
|
+
Internal.log.error("Failed to serialize schemas", e);
|
|
7080
7124
|
return {
|
|
7081
7125
|
status: 500,
|
|
7082
7126
|
json: {
|
|
@@ -7262,7 +7306,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7262
7306
|
const sourcesSha = await serverOps.getSourcesSha();
|
|
7263
7307
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7264
7308
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7265
|
-
|
|
7309
|
+
Internal.log.error("Module errors", moduleErrors);
|
|
7266
7310
|
return {
|
|
7267
7311
|
status: 500,
|
|
7268
7312
|
json: {
|
|
@@ -7971,11 +8015,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7971
8015
|
...serverOps.analyzePatches(survivors, patches.commits, commit),
|
|
7972
8016
|
...survivingPatches
|
|
7973
8017
|
});
|
|
7974
|
-
|
|
8018
|
+
Internal.log.error("removed unpublished changes that could not be applied", removed);
|
|
7975
8019
|
}
|
|
7976
8020
|
}
|
|
7977
8021
|
if (preparedCommit.hasErrors) {
|
|
7978
|
-
|
|
8022
|
+
Internal.log.error("Failed to create commit", JSON.stringify({
|
|
7979
8023
|
sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
|
|
7980
8024
|
binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
|
|
7981
8025
|
}, null, 2));
|
|
@@ -8033,7 +8077,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8033
8077
|
}
|
|
8034
8078
|
const uploadRes = await serverOps.uploadRemoteFiles(preparedCommit, authRes.json.remoteFileAuth);
|
|
8035
8079
|
if (Object.keys(uploadRes.errors).length > 0) {
|
|
8036
|
-
|
|
8080
|
+
Internal.log.error("Failed to upload remote files", uploadRes.errors);
|
|
8037
8081
|
return {
|
|
8038
8082
|
status: 400,
|
|
8039
8083
|
json: {
|
|
@@ -8065,7 +8109,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8065
8109
|
const remoteFileAuth = (_remoteFileAuthRes = remoteFileAuthRes) === null || _remoteFileAuthRes === void 0 || (_remoteFileAuthRes = _remoteFileAuthRes.json) === null || _remoteFileAuthRes === void 0 ? void 0 : _remoteFileAuthRes.remoteFileAuth;
|
|
8066
8110
|
const saveRes = await serverOps.saveOrUploadFiles(preparedCommit, mode, remoteFileAuth);
|
|
8067
8111
|
if (Object.keys(saveRes.errors).length > 0) {
|
|
8068
|
-
|
|
8112
|
+
Internal.log.error("Failed to save files", saveRes.errors);
|
|
8069
8113
|
return {
|
|
8070
8114
|
status: 400,
|
|
8071
8115
|
json: {
|
|
@@ -8124,13 +8168,13 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8124
8168
|
*/
|
|
8125
8169
|
const deleteRes = await serverOps.deletePatches(consumed);
|
|
8126
8170
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8127
|
-
|
|
8171
|
+
Internal.log.error(`got an error while cleaning up patches after publish: ${deleteRes.error.message}`);
|
|
8128
8172
|
} else if ("errors" in deleteRes && deleteRes.errors !== undefined) {
|
|
8129
8173
|
// Per patch, and not fatal: the files are written, so the save
|
|
8130
8174
|
// succeeded. A patch left behind is announced again on the next
|
|
8131
8175
|
// stat, applies to a base that already contains it, and is removed
|
|
8132
8176
|
// then.
|
|
8133
|
-
|
|
8177
|
+
Internal.log.error("could not clean up some patches after publish", deleteRes.errors);
|
|
8134
8178
|
}
|
|
8135
8179
|
return {
|
|
8136
8180
|
status: 200,
|
|
@@ -8163,7 +8207,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8163
8207
|
commitToGit
|
|
8164
8208
|
}) : await commitToGit();
|
|
8165
8209
|
if (commitRes.error) {
|
|
8166
|
-
|
|
8210
|
+
Internal.log.error("Failed to commit", commitRes.error);
|
|
8167
8211
|
if ("isNotFastForward" in commitRes && commitRes.isNotFastForward) {
|
|
8168
8212
|
return {
|
|
8169
8213
|
status: 409,
|
|
@@ -9052,7 +9096,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9052
9096
|
// TypeScript compiler. See `patch/ts/publishKit.ts`.
|
|
9053
9097
|
const {
|
|
9054
9098
|
getJsonEntryAtCommit
|
|
9055
|
-
} = await import('./getJsonEntryAtCommit-
|
|
9099
|
+
} = await import('./getJsonEntryAtCommit-66544899.esm.js');
|
|
9056
9100
|
const res = await getJsonEntryAtCommit(serverOps, req.query.commit_sha, req.query.path, req.query.key);
|
|
9057
9101
|
if (result.isErr(res)) {
|
|
9058
9102
|
return historyErrorResponse(res.error);
|
|
@@ -9141,7 +9185,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9141
9185
|
const remote = query.remote === "true";
|
|
9142
9186
|
const patchId = query.patch_id;
|
|
9143
9187
|
if (!patchId && isHttpOps(serverOps) && remote) {
|
|
9144
|
-
|
|
9188
|
+
Internal.log.error(`Remote file: ${filePath} requested without patch id. This is most likely a bug in Val.`);
|
|
9145
9189
|
}
|
|
9146
9190
|
// Opened, not read: a video is seeked in by many small ranges, and
|
|
9147
9191
|
// only the asked-for bytes are read where the mode can (fs).
|
|
@@ -9373,7 +9417,7 @@ async function withAuth(verifyJwt, secret, cookies, errorMessageType, handler) {
|
|
|
9373
9417
|
};
|
|
9374
9418
|
}
|
|
9375
9419
|
return handler(verification.data).catch(err => {
|
|
9376
|
-
|
|
9420
|
+
Internal.log.error(`Failed while processing: ${errorMessageType}`, err);
|
|
9377
9421
|
return {
|
|
9378
9422
|
status: 500,
|
|
9379
9423
|
json: {
|
|
@@ -9942,7 +9986,7 @@ class ValOpsMemory extends ValOps {
|
|
|
9942
9986
|
this.contentUrl = options.contentUrl;
|
|
9943
9987
|
this.requiresAuth = !options.unsafelyAllowUnauthenticated;
|
|
9944
9988
|
if (options.unsafelyAllowUnauthenticated && options.warnUnauthenticated !== false) {
|
|
9945
|
-
|
|
9989
|
+
Internal.log.warn("serving memory mode WITHOUT authentication. Every request that " + "reaches this server may read content, create patches and trigger a " + "publish. Only correct if the host authorises requests before they " + "get here.");
|
|
9946
9990
|
}
|
|
9947
9991
|
this.sourceFiles = Object.fromEntries(Object.entries(options.sourceFiles).map(([path, text]) => [ValOpsMemory.key(path), text]));
|
|
9948
9992
|
}
|
|
@@ -10444,7 +10488,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10444
10488
|
message: "Val: could not start the Val server",
|
|
10445
10489
|
details: err instanceof Error ? err.message : String(err)
|
|
10446
10490
|
};
|
|
10447
|
-
|
|
10491
|
+
Internal.log.error(error.message + ": " + error.details);
|
|
10448
10492
|
return convert({
|
|
10449
10493
|
status: 500,
|
|
10450
10494
|
json: error
|
|
@@ -10456,7 +10500,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10456
10500
|
message: "Val: routes are not configured correctly",
|
|
10457
10501
|
details: `Check you api routes. Expected pathname to start with "${route}", but it was: "${url.pathname}"`
|
|
10458
10502
|
};
|
|
10459
|
-
|
|
10503
|
+
Internal.log.error(error);
|
|
10460
10504
|
return convert({
|
|
10461
10505
|
status: 500,
|
|
10462
10506
|
json: error
|
|
@@ -10647,7 +10691,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10647
10691
|
});
|
|
10648
10692
|
} catch (err) {
|
|
10649
10693
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10650
|
-
|
|
10694
|
+
Internal.log.error(`${method} ${route} threw: ${error.message}`, error.stack);
|
|
10651
10695
|
return {
|
|
10652
10696
|
status: 500,
|
|
10653
10697
|
json: {
|