@valbuild/server 0.148.0 → 0.148.2
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 +30 -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-9bdaaf89.cjs.dev.js → ValRouterCore-72594062.cjs.dev.js} +34 -34
- package/dist/{ValRouterCore-7ca3dc68.esm.js → ValRouterCore-ad10b6cf.esm.js} +34 -34
- package/dist/{ValRouterCore-42772c21.cjs.prod.js → ValRouterCore-dd465930.cjs.prod.js} +34 -34
- package/dist/{getJsonEntryAtCommit-2e36e805.cjs.prod.js → getJsonEntryAtCommit-2a0e9eaf.cjs.prod.js} +1 -1
- package/dist/{getJsonEntryAtCommit-64f67a50.cjs.dev.js → getJsonEntryAtCommit-85159574.cjs.dev.js} +1 -1
- package/dist/{getJsonEntryAtCommit-40b6d9c1.esm.js → getJsonEntryAtCommit-e32a470b.esm.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,35 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.148.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
print, now prefixed with `[val]` so you can filter them. Val's own debug
|
|
9
|
+
output, which used to reach your terminal and browser console, is now off by
|
|
10
|
+
default. That includes the `Invalid JWT` line that printed on every request
|
|
11
|
+
with an expired session cookie, the "verifying draft mode" and polling notices,
|
|
12
|
+
and the Studio's sync and WebSocket chatter.
|
|
13
|
+
|
|
14
|
+
To turn the debug output back on, for example when reporting a bug:
|
|
15
|
+
|
|
16
|
+
- on the server, set `VAL_DEBUG=1`
|
|
17
|
+
- in the browser, run `localStorage.setItem("val:debug", "1")` in the console.
|
|
18
|
+
It takes effect immediately, with no reload. Remove the key to turn it off
|
|
19
|
+
again.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`dc7c8cc`](https://github.com/valbuild/val/commit/dc7c8ccd82f643e662d00225fabec411b5d39e3a)]:
|
|
22
|
+
- @valbuild/core@0.148.2
|
|
23
|
+
- @valbuild/shared@0.148.2
|
|
24
|
+
- @valbuild/ui@0.148.2
|
|
25
|
+
|
|
26
|
+
## 0.148.1
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`fff5681`](https://github.com/valbuild/val/commit/fff5681b9ac9a24b873ba74ca636240d83404e46)]:
|
|
31
|
+
- @valbuild/ui@0.148.1
|
|
32
|
+
|
|
3
33
|
## 0.148.0
|
|
4
34
|
|
|
5
35
|
### 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-72594062.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-dd465930.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-ad10b6cf.esm.js';
|
|
3
3
|
import '@valbuild/shared/internal';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'zod-validation-error';
|
|
@@ -1463,7 +1463,7 @@ encode = bytesToBase64) {
|
|
|
1463
1463
|
}]) => {
|
|
1464
1464
|
if (remote) return;
|
|
1465
1465
|
const bytes = await ops.getBase64EncodedBinaryFileFromPatch(filePath, patchId, remote).catch(error => {
|
|
1466
|
-
|
|
1466
|
+
core.Internal.log.error("Could not read a committed file", filePath, error);
|
|
1467
1467
|
return null;
|
|
1468
1468
|
});
|
|
1469
1469
|
if (bytes === null) unread.push(filePath);else files[filePath] = encode(bytes);
|
|
@@ -2431,7 +2431,7 @@ class ValOps {
|
|
|
2431
2431
|
for (const [moduleFilePathS, source] of Object.entries(sources)) {
|
|
2432
2432
|
const moduleFilePath = moduleFilePathS;
|
|
2433
2433
|
if (errors[moduleFilePath] !== undefined) {
|
|
2434
|
-
|
|
2434
|
+
core.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.", {
|
|
2435
2435
|
moduleFilePath,
|
|
2436
2436
|
errors: errors[moduleFilePath]
|
|
2437
2437
|
});
|
|
@@ -2981,7 +2981,7 @@ class ValOps {
|
|
|
2981
2981
|
if (!errors[path]) {
|
|
2982
2982
|
errors[path] = [];
|
|
2983
2983
|
}
|
|
2984
|
-
|
|
2984
|
+
core.Internal.log.error("Module not found", path);
|
|
2985
2985
|
errors[path].push({
|
|
2986
2986
|
patchId: patchData.patchId,
|
|
2987
2987
|
skipped: true,
|
|
@@ -2994,7 +2994,7 @@ class ValOps {
|
|
|
2994
2994
|
}
|
|
2995
2995
|
const patchId = patchData.patchId;
|
|
2996
2996
|
if (errors[path]) {
|
|
2997
|
-
|
|
2997
|
+
core.Internal.log.error("Cannot apply patch: previous errors exists", path, errors[path]);
|
|
2998
2998
|
errors[path].push({
|
|
2999
2999
|
patchId: patchId,
|
|
3000
3000
|
skipped: true,
|
|
@@ -3158,7 +3158,7 @@ class ValOps {
|
|
|
3158
3158
|
// 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?
|
|
3159
3159
|
jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
|
|
3160
3160
|
if (fp.result.isErr(patchRes)) {
|
|
3161
|
-
|
|
3161
|
+
core.Internal.log.error("Could not apply patch", JSON.stringify({
|
|
3162
3162
|
path,
|
|
3163
3163
|
patchId,
|
|
3164
3164
|
error: patchRes.error,
|
|
@@ -3805,7 +3805,7 @@ class ValOps {
|
|
|
3805
3805
|
return fp.result.ok(entries);
|
|
3806
3806
|
};
|
|
3807
3807
|
const collectPatchError = (err, patchId, op) => {
|
|
3808
|
-
|
|
3808
|
+
core.Internal.log.error("Could not patch", JSON.stringify({
|
|
3809
3809
|
path,
|
|
3810
3810
|
patchId,
|
|
3811
3811
|
error: err,
|
|
@@ -4334,7 +4334,7 @@ class ValOps {
|
|
|
4334
4334
|
// sends it again later, so an error line here would be one a minute.
|
|
4335
4335
|
return fp.result.err(saveRes.error);
|
|
4336
4336
|
}
|
|
4337
|
-
|
|
4337
|
+
core.Internal.log.error(`Could not save source patch at path: '${path}'. Error: ${saveRes.error.errorType === "other" ? saveRes.error.message : saveRes.error.errorType}`);
|
|
4338
4338
|
if (saveRes.error.errorType === "patch-head-conflict") {
|
|
4339
4339
|
return fp.result.err({
|
|
4340
4340
|
errorType: "patch-head-conflict"
|
|
@@ -5574,11 +5574,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5574
5574
|
token
|
|
5575
5575
|
};
|
|
5576
5576
|
} else {
|
|
5577
|
-
|
|
5577
|
+
core.Internal.log.debug("Failed to get data from code: ", res.status);
|
|
5578
5578
|
return null;
|
|
5579
5579
|
}
|
|
5580
5580
|
}).catch(err => {
|
|
5581
|
-
|
|
5581
|
+
core.Internal.log.debug("Failed to get user from code: ", err);
|
|
5582
5582
|
return null;
|
|
5583
5583
|
});
|
|
5584
5584
|
};
|
|
@@ -6298,7 +6298,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6298
6298
|
// the environment when @valbuild/server was built. See getSettings.
|
|
6299
6299
|
const settingsRes = await getSettings(options.project, remoteFileAuth, options.valContentUrl);
|
|
6300
6300
|
if (!settingsRes.success) {
|
|
6301
|
-
|
|
6301
|
+
core.Internal.log.warn("Could not get remote files settings: " + settingsRes.message);
|
|
6302
6302
|
return {
|
|
6303
6303
|
status: 400,
|
|
6304
6304
|
json: {
|
|
@@ -6743,7 +6743,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6743
6743
|
let contentBaseUrl = null;
|
|
6744
6744
|
let contentAuthNonce = null;
|
|
6745
6745
|
if (!options.project) {
|
|
6746
|
-
|
|
6746
|
+
core.Internal.log.debug("Direct content-host uploads (AI images) disabled: no `project` set in val.config (and VAL_PROJECT env var is not set).");
|
|
6747
6747
|
} else if (!isFsOps(serverOps)) {
|
|
6748
6748
|
/*
|
|
6749
6749
|
* Presigning needs a content host to presign AGAINST, and a local
|
|
@@ -6756,11 +6756,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6756
6756
|
* the patch upload base url -- still works, and the only thing lost
|
|
6757
6757
|
* is the browser posting AI images straight to the content host.
|
|
6758
6758
|
*/
|
|
6759
|
-
|
|
6759
|
+
core.Internal.log.debug("Direct content-host uploads (AI images) disabled: this store has no content host to presign against.");
|
|
6760
6760
|
} else {
|
|
6761
6761
|
const authDataRes = await getRemoteFileAuth();
|
|
6762
6762
|
if (authDataRes.status !== 200) {
|
|
6763
|
-
|
|
6763
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + authDataRes.json.message);
|
|
6764
6764
|
} else {
|
|
6765
6765
|
const corsOrigin = "*"; // TODO: add cors origin
|
|
6766
6766
|
const presignedAuthNonce = await serverOps.getPresignedAuthNonce(options.project, corsOrigin, authDataRes.json.remoteFileAuth);
|
|
@@ -6768,7 +6768,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6768
6768
|
contentBaseUrl = presignedAuthNonce.data.baseUrl;
|
|
6769
6769
|
contentAuthNonce = presignedAuthNonce.data.nonce;
|
|
6770
6770
|
} else {
|
|
6771
|
-
|
|
6771
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + presignedAuthNonce.error.message);
|
|
6772
6772
|
}
|
|
6773
6773
|
}
|
|
6774
6774
|
}
|
|
@@ -6943,7 +6943,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6943
6943
|
});
|
|
6944
6944
|
if (fetchedPatchesRes.error) {
|
|
6945
6945
|
// Error is singular
|
|
6946
|
-
|
|
6946
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.error);
|
|
6947
6947
|
return {
|
|
6948
6948
|
status: 500,
|
|
6949
6949
|
json: {
|
|
@@ -6954,7 +6954,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6954
6954
|
}
|
|
6955
6955
|
if (fetchedPatchesRes.errors && Object.keys(fetchedPatchesRes.errors).length > 0) {
|
|
6956
6956
|
// Errors is plural. Different property than above.
|
|
6957
|
-
|
|
6957
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.errors);
|
|
6958
6958
|
return {
|
|
6959
6959
|
status: 500,
|
|
6960
6960
|
json: {
|
|
@@ -7005,7 +7005,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7005
7005
|
const ids = query.id;
|
|
7006
7006
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
7007
7007
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
7008
|
-
|
|
7008
|
+
core.Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
7009
7009
|
return {
|
|
7010
7010
|
status: 500,
|
|
7011
7011
|
json: {
|
|
@@ -7064,7 +7064,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7064
7064
|
}
|
|
7065
7065
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7066
7066
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7067
|
-
|
|
7067
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7068
7068
|
return {
|
|
7069
7069
|
status: 500,
|
|
7070
7070
|
json: {
|
|
@@ -7082,7 +7082,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7082
7082
|
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
|
7083
7083
|
}
|
|
7084
7084
|
} catch (e) {
|
|
7085
|
-
|
|
7085
|
+
core.Internal.log.error("Failed to serialize schemas", e);
|
|
7086
7086
|
return {
|
|
7087
7087
|
status: 500,
|
|
7088
7088
|
json: {
|
|
@@ -7268,7 +7268,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7268
7268
|
const sourcesSha = await serverOps.getSourcesSha();
|
|
7269
7269
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7270
7270
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7271
|
-
|
|
7271
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7272
7272
|
return {
|
|
7273
7273
|
status: 500,
|
|
7274
7274
|
json: {
|
|
@@ -7977,11 +7977,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7977
7977
|
...serverOps.analyzePatches(survivors, patches.commits, commit),
|
|
7978
7978
|
...survivingPatches
|
|
7979
7979
|
});
|
|
7980
|
-
|
|
7980
|
+
core.Internal.log.error("removed unpublished changes that could not be applied", removed);
|
|
7981
7981
|
}
|
|
7982
7982
|
}
|
|
7983
7983
|
if (preparedCommit.hasErrors) {
|
|
7984
|
-
|
|
7984
|
+
core.Internal.log.error("Failed to create commit", JSON.stringify({
|
|
7985
7985
|
sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
|
|
7986
7986
|
binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
|
|
7987
7987
|
}, null, 2));
|
|
@@ -8039,7 +8039,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8039
8039
|
}
|
|
8040
8040
|
const uploadRes = await serverOps.uploadRemoteFiles(preparedCommit, authRes.json.remoteFileAuth);
|
|
8041
8041
|
if (Object.keys(uploadRes.errors).length > 0) {
|
|
8042
|
-
|
|
8042
|
+
core.Internal.log.error("Failed to upload remote files", uploadRes.errors);
|
|
8043
8043
|
return {
|
|
8044
8044
|
status: 400,
|
|
8045
8045
|
json: {
|
|
@@ -8071,7 +8071,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8071
8071
|
const remoteFileAuth = (_remoteFileAuthRes = remoteFileAuthRes) === null || _remoteFileAuthRes === void 0 || (_remoteFileAuthRes = _remoteFileAuthRes.json) === null || _remoteFileAuthRes === void 0 ? void 0 : _remoteFileAuthRes.remoteFileAuth;
|
|
8072
8072
|
const saveRes = await serverOps.saveOrUploadFiles(preparedCommit, mode, remoteFileAuth);
|
|
8073
8073
|
if (Object.keys(saveRes.errors).length > 0) {
|
|
8074
|
-
|
|
8074
|
+
core.Internal.log.error("Failed to save files", saveRes.errors);
|
|
8075
8075
|
return {
|
|
8076
8076
|
status: 400,
|
|
8077
8077
|
json: {
|
|
@@ -8130,13 +8130,13 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8130
8130
|
*/
|
|
8131
8131
|
const deleteRes = await serverOps.deletePatches(consumed);
|
|
8132
8132
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8133
|
-
|
|
8133
|
+
core.Internal.log.error(`got an error while cleaning up patches after publish: ${deleteRes.error.message}`);
|
|
8134
8134
|
} else if ("errors" in deleteRes && deleteRes.errors !== undefined) {
|
|
8135
8135
|
// Per patch, and not fatal: the files are written, so the save
|
|
8136
8136
|
// succeeded. A patch left behind is announced again on the next
|
|
8137
8137
|
// stat, applies to a base that already contains it, and is removed
|
|
8138
8138
|
// then.
|
|
8139
|
-
|
|
8139
|
+
core.Internal.log.error("could not clean up some patches after publish", deleteRes.errors);
|
|
8140
8140
|
}
|
|
8141
8141
|
return {
|
|
8142
8142
|
status: 200,
|
|
@@ -8169,7 +8169,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8169
8169
|
commitToGit
|
|
8170
8170
|
}) : await commitToGit();
|
|
8171
8171
|
if (commitRes.error) {
|
|
8172
|
-
|
|
8172
|
+
core.Internal.log.error("Failed to commit", commitRes.error);
|
|
8173
8173
|
if ("isNotFastForward" in commitRes && commitRes.isNotFastForward) {
|
|
8174
8174
|
return {
|
|
8175
8175
|
status: 409,
|
|
@@ -9058,7 +9058,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9058
9058
|
// TypeScript compiler. See `patch/ts/publishKit.ts`.
|
|
9059
9059
|
const {
|
|
9060
9060
|
getJsonEntryAtCommit
|
|
9061
|
-
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-
|
|
9061
|
+
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-85159574.cjs.dev.js'); });
|
|
9062
9062
|
const res = await getJsonEntryAtCommit(serverOps, req.query.commit_sha, req.query.path, req.query.key);
|
|
9063
9063
|
if (fp.result.isErr(res)) {
|
|
9064
9064
|
return historyErrorResponse(res.error);
|
|
@@ -9147,7 +9147,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9147
9147
|
const remote = query.remote === "true";
|
|
9148
9148
|
const patchId = query.patch_id;
|
|
9149
9149
|
if (!patchId && isHttpOps(serverOps) && remote) {
|
|
9150
|
-
|
|
9150
|
+
core.Internal.log.error(`Remote file: ${filePath} requested without patch id. This is most likely a bug in Val.`);
|
|
9151
9151
|
}
|
|
9152
9152
|
// Opened, not read: a video is seeked in by many small ranges, and
|
|
9153
9153
|
// only the asked-for bytes are read where the mode can (fs).
|
|
@@ -9379,7 +9379,7 @@ async function withAuth(verifyJwt, secret, cookies, errorMessageType, handler) {
|
|
|
9379
9379
|
};
|
|
9380
9380
|
}
|
|
9381
9381
|
return handler(verification.data).catch(err => {
|
|
9382
|
-
|
|
9382
|
+
core.Internal.log.error(`Failed while processing: ${errorMessageType}`, err);
|
|
9383
9383
|
return {
|
|
9384
9384
|
status: 500,
|
|
9385
9385
|
json: {
|
|
@@ -9948,7 +9948,7 @@ class ValOpsMemory extends ValOps {
|
|
|
9948
9948
|
this.contentUrl = options.contentUrl;
|
|
9949
9949
|
this.requiresAuth = !options.unsafelyAllowUnauthenticated;
|
|
9950
9950
|
if (options.unsafelyAllowUnauthenticated && options.warnUnauthenticated !== false) {
|
|
9951
|
-
|
|
9951
|
+
core.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.");
|
|
9952
9952
|
}
|
|
9953
9953
|
this.sourceFiles = Object.fromEntries(Object.entries(options.sourceFiles).map(([path, text]) => [ValOpsMemory.key(path), text]));
|
|
9954
9954
|
}
|
|
@@ -10450,7 +10450,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10450
10450
|
message: "Val: could not start the Val server",
|
|
10451
10451
|
details: err instanceof Error ? err.message : String(err)
|
|
10452
10452
|
};
|
|
10453
|
-
|
|
10453
|
+
core.Internal.log.error(error.message + ": " + error.details);
|
|
10454
10454
|
return convert({
|
|
10455
10455
|
status: 500,
|
|
10456
10456
|
json: error
|
|
@@ -10462,7 +10462,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10462
10462
|
message: "Val: routes are not configured correctly",
|
|
10463
10463
|
details: `Check you api routes. Expected pathname to start with "${route}", but it was: "${url.pathname}"`
|
|
10464
10464
|
};
|
|
10465
|
-
|
|
10465
|
+
core.Internal.log.error(error);
|
|
10466
10466
|
return convert({
|
|
10467
10467
|
status: 500,
|
|
10468
10468
|
json: error
|
|
@@ -10653,7 +10653,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10653
10653
|
});
|
|
10654
10654
|
} catch (err) {
|
|
10655
10655
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10656
|
-
|
|
10656
|
+
core.Internal.log.error(`${method} ${route} threw: ${error.message}`, error.stack);
|
|
10657
10657
|
return {
|
|
10658
10658
|
status: 500,
|
|
10659
10659
|
json: {
|
|
@@ -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
|
};
|
|
@@ -6292,7 +6292,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6292
6292
|
// the environment when @valbuild/server was built. See getSettings.
|
|
6293
6293
|
const settingsRes = await getSettings(options.project, remoteFileAuth, options.valContentUrl);
|
|
6294
6294
|
if (!settingsRes.success) {
|
|
6295
|
-
|
|
6295
|
+
Internal.log.warn("Could not get remote files settings: " + settingsRes.message);
|
|
6296
6296
|
return {
|
|
6297
6297
|
status: 400,
|
|
6298
6298
|
json: {
|
|
@@ -6737,7 +6737,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6737
6737
|
let contentBaseUrl = null;
|
|
6738
6738
|
let contentAuthNonce = null;
|
|
6739
6739
|
if (!options.project) {
|
|
6740
|
-
|
|
6740
|
+
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
6741
|
} else if (!isFsOps(serverOps)) {
|
|
6742
6742
|
/*
|
|
6743
6743
|
* Presigning needs a content host to presign AGAINST, and a local
|
|
@@ -6750,11 +6750,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6750
6750
|
* the patch upload base url -- still works, and the only thing lost
|
|
6751
6751
|
* is the browser posting AI images straight to the content host.
|
|
6752
6752
|
*/
|
|
6753
|
-
|
|
6753
|
+
Internal.log.debug("Direct content-host uploads (AI images) disabled: this store has no content host to presign against.");
|
|
6754
6754
|
} else {
|
|
6755
6755
|
const authDataRes = await getRemoteFileAuth();
|
|
6756
6756
|
if (authDataRes.status !== 200) {
|
|
6757
|
-
|
|
6757
|
+
Internal.log.warn("Direct content-host uploads (AI images) disabled: " + authDataRes.json.message);
|
|
6758
6758
|
} else {
|
|
6759
6759
|
const corsOrigin = "*"; // TODO: add cors origin
|
|
6760
6760
|
const presignedAuthNonce = await serverOps.getPresignedAuthNonce(options.project, corsOrigin, authDataRes.json.remoteFileAuth);
|
|
@@ -6762,7 +6762,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6762
6762
|
contentBaseUrl = presignedAuthNonce.data.baseUrl;
|
|
6763
6763
|
contentAuthNonce = presignedAuthNonce.data.nonce;
|
|
6764
6764
|
} else {
|
|
6765
|
-
|
|
6765
|
+
Internal.log.warn("Direct content-host uploads (AI images) disabled: " + presignedAuthNonce.error.message);
|
|
6766
6766
|
}
|
|
6767
6767
|
}
|
|
6768
6768
|
}
|
|
@@ -6937,7 +6937,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6937
6937
|
});
|
|
6938
6938
|
if (fetchedPatchesRes.error) {
|
|
6939
6939
|
// Error is singular
|
|
6940
|
-
|
|
6940
|
+
Internal.log.error("Failed to get patches", fetchedPatchesRes.error);
|
|
6941
6941
|
return {
|
|
6942
6942
|
status: 500,
|
|
6943
6943
|
json: {
|
|
@@ -6948,7 +6948,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6948
6948
|
}
|
|
6949
6949
|
if (fetchedPatchesRes.errors && Object.keys(fetchedPatchesRes.errors).length > 0) {
|
|
6950
6950
|
// Errors is plural. Different property than above.
|
|
6951
|
-
|
|
6951
|
+
Internal.log.error("Failed to get patches", fetchedPatchesRes.errors);
|
|
6952
6952
|
return {
|
|
6953
6953
|
status: 500,
|
|
6954
6954
|
json: {
|
|
@@ -6999,7 +6999,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6999
6999
|
const ids = query.id;
|
|
7000
7000
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
7001
7001
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
7002
|
-
|
|
7002
|
+
Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
7003
7003
|
return {
|
|
7004
7004
|
status: 500,
|
|
7005
7005
|
json: {
|
|
@@ -7058,7 +7058,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7058
7058
|
}
|
|
7059
7059
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7060
7060
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7061
|
-
|
|
7061
|
+
Internal.log.error("Module errors", moduleErrors);
|
|
7062
7062
|
return {
|
|
7063
7063
|
status: 500,
|
|
7064
7064
|
json: {
|
|
@@ -7076,7 +7076,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7076
7076
|
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
|
7077
7077
|
}
|
|
7078
7078
|
} catch (e) {
|
|
7079
|
-
|
|
7079
|
+
Internal.log.error("Failed to serialize schemas", e);
|
|
7080
7080
|
return {
|
|
7081
7081
|
status: 500,
|
|
7082
7082
|
json: {
|
|
@@ -7262,7 +7262,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7262
7262
|
const sourcesSha = await serverOps.getSourcesSha();
|
|
7263
7263
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7264
7264
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7265
|
-
|
|
7265
|
+
Internal.log.error("Module errors", moduleErrors);
|
|
7266
7266
|
return {
|
|
7267
7267
|
status: 500,
|
|
7268
7268
|
json: {
|
|
@@ -7971,11 +7971,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7971
7971
|
...serverOps.analyzePatches(survivors, patches.commits, commit),
|
|
7972
7972
|
...survivingPatches
|
|
7973
7973
|
});
|
|
7974
|
-
|
|
7974
|
+
Internal.log.error("removed unpublished changes that could not be applied", removed);
|
|
7975
7975
|
}
|
|
7976
7976
|
}
|
|
7977
7977
|
if (preparedCommit.hasErrors) {
|
|
7978
|
-
|
|
7978
|
+
Internal.log.error("Failed to create commit", JSON.stringify({
|
|
7979
7979
|
sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
|
|
7980
7980
|
binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
|
|
7981
7981
|
}, null, 2));
|
|
@@ -8033,7 +8033,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8033
8033
|
}
|
|
8034
8034
|
const uploadRes = await serverOps.uploadRemoteFiles(preparedCommit, authRes.json.remoteFileAuth);
|
|
8035
8035
|
if (Object.keys(uploadRes.errors).length > 0) {
|
|
8036
|
-
|
|
8036
|
+
Internal.log.error("Failed to upload remote files", uploadRes.errors);
|
|
8037
8037
|
return {
|
|
8038
8038
|
status: 400,
|
|
8039
8039
|
json: {
|
|
@@ -8065,7 +8065,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8065
8065
|
const remoteFileAuth = (_remoteFileAuthRes = remoteFileAuthRes) === null || _remoteFileAuthRes === void 0 || (_remoteFileAuthRes = _remoteFileAuthRes.json) === null || _remoteFileAuthRes === void 0 ? void 0 : _remoteFileAuthRes.remoteFileAuth;
|
|
8066
8066
|
const saveRes = await serverOps.saveOrUploadFiles(preparedCommit, mode, remoteFileAuth);
|
|
8067
8067
|
if (Object.keys(saveRes.errors).length > 0) {
|
|
8068
|
-
|
|
8068
|
+
Internal.log.error("Failed to save files", saveRes.errors);
|
|
8069
8069
|
return {
|
|
8070
8070
|
status: 400,
|
|
8071
8071
|
json: {
|
|
@@ -8124,13 +8124,13 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8124
8124
|
*/
|
|
8125
8125
|
const deleteRes = await serverOps.deletePatches(consumed);
|
|
8126
8126
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8127
|
-
|
|
8127
|
+
Internal.log.error(`got an error while cleaning up patches after publish: ${deleteRes.error.message}`);
|
|
8128
8128
|
} else if ("errors" in deleteRes && deleteRes.errors !== undefined) {
|
|
8129
8129
|
// Per patch, and not fatal: the files are written, so the save
|
|
8130
8130
|
// succeeded. A patch left behind is announced again on the next
|
|
8131
8131
|
// stat, applies to a base that already contains it, and is removed
|
|
8132
8132
|
// then.
|
|
8133
|
-
|
|
8133
|
+
Internal.log.error("could not clean up some patches after publish", deleteRes.errors);
|
|
8134
8134
|
}
|
|
8135
8135
|
return {
|
|
8136
8136
|
status: 200,
|
|
@@ -8163,7 +8163,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8163
8163
|
commitToGit
|
|
8164
8164
|
}) : await commitToGit();
|
|
8165
8165
|
if (commitRes.error) {
|
|
8166
|
-
|
|
8166
|
+
Internal.log.error("Failed to commit", commitRes.error);
|
|
8167
8167
|
if ("isNotFastForward" in commitRes && commitRes.isNotFastForward) {
|
|
8168
8168
|
return {
|
|
8169
8169
|
status: 409,
|
|
@@ -9052,7 +9052,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9052
9052
|
// TypeScript compiler. See `patch/ts/publishKit.ts`.
|
|
9053
9053
|
const {
|
|
9054
9054
|
getJsonEntryAtCommit
|
|
9055
|
-
} = await import('./getJsonEntryAtCommit-
|
|
9055
|
+
} = await import('./getJsonEntryAtCommit-e32a470b.esm.js');
|
|
9056
9056
|
const res = await getJsonEntryAtCommit(serverOps, req.query.commit_sha, req.query.path, req.query.key);
|
|
9057
9057
|
if (result.isErr(res)) {
|
|
9058
9058
|
return historyErrorResponse(res.error);
|
|
@@ -9141,7 +9141,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9141
9141
|
const remote = query.remote === "true";
|
|
9142
9142
|
const patchId = query.patch_id;
|
|
9143
9143
|
if (!patchId && isHttpOps(serverOps) && remote) {
|
|
9144
|
-
|
|
9144
|
+
Internal.log.error(`Remote file: ${filePath} requested without patch id. This is most likely a bug in Val.`);
|
|
9145
9145
|
}
|
|
9146
9146
|
// Opened, not read: a video is seeked in by many small ranges, and
|
|
9147
9147
|
// only the asked-for bytes are read where the mode can (fs).
|
|
@@ -9373,7 +9373,7 @@ async function withAuth(verifyJwt, secret, cookies, errorMessageType, handler) {
|
|
|
9373
9373
|
};
|
|
9374
9374
|
}
|
|
9375
9375
|
return handler(verification.data).catch(err => {
|
|
9376
|
-
|
|
9376
|
+
Internal.log.error(`Failed while processing: ${errorMessageType}`, err);
|
|
9377
9377
|
return {
|
|
9378
9378
|
status: 500,
|
|
9379
9379
|
json: {
|
|
@@ -9942,7 +9942,7 @@ class ValOpsMemory extends ValOps {
|
|
|
9942
9942
|
this.contentUrl = options.contentUrl;
|
|
9943
9943
|
this.requiresAuth = !options.unsafelyAllowUnauthenticated;
|
|
9944
9944
|
if (options.unsafelyAllowUnauthenticated && options.warnUnauthenticated !== false) {
|
|
9945
|
-
|
|
9945
|
+
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
9946
|
}
|
|
9947
9947
|
this.sourceFiles = Object.fromEntries(Object.entries(options.sourceFiles).map(([path, text]) => [ValOpsMemory.key(path), text]));
|
|
9948
9948
|
}
|
|
@@ -10444,7 +10444,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10444
10444
|
message: "Val: could not start the Val server",
|
|
10445
10445
|
details: err instanceof Error ? err.message : String(err)
|
|
10446
10446
|
};
|
|
10447
|
-
|
|
10447
|
+
Internal.log.error(error.message + ": " + error.details);
|
|
10448
10448
|
return convert({
|
|
10449
10449
|
status: 500,
|
|
10450
10450
|
json: error
|
|
@@ -10456,7 +10456,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10456
10456
|
message: "Val: routes are not configured correctly",
|
|
10457
10457
|
details: `Check you api routes. Expected pathname to start with "${route}", but it was: "${url.pathname}"`
|
|
10458
10458
|
};
|
|
10459
|
-
|
|
10459
|
+
Internal.log.error(error);
|
|
10460
10460
|
return convert({
|
|
10461
10461
|
status: 500,
|
|
10462
10462
|
json: error
|
|
@@ -10647,7 +10647,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10647
10647
|
});
|
|
10648
10648
|
} catch (err) {
|
|
10649
10649
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10650
|
-
|
|
10650
|
+
Internal.log.error(`${method} ${route} threw: ${error.message}`, error.stack);
|
|
10651
10651
|
return {
|
|
10652
10652
|
status: 500,
|
|
10653
10653
|
json: {
|