@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
|
@@ -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
|
};
|
|
@@ -6011,6 +6011,50 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6011
6011
|
};
|
|
6012
6012
|
}
|
|
6013
6013
|
},
|
|
6014
|
+
/**
|
|
6015
|
+
* Content analytics beacons, outside the hosted platform.
|
|
6016
|
+
*
|
|
6017
|
+
* On a site Val hosts, the platform's loader answers this route before a
|
|
6018
|
+
* request reaches the app, and counts. Everywhere else nothing counts yet:
|
|
6019
|
+
* this checks the beacon and answers, so a site with analytics on does not
|
|
6020
|
+
* fill its visitors' consoles with 404s. In local dev it also logs a line
|
|
6021
|
+
* per beacon, which is how the showcase shows analytics working.
|
|
6022
|
+
*/
|
|
6023
|
+
"/analytics": {
|
|
6024
|
+
POST: async req => {
|
|
6025
|
+
const parsed = internal.AnalyticsBeacon.safeParse(req.body);
|
|
6026
|
+
if (!parsed.success) {
|
|
6027
|
+
const body = req.body;
|
|
6028
|
+
const version = typeof body === "object" && body !== null && "v" in body ? body.v : undefined;
|
|
6029
|
+
if (typeof version === "number" && version !== 1) {
|
|
6030
|
+
// A newer format than this server knows: not an error.
|
|
6031
|
+
return {
|
|
6032
|
+
status: 200,
|
|
6033
|
+
json: {
|
|
6034
|
+
counted: false
|
|
6035
|
+
}
|
|
6036
|
+
};
|
|
6037
|
+
}
|
|
6038
|
+
return {
|
|
6039
|
+
status: 400,
|
|
6040
|
+
json: {
|
|
6041
|
+
message: "Not a valid Val analytics beacon"
|
|
6042
|
+
}
|
|
6043
|
+
};
|
|
6044
|
+
}
|
|
6045
|
+
if (options.mode === "fs") {
|
|
6046
|
+
const beacon = parsed.data;
|
|
6047
|
+
const count = paths => Object.values(paths).reduce((n, list) => n + list.length, 0);
|
|
6048
|
+
core.Internal.log.debug(`analytics: ${beacon.route}${beacon.view ? " (page view)" : ""}: ${count(beacon.rendered)} rendered, ${count(beacon.viewed)} viewed`);
|
|
6049
|
+
}
|
|
6050
|
+
return {
|
|
6051
|
+
status: 200,
|
|
6052
|
+
json: {
|
|
6053
|
+
counted: false
|
|
6054
|
+
}
|
|
6055
|
+
};
|
|
6056
|
+
}
|
|
6057
|
+
},
|
|
6014
6058
|
"/draft/stat": {
|
|
6015
6059
|
GET: async req => {
|
|
6016
6060
|
const cookies = req.cookies;
|
|
@@ -6298,7 +6342,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6298
6342
|
// the environment when @valbuild/server was built. See getSettings.
|
|
6299
6343
|
const settingsRes = await getSettings(options.project, remoteFileAuth, options.valContentUrl);
|
|
6300
6344
|
if (!settingsRes.success) {
|
|
6301
|
-
|
|
6345
|
+
core.Internal.log.warn("Could not get remote files settings: " + settingsRes.message);
|
|
6302
6346
|
return {
|
|
6303
6347
|
status: 400,
|
|
6304
6348
|
json: {
|
|
@@ -6743,7 +6787,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6743
6787
|
let contentBaseUrl = null;
|
|
6744
6788
|
let contentAuthNonce = null;
|
|
6745
6789
|
if (!options.project) {
|
|
6746
|
-
|
|
6790
|
+
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
6791
|
} else if (!isFsOps(serverOps)) {
|
|
6748
6792
|
/*
|
|
6749
6793
|
* Presigning needs a content host to presign AGAINST, and a local
|
|
@@ -6756,11 +6800,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6756
6800
|
* the patch upload base url -- still works, and the only thing lost
|
|
6757
6801
|
* is the browser posting AI images straight to the content host.
|
|
6758
6802
|
*/
|
|
6759
|
-
|
|
6803
|
+
core.Internal.log.debug("Direct content-host uploads (AI images) disabled: this store has no content host to presign against.");
|
|
6760
6804
|
} else {
|
|
6761
6805
|
const authDataRes = await getRemoteFileAuth();
|
|
6762
6806
|
if (authDataRes.status !== 200) {
|
|
6763
|
-
|
|
6807
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + authDataRes.json.message);
|
|
6764
6808
|
} else {
|
|
6765
6809
|
const corsOrigin = "*"; // TODO: add cors origin
|
|
6766
6810
|
const presignedAuthNonce = await serverOps.getPresignedAuthNonce(options.project, corsOrigin, authDataRes.json.remoteFileAuth);
|
|
@@ -6768,7 +6812,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6768
6812
|
contentBaseUrl = presignedAuthNonce.data.baseUrl;
|
|
6769
6813
|
contentAuthNonce = presignedAuthNonce.data.nonce;
|
|
6770
6814
|
} else {
|
|
6771
|
-
|
|
6815
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + presignedAuthNonce.error.message);
|
|
6772
6816
|
}
|
|
6773
6817
|
}
|
|
6774
6818
|
}
|
|
@@ -6943,7 +6987,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6943
6987
|
});
|
|
6944
6988
|
if (fetchedPatchesRes.error) {
|
|
6945
6989
|
// Error is singular
|
|
6946
|
-
|
|
6990
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.error);
|
|
6947
6991
|
return {
|
|
6948
6992
|
status: 500,
|
|
6949
6993
|
json: {
|
|
@@ -6954,7 +6998,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6954
6998
|
}
|
|
6955
6999
|
if (fetchedPatchesRes.errors && Object.keys(fetchedPatchesRes.errors).length > 0) {
|
|
6956
7000
|
// Errors is plural. Different property than above.
|
|
6957
|
-
|
|
7001
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.errors);
|
|
6958
7002
|
return {
|
|
6959
7003
|
status: 500,
|
|
6960
7004
|
json: {
|
|
@@ -7005,7 +7049,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7005
7049
|
const ids = query.id;
|
|
7006
7050
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
7007
7051
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
7008
|
-
|
|
7052
|
+
core.Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
7009
7053
|
return {
|
|
7010
7054
|
status: 500,
|
|
7011
7055
|
json: {
|
|
@@ -7064,7 +7108,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7064
7108
|
}
|
|
7065
7109
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7066
7110
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7067
|
-
|
|
7111
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7068
7112
|
return {
|
|
7069
7113
|
status: 500,
|
|
7070
7114
|
json: {
|
|
@@ -7082,7 +7126,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7082
7126
|
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
|
7083
7127
|
}
|
|
7084
7128
|
} catch (e) {
|
|
7085
|
-
|
|
7129
|
+
core.Internal.log.error("Failed to serialize schemas", e);
|
|
7086
7130
|
return {
|
|
7087
7131
|
status: 500,
|
|
7088
7132
|
json: {
|
|
@@ -7268,7 +7312,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7268
7312
|
const sourcesSha = await serverOps.getSourcesSha();
|
|
7269
7313
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7270
7314
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7271
|
-
|
|
7315
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7272
7316
|
return {
|
|
7273
7317
|
status: 500,
|
|
7274
7318
|
json: {
|
|
@@ -7977,11 +8021,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7977
8021
|
...serverOps.analyzePatches(survivors, patches.commits, commit),
|
|
7978
8022
|
...survivingPatches
|
|
7979
8023
|
});
|
|
7980
|
-
|
|
8024
|
+
core.Internal.log.error("removed unpublished changes that could not be applied", removed);
|
|
7981
8025
|
}
|
|
7982
8026
|
}
|
|
7983
8027
|
if (preparedCommit.hasErrors) {
|
|
7984
|
-
|
|
8028
|
+
core.Internal.log.error("Failed to create commit", JSON.stringify({
|
|
7985
8029
|
sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
|
|
7986
8030
|
binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
|
|
7987
8031
|
}, null, 2));
|
|
@@ -8039,7 +8083,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8039
8083
|
}
|
|
8040
8084
|
const uploadRes = await serverOps.uploadRemoteFiles(preparedCommit, authRes.json.remoteFileAuth);
|
|
8041
8085
|
if (Object.keys(uploadRes.errors).length > 0) {
|
|
8042
|
-
|
|
8086
|
+
core.Internal.log.error("Failed to upload remote files", uploadRes.errors);
|
|
8043
8087
|
return {
|
|
8044
8088
|
status: 400,
|
|
8045
8089
|
json: {
|
|
@@ -8071,7 +8115,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8071
8115
|
const remoteFileAuth = (_remoteFileAuthRes = remoteFileAuthRes) === null || _remoteFileAuthRes === void 0 || (_remoteFileAuthRes = _remoteFileAuthRes.json) === null || _remoteFileAuthRes === void 0 ? void 0 : _remoteFileAuthRes.remoteFileAuth;
|
|
8072
8116
|
const saveRes = await serverOps.saveOrUploadFiles(preparedCommit, mode, remoteFileAuth);
|
|
8073
8117
|
if (Object.keys(saveRes.errors).length > 0) {
|
|
8074
|
-
|
|
8118
|
+
core.Internal.log.error("Failed to save files", saveRes.errors);
|
|
8075
8119
|
return {
|
|
8076
8120
|
status: 400,
|
|
8077
8121
|
json: {
|
|
@@ -8130,13 +8174,13 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8130
8174
|
*/
|
|
8131
8175
|
const deleteRes = await serverOps.deletePatches(consumed);
|
|
8132
8176
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8133
|
-
|
|
8177
|
+
core.Internal.log.error(`got an error while cleaning up patches after publish: ${deleteRes.error.message}`);
|
|
8134
8178
|
} else if ("errors" in deleteRes && deleteRes.errors !== undefined) {
|
|
8135
8179
|
// Per patch, and not fatal: the files are written, so the save
|
|
8136
8180
|
// succeeded. A patch left behind is announced again on the next
|
|
8137
8181
|
// stat, applies to a base that already contains it, and is removed
|
|
8138
8182
|
// then.
|
|
8139
|
-
|
|
8183
|
+
core.Internal.log.error("could not clean up some patches after publish", deleteRes.errors);
|
|
8140
8184
|
}
|
|
8141
8185
|
return {
|
|
8142
8186
|
status: 200,
|
|
@@ -8169,7 +8213,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8169
8213
|
commitToGit
|
|
8170
8214
|
}) : await commitToGit();
|
|
8171
8215
|
if (commitRes.error) {
|
|
8172
|
-
|
|
8216
|
+
core.Internal.log.error("Failed to commit", commitRes.error);
|
|
8173
8217
|
if ("isNotFastForward" in commitRes && commitRes.isNotFastForward) {
|
|
8174
8218
|
return {
|
|
8175
8219
|
status: 409,
|
|
@@ -9058,7 +9102,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9058
9102
|
// TypeScript compiler. See `patch/ts/publishKit.ts`.
|
|
9059
9103
|
const {
|
|
9060
9104
|
getJsonEntryAtCommit
|
|
9061
|
-
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-
|
|
9105
|
+
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-80bf8f02.cjs.dev.js'); });
|
|
9062
9106
|
const res = await getJsonEntryAtCommit(serverOps, req.query.commit_sha, req.query.path, req.query.key);
|
|
9063
9107
|
if (fp.result.isErr(res)) {
|
|
9064
9108
|
return historyErrorResponse(res.error);
|
|
@@ -9147,7 +9191,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9147
9191
|
const remote = query.remote === "true";
|
|
9148
9192
|
const patchId = query.patch_id;
|
|
9149
9193
|
if (!patchId && isHttpOps(serverOps) && remote) {
|
|
9150
|
-
|
|
9194
|
+
core.Internal.log.error(`Remote file: ${filePath} requested without patch id. This is most likely a bug in Val.`);
|
|
9151
9195
|
}
|
|
9152
9196
|
// Opened, not read: a video is seeked in by many small ranges, and
|
|
9153
9197
|
// only the asked-for bytes are read where the mode can (fs).
|
|
@@ -9379,7 +9423,7 @@ async function withAuth(verifyJwt, secret, cookies, errorMessageType, handler) {
|
|
|
9379
9423
|
};
|
|
9380
9424
|
}
|
|
9381
9425
|
return handler(verification.data).catch(err => {
|
|
9382
|
-
|
|
9426
|
+
core.Internal.log.error(`Failed while processing: ${errorMessageType}`, err);
|
|
9383
9427
|
return {
|
|
9384
9428
|
status: 500,
|
|
9385
9429
|
json: {
|
|
@@ -9948,7 +9992,7 @@ class ValOpsMemory extends ValOps {
|
|
|
9948
9992
|
this.contentUrl = options.contentUrl;
|
|
9949
9993
|
this.requiresAuth = !options.unsafelyAllowUnauthenticated;
|
|
9950
9994
|
if (options.unsafelyAllowUnauthenticated && options.warnUnauthenticated !== false) {
|
|
9951
|
-
|
|
9995
|
+
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
9996
|
}
|
|
9953
9997
|
this.sourceFiles = Object.fromEntries(Object.entries(options.sourceFiles).map(([path, text]) => [ValOpsMemory.key(path), text]));
|
|
9954
9998
|
}
|
|
@@ -10450,7 +10494,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10450
10494
|
message: "Val: could not start the Val server",
|
|
10451
10495
|
details: err instanceof Error ? err.message : String(err)
|
|
10452
10496
|
};
|
|
10453
|
-
|
|
10497
|
+
core.Internal.log.error(error.message + ": " + error.details);
|
|
10454
10498
|
return convert({
|
|
10455
10499
|
status: 500,
|
|
10456
10500
|
json: error
|
|
@@ -10462,7 +10506,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10462
10506
|
message: "Val: routes are not configured correctly",
|
|
10463
10507
|
details: `Check you api routes. Expected pathname to start with "${route}", but it was: "${url.pathname}"`
|
|
10464
10508
|
};
|
|
10465
|
-
|
|
10509
|
+
core.Internal.log.error(error);
|
|
10466
10510
|
return convert({
|
|
10467
10511
|
status: 500,
|
|
10468
10512
|
json: error
|
|
@@ -10653,7 +10697,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10653
10697
|
});
|
|
10654
10698
|
} catch (err) {
|
|
10655
10699
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10656
|
-
|
|
10700
|
+
core.Internal.log.error(`${method} ${route} threw: ${error.message}`, error.stack);
|
|
10657
10701
|
return {
|
|
10658
10702
|
status: 500,
|
|
10659
10703
|
json: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { F as bytesToUtf8, G as posixPath } from './ValRouterCore-
|
|
2
|
+
import { F as bytesToUtf8, G as posixPath } from './ValRouterCore-2579e663.esm.js';
|
|
3
3
|
import { result } from '@valbuild/core/fp';
|
|
4
4
|
import { a as analyzeValModule, c as analyzeJsonValuesEntries } from './jsonValuesModule-427d68c8.esm.js';
|
|
5
5
|
import '@valbuild/core';
|
package/dist/{getJsonEntryAtCommit-2e36e805.cjs.prod.js → getJsonEntryAtCommit-6bbe1c9d.cjs.prod.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-dfb7b578.cjs.prod.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-d1bb8d8f.cjs.prod.js');
|
|
7
7
|
require('@valbuild/core');
|
package/dist/{getJsonEntryAtCommit-64f67a50.cjs.dev.js → getJsonEntryAtCommit-80bf8f02.cjs.dev.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-fec2cbca.cjs.dev.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-8ae503a8.cjs.dev.js');
|
|
7
7
|
require('@valbuild/core');
|
|
@@ -12,7 +12,7 @@ var path = require('path');
|
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var vm = require('node:vm');
|
|
14
14
|
var node_module = require('node:module');
|
|
15
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
15
|
+
var ValRouterCore = require('./ValRouterCore-fec2cbca.cjs.dev.js');
|
|
16
16
|
var server = require('@valbuild/ui/server');
|
|
17
17
|
var z = require('zod');
|
|
18
18
|
var zodValidationError = require('zod-validation-error');
|
|
@@ -2551,7 +2551,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
};
|
|
2553
2553
|
}
|
|
2554
|
-
|
|
2554
|
+
core.Internal.log.error("Could not parse presigned auth nonce response. Error: " + zodValidationError.fromError(parsed.error));
|
|
2555
2555
|
return {
|
|
2556
2556
|
status: "error",
|
|
2557
2557
|
statusCode: 500,
|
|
@@ -2570,7 +2570,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2570
2570
|
};
|
|
2571
2571
|
}
|
|
2572
2572
|
const unknownErrorMessage = `Could not get presigned auth nonce. HTTP error: ${res.status} ${res.statusText}`;
|
|
2573
|
-
|
|
2573
|
+
core.Internal.log.error(unknownErrorMessage);
|
|
2574
2574
|
return {
|
|
2575
2575
|
status: "error",
|
|
2576
2576
|
statusCode: 500,
|
|
@@ -2579,7 +2579,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
};
|
|
2581
2581
|
} catch (e) {
|
|
2582
|
-
|
|
2582
|
+
core.Internal.log.error("Could not get presigned auth nonce (connection error?):", e);
|
|
2583
2583
|
return {
|
|
2584
2584
|
status: "error",
|
|
2585
2585
|
statusCode: 500,
|
|
@@ -2684,7 +2684,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
if (Date.now() - start > interval) {
|
|
2687
|
-
|
|
2687
|
+
core.Internal.log.debug("polling interval of patches exceeded");
|
|
2688
2688
|
}
|
|
2689
2689
|
if (stopPolling) {
|
|
2690
2690
|
return;
|
|
@@ -2713,7 +2713,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
2715
|
if (Date.now() - start > interval) {
|
|
2716
|
-
|
|
2716
|
+
core.Internal.log.debug("polling interval of files exceeded");
|
|
2717
2717
|
}
|
|
2718
2718
|
// Checked BEFORE rescheduling, as the patches-directory poller
|
|
2719
2719
|
// above does. Without it this walk goes on forever: the `finally`
|
|
@@ -2884,7 +2884,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2884
2884
|
async repairStore(read) {
|
|
2885
2885
|
const patchesDir = this.getPatchesDir();
|
|
2886
2886
|
for (const problem of describePatchStoreProblems(read.problems)) {
|
|
2887
|
-
|
|
2887
|
+
core.Internal.log.warn("something is wrong with the patch store.", problem);
|
|
2888
2888
|
}
|
|
2889
2889
|
const locked = await withPatchLock(this.getPatchLockFile(), {
|
|
2890
2890
|
ttlMs: 30_000,
|
|
@@ -2908,7 +2908,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2908
2908
|
}
|
|
2909
2909
|
for (const action of repairPatchStore(patchesDir, current)) {
|
|
2910
2910
|
if (action.type === "removed-unreadable-patch") {
|
|
2911
|
-
|
|
2911
|
+
core.Internal.log.warn(`removed the unpublished change ${action.name} because ${action.because}. See ${patchesDir}/${PATCH_REPAIR_LOG_FILE_NAME}.`);
|
|
2912
2912
|
// Queued rather than only logged: this is someone's unpublished
|
|
2913
2913
|
// work being thrown away, and a server console is not somewhere the
|
|
2914
2914
|
// person editing is looking.
|
|
@@ -2919,7 +2919,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2919
2919
|
} else if (action.type === "removed-orphan-directory") {
|
|
2920
2920
|
// Not queued. Nothing ever read this - it is a record whose log line
|
|
2921
2921
|
// never landed - so there is no edit to tell anyone about.
|
|
2922
|
-
|
|
2922
|
+
core.Internal.log.warn(`removed the unused patch directory ${action.name}.`);
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
2925
2925
|
const after = readPatchStore(patchesDir);
|
|
@@ -2939,7 +2939,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2939
2939
|
message: reset.error
|
|
2940
2940
|
};
|
|
2941
2941
|
}
|
|
2942
|
-
|
|
2942
|
+
core.Internal.log.warn(`the patch store could not be repaired, so it was reset. The previous contents are in ${reset.movedTo}.`);
|
|
2943
2943
|
return {
|
|
2944
2944
|
status: "ok",
|
|
2945
2945
|
entries: []
|
|
@@ -2949,7 +2949,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2949
2949
|
// Someone else holds the lock, quite possibly to run this same repair.
|
|
2950
2950
|
// Serving what was read is safe — those entries are the ones that ARE
|
|
2951
2951
|
// readable — and the next read tries again.
|
|
2952
|
-
|
|
2952
|
+
core.Internal.log.warn(`could not repair the patch store now. ${locked.message}`);
|
|
2953
2953
|
return {
|
|
2954
2954
|
status: "ok",
|
|
2955
2955
|
entries: read.entries
|
|
@@ -3460,7 +3460,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
3460
3460
|
}
|
|
3461
3461
|
const res = await ValRouterCore.uploadRemoteFile(this.contentUrl, this.options.config.project, splitRemoteRefRes.bucket, splitRemoteRefRes.fileHash, ValRouterCore.getFileExt(splitRemoteRefRes.filePath), fileBuffer, auth);
|
|
3462
3462
|
if (!res.success) {
|
|
3463
|
-
|
|
3463
|
+
core.Internal.log.error("Failed to upload remote file", ref, res.error);
|
|
3464
3464
|
throw new Error(`Failed to upload remote file: ${ref}. ${res.error}`);
|
|
3465
3465
|
}
|
|
3466
3466
|
uploadedRemoteRefs.push(ref);
|
|
@@ -6440,7 +6440,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6440
6440
|
}
|
|
6441
6441
|
};
|
|
6442
6442
|
} else {
|
|
6443
|
-
|
|
6443
|
+
core.Internal.log.error("Could not parse presigned auth nonce response. Error: " + zodValidationError.fromError(parsed.error));
|
|
6444
6444
|
return {
|
|
6445
6445
|
status: "error",
|
|
6446
6446
|
statusCode: 500,
|
|
@@ -6463,7 +6463,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6463
6463
|
if ((_res$headers$get = res.headers.get("Content-Type")) !== null && _res$headers$get !== void 0 && _res$headers$get.includes("application/json")) {
|
|
6464
6464
|
const json = await res.json();
|
|
6465
6465
|
const message = internal.getErrorMessageFromUnknownJson(json, unknownErrorMessage);
|
|
6466
|
-
|
|
6466
|
+
core.Internal.log.error("Presigned auth nonce error:", message);
|
|
6467
6467
|
return {
|
|
6468
6468
|
status: "error",
|
|
6469
6469
|
statusCode: 500,
|
|
@@ -6472,7 +6472,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6472
6472
|
}
|
|
6473
6473
|
};
|
|
6474
6474
|
}
|
|
6475
|
-
|
|
6475
|
+
core.Internal.log.error(unknownErrorMessage);
|
|
6476
6476
|
return {
|
|
6477
6477
|
status: "error",
|
|
6478
6478
|
statusCode: 500,
|
|
@@ -6481,7 +6481,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6481
6481
|
}
|
|
6482
6482
|
};
|
|
6483
6483
|
} catch (e) {
|
|
6484
|
-
|
|
6484
|
+
core.Internal.log.error("Could not get presigned auth nonce (connection error?):", e);
|
|
6485
6485
|
return {
|
|
6486
6486
|
status: "error",
|
|
6487
6487
|
statusCode: 500,
|
|
@@ -6532,7 +6532,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6532
6532
|
}
|
|
6533
6533
|
if (message) {
|
|
6534
6534
|
message = `Could not get patches: ${message}`;
|
|
6535
|
-
|
|
6535
|
+
core.Internal.log.error(message);
|
|
6536
6536
|
return {
|
|
6537
6537
|
type: "error",
|
|
6538
6538
|
error: {
|
|
@@ -6760,7 +6760,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6760
6760
|
}
|
|
6761
6761
|
};
|
|
6762
6762
|
}).catch(e => {
|
|
6763
|
-
|
|
6763
|
+
core.Internal.log.error("Could not get nonce (connection error?):", e instanceof Error ? e.message : e.toString());
|
|
6764
6764
|
return {
|
|
6765
6765
|
status: "error",
|
|
6766
6766
|
error: {
|
|
@@ -6996,7 +6996,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6996
6996
|
} : {})
|
|
6997
6997
|
};
|
|
6998
6998
|
}
|
|
6999
|
-
|
|
6999
|
+
core.Internal.log.error("Could not parse patches response. Error: " + zodValidationError.fromError(parsed.error));
|
|
7000
7000
|
return {
|
|
7001
7001
|
patches,
|
|
7002
7002
|
error: {
|
|
@@ -7004,7 +7004,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7004
7004
|
}
|
|
7005
7005
|
};
|
|
7006
7006
|
}
|
|
7007
|
-
|
|
7007
|
+
core.Internal.log.error("Could not get patches. HTTP error: " + patchesRes.status + " " + patchesRes.statusText);
|
|
7008
7008
|
if (patchesRes.status === 401) {
|
|
7009
7009
|
return {
|
|
7010
7010
|
patches,
|
|
@@ -7020,7 +7020,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7020
7020
|
}
|
|
7021
7021
|
};
|
|
7022
7022
|
} catch (err) {
|
|
7023
|
-
|
|
7023
|
+
core.Internal.log.error("Could not get patches (connection error):", err instanceof Error ? err.message : JSON.stringify(err));
|
|
7024
7024
|
return {
|
|
7025
7025
|
patches: [],
|
|
7026
7026
|
networkError: true,
|
|
@@ -7286,7 +7286,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7286
7286
|
}
|
|
7287
7287
|
const file = filesRes.files[0];
|
|
7288
7288
|
if (filesRes.files.length > 1) {
|
|
7289
|
-
|
|
7289
|
+
core.Internal.log.error("Expected 1 file, got more:", filesRes.files);
|
|
7290
7290
|
}
|
|
7291
7291
|
if (!file) {
|
|
7292
7292
|
return null;
|
|
@@ -7301,15 +7301,15 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7301
7301
|
remote
|
|
7302
7302
|
}]);
|
|
7303
7303
|
if (filesRes.error) {
|
|
7304
|
-
|
|
7304
|
+
core.Internal.log.error("Error getting file:", filePath, filesRes.error);
|
|
7305
7305
|
return null;
|
|
7306
7306
|
}
|
|
7307
7307
|
if (filesRes.errors) {
|
|
7308
|
-
|
|
7308
|
+
core.Internal.log.error("Failed while retrieving files", filePath, filesRes.errors);
|
|
7309
7309
|
}
|
|
7310
7310
|
const file = filesRes.files[0];
|
|
7311
7311
|
if (filesRes.files.length > 1) {
|
|
7312
|
-
|
|
7312
|
+
core.Internal.log.error("Expected 1 file, got more:", filesRes.files);
|
|
7313
7313
|
}
|
|
7314
7314
|
if (!file) {
|
|
7315
7315
|
return null;
|
|
@@ -8484,7 +8484,7 @@ function warnIfInsecureUrls(urls) {
|
|
|
8484
8484
|
for (const name of CREDENTIAL_BEARING_URLS) {
|
|
8485
8485
|
const warning = insecureUrlWarning(name, urls[name]);
|
|
8486
8486
|
if (warning) {
|
|
8487
|
-
|
|
8487
|
+
core.Internal.log.warn(warning);
|
|
8488
8488
|
}
|
|
8489
8489
|
}
|
|
8490
8490
|
}
|
|
@@ -8612,7 +8612,7 @@ const CLOCK_SKEW_LEEWAY_SECONDS = 60;
|
|
|
8612
8612
|
function failure(reason, message) {
|
|
8613
8613
|
// NOTE: deliberately never logs the token itself - it is a credential, and
|
|
8614
8614
|
// anything we print here ends up in the host's request logs.
|
|
8615
|
-
|
|
8615
|
+
core.Internal.log.debug(`Invalid JWT (${reason}): ${message}`);
|
|
8616
8616
|
return {
|
|
8617
8617
|
success: false,
|
|
8618
8618
|
reason,
|
|
@@ -8994,7 +8994,7 @@ function guardedLookup(lookup) {
|
|
|
8994
8994
|
// Server-side only. This is the half an operator needs to work out
|
|
8995
8995
|
// why a link check refused a URL, and the half a caller must not
|
|
8996
8996
|
// be given.
|
|
8997
|
-
|
|
8997
|
+
core.Internal.log.warn(`[val] link check refused ${hostname}: resolves to ${describeBlocked(reason)} (${entry.address})`);
|
|
8998
8998
|
callback(new Error(REFUSED_MESSAGE), "", 0);
|
|
8999
8999
|
return;
|
|
9000
9000
|
}
|
|
@@ -13524,7 +13524,7 @@ async function safeReadGit(cwd) {
|
|
|
13524
13524
|
async function findGitHead(currentDir, depth) {
|
|
13525
13525
|
const gitHeadPath = path.join(currentDir, ".git", "HEAD");
|
|
13526
13526
|
if (depth > 1000) {
|
|
13527
|
-
|
|
13527
|
+
core.Internal.log.error(`Reached max depth while scanning for .git folder. Current working dir: ${cwd}.`);
|
|
13528
13528
|
return {
|
|
13529
13529
|
commit: undefined,
|
|
13530
13530
|
branch: undefined
|
|
@@ -13561,7 +13561,7 @@ async function safeReadGit(cwd) {
|
|
|
13561
13561
|
try {
|
|
13562
13562
|
return findGitHead(cwd, 0);
|
|
13563
13563
|
} catch (err) {
|
|
13564
|
-
|
|
13564
|
+
core.Internal.log.error("Error while reading .git", err);
|
|
13565
13565
|
return {
|
|
13566
13566
|
commit: undefined,
|
|
13567
13567
|
branch: undefined
|
|
@@ -13642,7 +13642,7 @@ class ValModuleLoader {
|
|
|
13642
13642
|
}).code;
|
|
13643
13643
|
if (!this.disableCache) {
|
|
13644
13644
|
if (this.cacheSize > MAX_CACHE_SIZE) {
|
|
13645
|
-
|
|
13645
|
+
core.Internal.log.debug("Cache size exceeded, clearing cache");
|
|
13646
13646
|
this.cache = {};
|
|
13647
13647
|
this.cacheSize = 0;
|
|
13648
13648
|
}
|
|
@@ -15194,7 +15194,7 @@ async function replaySnapshot(snapshotDir) {
|
|
|
15194
15194
|
}
|
|
15195
15195
|
if (patchesRes.errors && patchesRes.errors.length > 0) {
|
|
15196
15196
|
for (const err of patchesRes.errors) {
|
|
15197
|
-
|
|
15197
|
+
core.Internal.log.error(`Snapshot patch could not be read: ${err.message}`);
|
|
15198
15198
|
}
|
|
15199
15199
|
}
|
|
15200
15200
|
const analysis = {
|