@valbuild/server 0.153.6 → 0.154.1
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 +31 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +2 -2
- package/browser/dist/valbuild-server-browser.cjs.prod.js +2 -2
- package/browser/dist/valbuild-server-browser.esm.js +2 -2
- package/dist/{ValRouter-b12133a1.cjs.prod.js → ValRouter-31f89baf.cjs.prod.js} +51 -7
- package/dist/{ValRouter-480ecf99.cjs.dev.js → ValRouter-9505c550.cjs.dev.js} +51 -7
- package/dist/{ValRouter-f4f5348d.esm.js → ValRouter-b7dc784d.esm.js} +51 -7
- package/dist/{ValRouterCore-cbf1de67.cjs.dev.js → ValRouterCore-361673dc.cjs.dev.js} +100 -12
- package/dist/{ValRouterCore-c418ffb7.esm.js → ValRouterCore-be314bc7.esm.js} +100 -12
- package/dist/{ValRouterCore-3d7d2581.cjs.prod.js → ValRouterCore-cfb35067.cjs.prod.js} +100 -12
- package/dist/declarations/src/patch/ts/syntax.d.ts +22 -0
- package/dist/{inTabFetch-5ef58dda.cjs.prod.js → inTabFetch-56226d62.cjs.prod.js} +1 -1
- package/dist/{inTabFetch-99450193.cjs.dev.js → inTabFetch-5d0314a3.cjs.dev.js} +1 -1
- package/dist/{inTabFetch-cb415a9d.esm.js → inTabFetch-7c8a5628.esm.js} +1 -1
- package/dist/{publishKit-f98d8cd1.cjs.dev.js → publishKit-5a8c9a0d.cjs.dev.js} +2 -2
- package/dist/{publishKit-482747e2.cjs.prod.js → publishKit-707230bc.cjs.prod.js} +2 -2
- package/dist/{publishKit-c2bcff27.esm.js → publishKit-b850045b.esm.js} +3 -3
- package/dist/valbuild-server.cjs.dev.js +2 -2
- package/dist/valbuild-server.cjs.prod.js +2 -2
- package/dist/valbuild-server.esm.js +4 -4
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.dev.js +2 -2
- package/internal/browser/dist/valbuild-server-internal-browser.cjs.prod.js +2 -2
- package/internal/browser/dist/valbuild-server-internal-browser.esm.js +2 -2
- package/internal/dist/valbuild-server-internal.cjs.dev.js +2 -2
- package/internal/dist/valbuild-server-internal.cjs.prod.js +2 -2
- package/internal/dist/valbuild-server-internal.esm.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @valbuild/server
|
|
2
2
|
|
|
3
|
+
## 0.154.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1072](https://github.com/valbuild/val/pull/1072) [`def1434`](https://github.com/valbuild/val/commit/def1434324a0b3e26202148cb11726e02bd5bffe) Thanks [@freekh](https://github.com/freekh)! - The assistant's code tools answer faster in a proposal.
|
|
8
|
+
|
|
9
|
+
- **Reading costs no request after the first.** The Studio keeps the proposal's project in the tab for the life of the chat, instead of fetching the site's source and the proposal's files again for every `read_file`, `search_code`, `list_files`, `edit_file`, `format_files` and `lint`. It is read again when someone changes the proposal, when the site is published, and after the assistant's own changes.
|
|
10
|
+
- **A change is one or two requests instead of four.** `edit_file`, `write_files`, `format_files` and `lint` with `fix` no longer ask whether code mode is on before each write: Val's server already refuses a write while it is off, and the assistant is still told who turned it off. Before a file is edited, the Studio asks what the proposal stages now, so a change someone else made to it is edited rather than overwritten.
|
|
11
|
+
- **A change does not wait for the schema to be re-read unless it can change it.** Only a write to a `.val.ts`, `val.modules.ts`, `val.config.ts` or a file they import waits for the Studio to evaluate the Val modules. A component, a stylesheet or a route is answered at once, and several edits in one reply are evaluated together rather than one after another.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`37e4f39`](https://github.com/valbuild/val/commit/37e4f390d1fd6a930488c9487de43f8c1a390122), [`245843e`](https://github.com/valbuild/val/commit/245843ec527212dc31c6e1da1f0bd5f9d99cf8d3), [`d4e514f`](https://github.com/valbuild/val/commit/d4e514f9eac2f014fc07aa768787d637898dc744), [`def1434`](https://github.com/valbuild/val/commit/def1434324a0b3e26202148cb11726e02bd5bffe), [`82c641c`](https://github.com/valbuild/val/commit/82c641ca00ddfe1ed5b07b9ccb5ee39b0c6f102e)]:
|
|
14
|
+
- @valbuild/ui@0.154.1
|
|
15
|
+
- @valbuild/shared@0.154.1
|
|
16
|
+
|
|
17
|
+
## 0.154.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1067](https://github.com/valbuild/val/pull/1067) [`70bd897`](https://github.com/valbuild/val/commit/70bd89741d23f89407ddab56de2a70ad62e79fee) Thanks [@freekh](https://github.com/freekh)! - Two answers from `/api/val/patches` no longer tell the Studio something false when the content service behind it fails part of the way.
|
|
22
|
+
|
|
23
|
+
- **Discarding a change while the content service is down no longer looks like it worked.** If the content service answered with an error or could not be reached, `DELETE /api/val/patches` answered 200 with every patch as deleted. The Studio then forgot changes that still existed: a reload brought them back, and the next publish could ship a change you had discarded. It now answers 502 with the content service's reason, and the Studio keeps the change and says the discard failed.
|
|
24
|
+
- **An edit made while someone else is editing is no longer stuck unsaved.** A batch of edits is saved one patch at a time, so another editor's change can land between two of yours. When it did, the server answered the conflict without saying the first patch had been saved, the Studio sent that patch again, and the content service refused it as one it already had. The save then retried forever and the edit after it was never saved. The conflict now names what was saved, as the other partial failures already did, and the Studio sends only the rest.
|
|
25
|
+
|
|
26
|
+
- [#1068](https://github.com/valbuild/val/pull/1068) [`0b1cbe6`](https://github.com/valbuild/val/commit/0b1cbe6858094b21fa15a8fa9b88d5f4304d68e1) Thanks [@freekh](https://github.com/freekh)! - Saving an edit no longer fails with `Converting circular structure to JSON` when a `.val.ts` file uses object spreads, such as `{ title: "…", ...noMedia, learnMore: null }`.
|
|
27
|
+
|
|
28
|
+
An edit to a key written out after every spread in its object is now saved, and the spread is left as it is. An edit to a key a spread supplies, or one a later spread may override, is refused with a message that names the file, the line and the spread, so you know which value to write out — before, any spread anywhere along the edited path refused the save, and the refusal itself crashed `/save` with a 500.
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`d2956df`](https://github.com/valbuild/val/commit/d2956df9d82f7cba1cd26a754ccbd0fa10a5d641), [`c71a92c`](https://github.com/valbuild/val/commit/c71a92ccc40eed16c9b2669d6b26efee51240eea), [`9ee9bdf`](https://github.com/valbuild/val/commit/9ee9bdf8f1feb57b2ab2f70c82a8c839256f8687), [`af4f6fc`](https://github.com/valbuild/val/commit/af4f6fc2b2f344ca474fc80664365a6fac4325b1), [`70bd897`](https://github.com/valbuild/val/commit/70bd89741d23f89407ddab56de2a70ad62e79fee), [`d85f2d7`](https://github.com/valbuild/val/commit/d85f2d75c3dd2732ad1fb9f0c6c0023f4f5de834), [`7f49d72`](https://github.com/valbuild/val/commit/7f49d72b5d2a447025cfec474ff1d85b21e4333e)]:
|
|
31
|
+
- @valbuild/ui@0.154.0
|
|
32
|
+
- @valbuild/shared@0.154.0
|
|
33
|
+
|
|
3
34
|
## 0.153.6
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-5d0314a3.cjs.dev.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValRouterCore-
|
|
7
|
+
require('../../dist/ValRouterCore-361673dc.cjs.dev.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('zod-validation-error');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../dist/inTabFetch-56226d62.cjs.prod.js');
|
|
6
6
|
require('@valbuild/core');
|
|
7
|
-
require('../../dist/ValRouterCore-
|
|
7
|
+
require('../../dist/ValRouterCore-cfb35067.cjs.prod.js');
|
|
8
8
|
require('zod');
|
|
9
9
|
require('@valbuild/shared/internal');
|
|
10
10
|
require('zod-validation-error');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as createInTabValFetch } from '../../dist/inTabFetch-
|
|
1
|
+
export { c as createInTabValFetch } from '../../dist/inTabFetch-7c8a5628.esm.js';
|
|
2
2
|
import '@valbuild/core';
|
|
3
|
-
import '../../dist/ValRouterCore-
|
|
3
|
+
import '../../dist/ValRouterCore-be314bc7.esm.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '@valbuild/shared/internal';
|
|
6
6
|
import 'zod-validation-error';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@valbuild/core');
|
|
4
4
|
var server = require('@valbuild/ui/server');
|
|
5
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
5
|
+
var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var ts = require('typescript');
|
|
8
8
|
var z = require('zod');
|
|
@@ -135,17 +135,61 @@ function evaluateExpression(value) {
|
|
|
135
135
|
return fp.result.err(new ValSyntaxError("Expression must be a literal", value));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Finds the property `key` is written as in an object literal, for an edit to
|
|
141
|
+
* write into.
|
|
142
|
+
*
|
|
143
|
+
* An object may spread another into itself (`{ ...noMedia, code: null }`): the
|
|
144
|
+
* module evaluates it, so the value reads fine, and an edit to a key written
|
|
145
|
+
* out AFTER every spread can go ahead - that property is the one that wins.
|
|
146
|
+
* What cannot is an edit to a key a spread might supply or override, since we
|
|
147
|
+
* would be writing a value the module does not end up with. Those are
|
|
148
|
+
* refused, naming the spread, so the author knows which line to write out.
|
|
149
|
+
*/
|
|
138
150
|
function findObjectPropertyAssignment(value, key) {
|
|
139
|
-
|
|
151
|
+
const spreads = value.properties.filter(ts__default["default"].isSpreadAssignment);
|
|
152
|
+
return fp.pipe(validateObjectProperties(value.properties.filter(property => !ts__default["default"].isSpreadAssignment(property))), fp.result.flatMap(assignments => {
|
|
140
153
|
const matchingAssignments = assignments.filter(assignment => assignment.name.text === key);
|
|
141
|
-
if (matchingAssignments.length === 0) return fp.result.ok(undefined);
|
|
142
154
|
if (matchingAssignments.length > 1) {
|
|
143
155
|
return fp.result.err(new ValSyntaxError(`Object key "${key}" is ambiguous`, value));
|
|
144
156
|
}
|
|
145
157
|
const [assignment] = matchingAssignments;
|
|
158
|
+
if (assignment === undefined) {
|
|
159
|
+
if (spreads.length > 0) {
|
|
160
|
+
return fp.result.err(new ValSyntaxError(`Cannot edit "${key}": it is not written out in this object, so it may come from ${spreadNames(spreads)}. Write "${key}" out after the spread to make it editable`, spreads[spreads.length - 1]));
|
|
161
|
+
}
|
|
162
|
+
return fp.result.ok(undefined);
|
|
163
|
+
}
|
|
164
|
+
const overriding = spreads.filter(spread => spread.pos > assignment.pos);
|
|
165
|
+
if (overriding.length > 0) {
|
|
166
|
+
return fp.result.err(new ValSyntaxError(`Cannot edit "${key}": ${spreadNames(overriding)} comes after it and may override it. Move "${key}" after the spread to make it editable`, assignment));
|
|
167
|
+
}
|
|
146
168
|
return fp.result.ok(assignment);
|
|
147
169
|
}));
|
|
148
170
|
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Finds the property `key` is written as, for a REMOVE: stricter than
|
|
174
|
+
* {@link findObjectPropertyAssignment}, because removing a key from an object
|
|
175
|
+
* that spreads another into it is refused outright. The key's own property may
|
|
176
|
+
* be all that hides a value the spread supplies, and removing it would bring
|
|
177
|
+
* that value back - and for a `.jsonValues()` entry, delete its file as well.
|
|
178
|
+
*
|
|
179
|
+
* Every remove goes through this, so the two that exist (a value, and a
|
|
180
|
+
* `.jsonValues()` entry) cannot disagree about it.
|
|
181
|
+
*/
|
|
182
|
+
function findObjectPropertyAssignmentToRemove(value, key) {
|
|
183
|
+
const spreads = value.properties.filter(ts__default["default"].isSpreadAssignment);
|
|
184
|
+
if (spreads.length > 0) {
|
|
185
|
+
return fp.result.err(new ValSyntaxError(`Cannot remove "${key}" from an object that spreads another into it: ${spreadNames(spreads)} may have a "${key}" of its own, and removing this one would bring it back`, value));
|
|
186
|
+
}
|
|
187
|
+
return findObjectPropertyAssignment(value, key);
|
|
188
|
+
}
|
|
189
|
+
function spreadNames(spreads) {
|
|
190
|
+
// Not `getText()`: it needs parent pointers, and the parsers here do not set them.
|
|
191
|
+
return spreads.map(spread => ts__default["default"].isIdentifier(spread.expression) ? `"...${spread.expression.text}"` : "a spread").join(", ");
|
|
192
|
+
}
|
|
149
193
|
function validateInitializers(nodes) {
|
|
150
194
|
for (const node of nodes) {
|
|
151
195
|
if (ts__default["default"].isSpreadElement(node)) {
|
|
@@ -277,7 +321,7 @@ function removeValJsonEntry(document, recordPath, key) {
|
|
|
277
321
|
if (!ts__default["default"].isObjectLiteralExpression(recordNode)) {
|
|
278
322
|
return fp.result.err(new patch.PatchError("Cannot remove jsonValues entry: record source is not an object literal"));
|
|
279
323
|
}
|
|
280
|
-
return fp.pipe(
|
|
324
|
+
return fp.pipe(findObjectPropertyAssignmentToRemove(recordNode, key), fp.result.flatMap(assignment => {
|
|
281
325
|
if (!assignment) {
|
|
282
326
|
return fp.result.err(new patch.PatchError(`Cannot remove jsonValues entry '${key}': it does not exist`));
|
|
283
327
|
}
|
|
@@ -492,7 +536,7 @@ function removeFromNode(document, node, key) {
|
|
|
492
536
|
if (ts__default["default"].isArrayLiteralExpression(node)) {
|
|
493
537
|
return fp.pipe(parseAndValidateArrayInboundsIndex(key, node.elements), fp.result.map(index => removeAt(document, node.elements, index)));
|
|
494
538
|
} else if (ts__default["default"].isObjectLiteralExpression(node)) {
|
|
495
|
-
return fp.pipe(
|
|
539
|
+
return fp.pipe(findObjectPropertyAssignmentToRemove(node, key), fp.result.flatMap(assignment => {
|
|
496
540
|
if (!assignment) {
|
|
497
541
|
return fp.result.err(new patch.PatchError("Cannot remove object element which does not exist"));
|
|
498
542
|
}
|
|
@@ -2205,7 +2249,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
|
|
|
2205
2249
|
* as a bundler does.
|
|
2206
2250
|
*/
|
|
2207
2251
|
function loadTypeScriptKit() {
|
|
2208
|
-
return Promise.resolve().then(function () { return require('./publishKit-
|
|
2252
|
+
return Promise.resolve().then(function () { return require('./publishKit-707230bc.cjs.prod.js'); });
|
|
2209
2253
|
}
|
|
2210
2254
|
|
|
2211
2255
|
/** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
|
|
@@ -5020,7 +5064,7 @@ async function stagedModuleSources(files) {
|
|
|
5020
5064
|
parseValFile,
|
|
5021
5065
|
analyzeValModule,
|
|
5022
5066
|
evaluateModuleSource
|
|
5023
|
-
} = await Promise.resolve().then(function () { return require('./publishKit-
|
|
5067
|
+
} = await Promise.resolve().then(function () { return require('./publishKit-707230bc.cjs.prod.js'); });
|
|
5024
5068
|
const sources = {};
|
|
5025
5069
|
for (const {
|
|
5026
5070
|
path,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@valbuild/core');
|
|
4
4
|
var server = require('@valbuild/ui/server');
|
|
5
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
5
|
+
var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var ts = require('typescript');
|
|
8
8
|
var z = require('zod');
|
|
@@ -135,17 +135,61 @@ function evaluateExpression(value) {
|
|
|
135
135
|
return fp.result.err(new ValSyntaxError("Expression must be a literal", value));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Finds the property `key` is written as in an object literal, for an edit to
|
|
141
|
+
* write into.
|
|
142
|
+
*
|
|
143
|
+
* An object may spread another into itself (`{ ...noMedia, code: null }`): the
|
|
144
|
+
* module evaluates it, so the value reads fine, and an edit to a key written
|
|
145
|
+
* out AFTER every spread can go ahead - that property is the one that wins.
|
|
146
|
+
* What cannot is an edit to a key a spread might supply or override, since we
|
|
147
|
+
* would be writing a value the module does not end up with. Those are
|
|
148
|
+
* refused, naming the spread, so the author knows which line to write out.
|
|
149
|
+
*/
|
|
138
150
|
function findObjectPropertyAssignment(value, key) {
|
|
139
|
-
|
|
151
|
+
const spreads = value.properties.filter(ts__default["default"].isSpreadAssignment);
|
|
152
|
+
return fp.pipe(validateObjectProperties(value.properties.filter(property => !ts__default["default"].isSpreadAssignment(property))), fp.result.flatMap(assignments => {
|
|
140
153
|
const matchingAssignments = assignments.filter(assignment => assignment.name.text === key);
|
|
141
|
-
if (matchingAssignments.length === 0) return fp.result.ok(undefined);
|
|
142
154
|
if (matchingAssignments.length > 1) {
|
|
143
155
|
return fp.result.err(new ValSyntaxError(`Object key "${key}" is ambiguous`, value));
|
|
144
156
|
}
|
|
145
157
|
const [assignment] = matchingAssignments;
|
|
158
|
+
if (assignment === undefined) {
|
|
159
|
+
if (spreads.length > 0) {
|
|
160
|
+
return fp.result.err(new ValSyntaxError(`Cannot edit "${key}": it is not written out in this object, so it may come from ${spreadNames(spreads)}. Write "${key}" out after the spread to make it editable`, spreads[spreads.length - 1]));
|
|
161
|
+
}
|
|
162
|
+
return fp.result.ok(undefined);
|
|
163
|
+
}
|
|
164
|
+
const overriding = spreads.filter(spread => spread.pos > assignment.pos);
|
|
165
|
+
if (overriding.length > 0) {
|
|
166
|
+
return fp.result.err(new ValSyntaxError(`Cannot edit "${key}": ${spreadNames(overriding)} comes after it and may override it. Move "${key}" after the spread to make it editable`, assignment));
|
|
167
|
+
}
|
|
146
168
|
return fp.result.ok(assignment);
|
|
147
169
|
}));
|
|
148
170
|
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Finds the property `key` is written as, for a REMOVE: stricter than
|
|
174
|
+
* {@link findObjectPropertyAssignment}, because removing a key from an object
|
|
175
|
+
* that spreads another into it is refused outright. The key's own property may
|
|
176
|
+
* be all that hides a value the spread supplies, and removing it would bring
|
|
177
|
+
* that value back - and for a `.jsonValues()` entry, delete its file as well.
|
|
178
|
+
*
|
|
179
|
+
* Every remove goes through this, so the two that exist (a value, and a
|
|
180
|
+
* `.jsonValues()` entry) cannot disagree about it.
|
|
181
|
+
*/
|
|
182
|
+
function findObjectPropertyAssignmentToRemove(value, key) {
|
|
183
|
+
const spreads = value.properties.filter(ts__default["default"].isSpreadAssignment);
|
|
184
|
+
if (spreads.length > 0) {
|
|
185
|
+
return fp.result.err(new ValSyntaxError(`Cannot remove "${key}" from an object that spreads another into it: ${spreadNames(spreads)} may have a "${key}" of its own, and removing this one would bring it back`, value));
|
|
186
|
+
}
|
|
187
|
+
return findObjectPropertyAssignment(value, key);
|
|
188
|
+
}
|
|
189
|
+
function spreadNames(spreads) {
|
|
190
|
+
// Not `getText()`: it needs parent pointers, and the parsers here do not set them.
|
|
191
|
+
return spreads.map(spread => ts__default["default"].isIdentifier(spread.expression) ? `"...${spread.expression.text}"` : "a spread").join(", ");
|
|
192
|
+
}
|
|
149
193
|
function validateInitializers(nodes) {
|
|
150
194
|
for (const node of nodes) {
|
|
151
195
|
if (ts__default["default"].isSpreadElement(node)) {
|
|
@@ -277,7 +321,7 @@ function removeValJsonEntry(document, recordPath, key) {
|
|
|
277
321
|
if (!ts__default["default"].isObjectLiteralExpression(recordNode)) {
|
|
278
322
|
return fp.result.err(new patch.PatchError("Cannot remove jsonValues entry: record source is not an object literal"));
|
|
279
323
|
}
|
|
280
|
-
return fp.pipe(
|
|
324
|
+
return fp.pipe(findObjectPropertyAssignmentToRemove(recordNode, key), fp.result.flatMap(assignment => {
|
|
281
325
|
if (!assignment) {
|
|
282
326
|
return fp.result.err(new patch.PatchError(`Cannot remove jsonValues entry '${key}': it does not exist`));
|
|
283
327
|
}
|
|
@@ -492,7 +536,7 @@ function removeFromNode(document, node, key) {
|
|
|
492
536
|
if (ts__default["default"].isArrayLiteralExpression(node)) {
|
|
493
537
|
return fp.pipe(parseAndValidateArrayInboundsIndex(key, node.elements), fp.result.map(index => removeAt(document, node.elements, index)));
|
|
494
538
|
} else if (ts__default["default"].isObjectLiteralExpression(node)) {
|
|
495
|
-
return fp.pipe(
|
|
539
|
+
return fp.pipe(findObjectPropertyAssignmentToRemove(node, key), fp.result.flatMap(assignment => {
|
|
496
540
|
if (!assignment) {
|
|
497
541
|
return fp.result.err(new patch.PatchError("Cannot remove object element which does not exist"));
|
|
498
542
|
}
|
|
@@ -2205,7 +2249,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
|
|
|
2205
2249
|
* as a bundler does.
|
|
2206
2250
|
*/
|
|
2207
2251
|
function loadTypeScriptKit() {
|
|
2208
|
-
return Promise.resolve().then(function () { return require('./publishKit-
|
|
2252
|
+
return Promise.resolve().then(function () { return require('./publishKit-5a8c9a0d.cjs.dev.js'); });
|
|
2209
2253
|
}
|
|
2210
2254
|
|
|
2211
2255
|
/** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
|
|
@@ -5020,7 +5064,7 @@ async function stagedModuleSources(files) {
|
|
|
5020
5064
|
parseValFile,
|
|
5021
5065
|
analyzeValModule,
|
|
5022
5066
|
evaluateModuleSource
|
|
5023
|
-
} = await Promise.resolve().then(function () { return require('./publishKit-
|
|
5067
|
+
} = await Promise.resolve().then(function () { return require('./publishKit-5a8c9a0d.cjs.dev.js'); });
|
|
5024
5068
|
const sources = {};
|
|
5025
5069
|
for (const {
|
|
5026
5070
|
path,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Internal, deserializeSchema, DEFAULT_CONTENT_HOST, DEFAULT_VAL_REMOTE_HOST } from '@valbuild/core';
|
|
2
2
|
import { createUIRequestHandler } from '@valbuild/ui/server';
|
|
3
|
-
import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as isSafePatchId, o as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, p as bufferFromDataUrl, q as getFieldsForType, u as uploadRemoteFile, d as getFileExt, t as isPublicFilePath, w as guessMimeTypeFromPath, x as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, y as sessionAuth, z as isHttpOps, A as isHlsMasterPlaylist, B as sumHlsSegmentDurations, C as parseHlsMasterVariants, E as largestHlsVariant, F as fallbackRefOf, G as mapHlsUris, H as movedRemoteHost, J as needsHostCheck, K as rewriteRefHost, L as fallbackRemoteHost, N as checkRemoteFiles, O as ValServer, P as setRequestGuard, Q as parseAllowedHosts, R as createValRequestHandler } from './ValRouterCore-
|
|
3
|
+
import { r as resolveExistingJsonPath, s as summaryOf, m as matchesFilter, h as byUpdatedAt, n as newSketchpad, i as isSketchpadId, j as applySketchpadChange, k as ValOps, V as VAL_CLIENT_HEADERS, l as isSafePatchId, o as isMediaFilePath, M as MEDIA_FILE_PATH_ACCEPTS, p as bufferFromDataUrl, q as getFieldsForType, u as uploadRemoteFile, d as getFileExt, t as isPublicFilePath, w as guessMimeTypeFromPath, x as createMetadataFromBuffer, D as DEFAULT_ANALYTICS_INGEST_URL, e as ValOpsMemory, y as sessionAuth, z as isHttpOps, A as isHlsMasterPlaylist, B as sumHlsSegmentDurations, C as parseHlsMasterVariants, E as largestHlsVariant, F as fallbackRefOf, G as mapHlsUris, H as movedRemoteHost, J as needsHostCheck, K as rewriteRefHost, L as fallbackRemoteHost, N as checkRemoteFiles, O as ValServer, P as setRequestGuard, Q as parseAllowedHosts, R as createValRequestHandler } from './ValRouterCore-be314bc7.esm.js';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import ts from 'typescript';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -101,17 +101,61 @@ function evaluateExpression(value) {
|
|
|
101
101
|
return result.err(new ValSyntaxError("Expression must be a literal", value));
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Finds the property `key` is written as in an object literal, for an edit to
|
|
107
|
+
* write into.
|
|
108
|
+
*
|
|
109
|
+
* An object may spread another into itself (`{ ...noMedia, code: null }`): the
|
|
110
|
+
* module evaluates it, so the value reads fine, and an edit to a key written
|
|
111
|
+
* out AFTER every spread can go ahead - that property is the one that wins.
|
|
112
|
+
* What cannot is an edit to a key a spread might supply or override, since we
|
|
113
|
+
* would be writing a value the module does not end up with. Those are
|
|
114
|
+
* refused, naming the spread, so the author knows which line to write out.
|
|
115
|
+
*/
|
|
104
116
|
function findObjectPropertyAssignment(value, key) {
|
|
105
|
-
|
|
117
|
+
const spreads = value.properties.filter(ts.isSpreadAssignment);
|
|
118
|
+
return pipe(validateObjectProperties(value.properties.filter(property => !ts.isSpreadAssignment(property))), result.flatMap(assignments => {
|
|
106
119
|
const matchingAssignments = assignments.filter(assignment => assignment.name.text === key);
|
|
107
|
-
if (matchingAssignments.length === 0) return result.ok(undefined);
|
|
108
120
|
if (matchingAssignments.length > 1) {
|
|
109
121
|
return result.err(new ValSyntaxError(`Object key "${key}" is ambiguous`, value));
|
|
110
122
|
}
|
|
111
123
|
const [assignment] = matchingAssignments;
|
|
124
|
+
if (assignment === undefined) {
|
|
125
|
+
if (spreads.length > 0) {
|
|
126
|
+
return result.err(new ValSyntaxError(`Cannot edit "${key}": it is not written out in this object, so it may come from ${spreadNames(spreads)}. Write "${key}" out after the spread to make it editable`, spreads[spreads.length - 1]));
|
|
127
|
+
}
|
|
128
|
+
return result.ok(undefined);
|
|
129
|
+
}
|
|
130
|
+
const overriding = spreads.filter(spread => spread.pos > assignment.pos);
|
|
131
|
+
if (overriding.length > 0) {
|
|
132
|
+
return result.err(new ValSyntaxError(`Cannot edit "${key}": ${spreadNames(overriding)} comes after it and may override it. Move "${key}" after the spread to make it editable`, assignment));
|
|
133
|
+
}
|
|
112
134
|
return result.ok(assignment);
|
|
113
135
|
}));
|
|
114
136
|
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Finds the property `key` is written as, for a REMOVE: stricter than
|
|
140
|
+
* {@link findObjectPropertyAssignment}, because removing a key from an object
|
|
141
|
+
* that spreads another into it is refused outright. The key's own property may
|
|
142
|
+
* be all that hides a value the spread supplies, and removing it would bring
|
|
143
|
+
* that value back - and for a `.jsonValues()` entry, delete its file as well.
|
|
144
|
+
*
|
|
145
|
+
* Every remove goes through this, so the two that exist (a value, and a
|
|
146
|
+
* `.jsonValues()` entry) cannot disagree about it.
|
|
147
|
+
*/
|
|
148
|
+
function findObjectPropertyAssignmentToRemove(value, key) {
|
|
149
|
+
const spreads = value.properties.filter(ts.isSpreadAssignment);
|
|
150
|
+
if (spreads.length > 0) {
|
|
151
|
+
return result.err(new ValSyntaxError(`Cannot remove "${key}" from an object that spreads another into it: ${spreadNames(spreads)} may have a "${key}" of its own, and removing this one would bring it back`, value));
|
|
152
|
+
}
|
|
153
|
+
return findObjectPropertyAssignment(value, key);
|
|
154
|
+
}
|
|
155
|
+
function spreadNames(spreads) {
|
|
156
|
+
// Not `getText()`: it needs parent pointers, and the parsers here do not set them.
|
|
157
|
+
return spreads.map(spread => ts.isIdentifier(spread.expression) ? `"...${spread.expression.text}"` : "a spread").join(", ");
|
|
158
|
+
}
|
|
115
159
|
function validateInitializers(nodes) {
|
|
116
160
|
for (const node of nodes) {
|
|
117
161
|
if (ts.isSpreadElement(node)) {
|
|
@@ -243,7 +287,7 @@ function removeValJsonEntry(document, recordPath, key) {
|
|
|
243
287
|
if (!ts.isObjectLiteralExpression(recordNode)) {
|
|
244
288
|
return result.err(new PatchError("Cannot remove jsonValues entry: record source is not an object literal"));
|
|
245
289
|
}
|
|
246
|
-
return pipe(
|
|
290
|
+
return pipe(findObjectPropertyAssignmentToRemove(recordNode, key), result.flatMap(assignment => {
|
|
247
291
|
if (!assignment) {
|
|
248
292
|
return result.err(new PatchError(`Cannot remove jsonValues entry '${key}': it does not exist`));
|
|
249
293
|
}
|
|
@@ -458,7 +502,7 @@ function removeFromNode(document, node, key) {
|
|
|
458
502
|
if (ts.isArrayLiteralExpression(node)) {
|
|
459
503
|
return pipe(parseAndValidateArrayInboundsIndex(key, node.elements), result.map(index => removeAt(document, node.elements, index)));
|
|
460
504
|
} else if (ts.isObjectLiteralExpression(node)) {
|
|
461
|
-
return pipe(
|
|
505
|
+
return pipe(findObjectPropertyAssignmentToRemove(node, key), result.flatMap(assignment => {
|
|
462
506
|
if (!assignment) {
|
|
463
507
|
return result.err(new PatchError("Cannot remove object element which does not exist"));
|
|
464
508
|
}
|
|
@@ -2171,7 +2215,7 @@ function createFsSketchpadStore(rootDir, now = () => new Date()) {
|
|
|
2171
2215
|
* as a bundler does.
|
|
2172
2216
|
*/
|
|
2173
2217
|
function loadTypeScriptKit() {
|
|
2174
|
-
return import('./publishKit-
|
|
2218
|
+
return import('./publishKit-b850045b.esm.js');
|
|
2175
2219
|
}
|
|
2176
2220
|
|
|
2177
2221
|
/** Serializes a schema, or gives up quietly — serialization errors are reported elsewhere. */
|
|
@@ -4986,7 +5030,7 @@ async function stagedModuleSources(files) {
|
|
|
4986
5030
|
parseValFile,
|
|
4987
5031
|
analyzeValModule,
|
|
4988
5032
|
evaluateModuleSource
|
|
4989
|
-
} = await import('./publishKit-
|
|
5033
|
+
} = await import('./publishKit-b850045b.esm.js');
|
|
4990
5034
|
const sources = {};
|
|
4991
5035
|
for (const {
|
|
4992
5036
|
path,
|
|
@@ -4700,17 +4700,24 @@ class ValOps {
|
|
|
4700
4700
|
return fp.result.ok(entries);
|
|
4701
4701
|
};
|
|
4702
4702
|
const collectPatchError = (err, patchId, op) => {
|
|
4703
|
+
/*
|
|
4704
|
+
* A `ValSyntaxError` holds the TypeScript node it is about, and a
|
|
4705
|
+
* node's `parent` points back up the tree: it is a cycle, so it must
|
|
4706
|
+
* never reach `JSON.stringify` - here, in the response, or in the
|
|
4707
|
+
* caller's own logging. Turn it into the message and the place in the
|
|
4708
|
+
* file it was about, which is all anyone downstream can use anyway.
|
|
4709
|
+
*/
|
|
4710
|
+
const reported = err instanceof patch.PatchError ? [err] : flattenSyntaxErrors(err).map(syntaxError => ({
|
|
4711
|
+
message: formatSyntaxErrorAt(path, tsSourceFile, syntaxError),
|
|
4712
|
+
filePath: path
|
|
4713
|
+
}));
|
|
4703
4714
|
core.Internal.log.error("Could not patch", JSON.stringify({
|
|
4704
4715
|
path,
|
|
4705
4716
|
patchId,
|
|
4706
|
-
|
|
4717
|
+
errors: reported.map(formatPatchSourceError),
|
|
4707
4718
|
op
|
|
4708
4719
|
}, null, 2));
|
|
4709
|
-
|
|
4710
|
-
errors.push(...err);
|
|
4711
|
-
} else {
|
|
4712
|
-
errors.push(err);
|
|
4713
|
-
}
|
|
4720
|
+
errors.push(...reported);
|
|
4714
4721
|
};
|
|
4715
4722
|
const appliedPatches = [];
|
|
4716
4723
|
const triedPatches = [];
|
|
@@ -5669,6 +5676,26 @@ function isFileSource(value) {
|
|
|
5669
5676
|
* only wants a sentence reads it the same way.
|
|
5670
5677
|
*/
|
|
5671
5678
|
|
|
5679
|
+
function flattenSyntaxErrors(tree) {
|
|
5680
|
+
return Array.isArray(tree) ? tree.flatMap(flattenSyntaxErrors) : [tree];
|
|
5681
|
+
}
|
|
5682
|
+
|
|
5683
|
+
/**
|
|
5684
|
+
* `formatSyntaxError` without importing `./patch/ts/syntax`, which imports
|
|
5685
|
+
* `typescript` - this file has to bundle for a browser (see demo mode).
|
|
5686
|
+
* The node's own methods are all it needs.
|
|
5687
|
+
*/
|
|
5688
|
+
function formatSyntaxErrorAt(path, sourceFile, error) {
|
|
5689
|
+
if (error.node.pos < 0) {
|
|
5690
|
+
// A node made by a factory has no place in the file.
|
|
5691
|
+
return `${path}: ${error.message}`;
|
|
5692
|
+
}
|
|
5693
|
+
const {
|
|
5694
|
+
line,
|
|
5695
|
+
character
|
|
5696
|
+
} = sourceFile.getLineAndCharacterOfPosition(error.node.getStart(sourceFile));
|
|
5697
|
+
return `${path}:${line + 1}:${character + 1} ${error.message}`;
|
|
5698
|
+
}
|
|
5672
5699
|
function formatPatchSourceError(error) {
|
|
5673
5700
|
if ("message" in error) {
|
|
5674
5701
|
return error.message;
|
|
@@ -6382,7 +6409,7 @@ var packageJson = {
|
|
|
6382
6409
|
],
|
|
6383
6410
|
exports: true
|
|
6384
6411
|
},
|
|
6385
|
-
version: "0.
|
|
6412
|
+
version: "0.154.1",
|
|
6386
6413
|
scripts: {
|
|
6387
6414
|
typecheck: "tsc --noEmit",
|
|
6388
6415
|
test: "jest",
|
|
@@ -7941,8 +7968,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7941
7968
|
}
|
|
7942
7969
|
};
|
|
7943
7970
|
}
|
|
7944
|
-
const saved = await
|
|
7945
|
-
|
|
7971
|
+
const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
|
|
7972
|
+
if ("saved" in saved) {
|
|
7973
|
+
const savedFirst = saved.saved;
|
|
7974
|
+
const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
|
|
7975
|
+
/*
|
|
7976
|
+
* `savedFirst` goes with content's answer: the tab that staged holds
|
|
7977
|
+
* the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
|
|
7978
|
+
* save made here wrote `.val.ts` files it did not write itself.
|
|
7979
|
+
*/
|
|
7980
|
+
return staged.status === 200 && isJsonObject(staged.json) ? {
|
|
7981
|
+
status: 200,
|
|
7982
|
+
json: {
|
|
7983
|
+
...staged.json,
|
|
7984
|
+
savedFirst
|
|
7985
|
+
}
|
|
7986
|
+
} : staged;
|
|
7987
|
+
}
|
|
7988
|
+
return {
|
|
7946
7989
|
status: saved.status,
|
|
7947
7990
|
json: {
|
|
7948
7991
|
message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
|
|
@@ -7958,6 +8001,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7958
8001
|
* `null` when there was nothing to save or it was saved, otherwise why not.
|
|
7959
8002
|
*/
|
|
7960
8003
|
const saveBeforeCode = async (cookies, message) => {
|
|
8004
|
+
const outcome = await saveBeforeCodeOutcome(cookies, message);
|
|
8005
|
+
return "saved" in outcome ? null : outcome;
|
|
8006
|
+
};
|
|
8007
|
+
|
|
8008
|
+
/**
|
|
8009
|
+
* {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
|
|
8010
|
+
* when nothing was pending. What a staging's answer tells the tab
|
|
8011
|
+
* (`savedFirst`), which holds the proposal's files and has to know whether
|
|
8012
|
+
* a save changed a `.val.ts` under them.
|
|
8013
|
+
*/
|
|
8014
|
+
const saveBeforeCodeOutcome = async (cookies, message) => {
|
|
7961
8015
|
const chain = await serverOps.fetchPatches({
|
|
7962
8016
|
excludePatchOps: true
|
|
7963
8017
|
});
|
|
@@ -7968,12 +8022,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7968
8022
|
};
|
|
7969
8023
|
}
|
|
7970
8024
|
const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
|
|
7971
|
-
if (pending.length === 0) return
|
|
8025
|
+
if (pending.length === 0) return {
|
|
8026
|
+
saved: false
|
|
8027
|
+
};
|
|
7972
8028
|
const saved = await saveChanges(cookies, {
|
|
7973
8029
|
patchIds: pending,
|
|
7974
8030
|
message
|
|
7975
8031
|
});
|
|
7976
|
-
if (saved.status === 200) return
|
|
8032
|
+
if (saved.status === 200) return {
|
|
8033
|
+
saved: true
|
|
8034
|
+
};
|
|
7977
8035
|
const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
|
|
7978
8036
|
/*
|
|
7979
8037
|
* Why, in the words of each module that could not be saved: "Failed to
|
|
@@ -9338,11 +9396,19 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9338
9396
|
const createPatchRes = await serverOps.createPatch(patch.path, patch.patch, patch.patchId, parentRef, sessionId, authorId);
|
|
9339
9397
|
if (fp.result.isErr(createPatchRes)) {
|
|
9340
9398
|
if (createPatchRes.error.errorType === "patch-head-conflict") {
|
|
9399
|
+
/*
|
|
9400
|
+
* The patches before this one in the batch ARE saved: each is
|
|
9401
|
+
* its own write, and someone else's can land between two of
|
|
9402
|
+
* ours. Reported as a 200 would report them, so the client does
|
|
9403
|
+
* not send them again -- the content service refuses a patch it
|
|
9404
|
+
* already has.
|
|
9405
|
+
*/
|
|
9341
9406
|
return {
|
|
9342
9407
|
status: 409,
|
|
9343
9408
|
json: {
|
|
9344
9409
|
type: "patch-head-conflict",
|
|
9345
|
-
message: "The change was written against a different starting point than the server has."
|
|
9410
|
+
message: "The change was written against a different starting point than the server has.",
|
|
9411
|
+
...savedSoFar()
|
|
9346
9412
|
}
|
|
9347
9413
|
};
|
|
9348
9414
|
} else if (createPatchRes.error.errorType === "plan-refused") {
|
|
@@ -9507,6 +9573,25 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9507
9573
|
}
|
|
9508
9574
|
const ids = query.id;
|
|
9509
9575
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
9576
|
+
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
9577
|
+
/*
|
|
9578
|
+
* The store failed -- the content service, or in fs mode the patch
|
|
9579
|
+
* store's lock or log -- so nothing is known to be deleted.
|
|
9580
|
+
* Answered as a failure, never as the 200 below: that names every
|
|
9581
|
+
* id as deleted, and the Studio forgets patches that still exist --
|
|
9582
|
+
* a reload brings the change back, and the next publish ships it.
|
|
9583
|
+
*/
|
|
9584
|
+
core.Internal.log.error("Failed to delete patches", deleteRes.error);
|
|
9585
|
+
return {
|
|
9586
|
+
status: 502,
|
|
9587
|
+
json: {
|
|
9588
|
+
message: deleteRes.error.message,
|
|
9589
|
+
...(typeof deleteRes.error.details === "string" ? {
|
|
9590
|
+
details: deleteRes.error.details
|
|
9591
|
+
} : {})
|
|
9592
|
+
}
|
|
9593
|
+
};
|
|
9594
|
+
}
|
|
9510
9595
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
9511
9596
|
core.Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
9512
9597
|
return {
|
|
@@ -11852,6 +11937,9 @@ function sourceFilePatchErrorsOf(json) {
|
|
|
11852
11937
|
}
|
|
11853
11938
|
return messages;
|
|
11854
11939
|
}
|
|
11940
|
+
function isJsonObject(value) {
|
|
11941
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11942
|
+
}
|
|
11855
11943
|
|
|
11856
11944
|
async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
|
|
11857
11945
|
const authHeader = "apiKey" in auth ? {
|
|
@@ -4694,17 +4694,24 @@ class ValOps {
|
|
|
4694
4694
|
return result.ok(entries);
|
|
4695
4695
|
};
|
|
4696
4696
|
const collectPatchError = (err, patchId, op) => {
|
|
4697
|
+
/*
|
|
4698
|
+
* A `ValSyntaxError` holds the TypeScript node it is about, and a
|
|
4699
|
+
* node's `parent` points back up the tree: it is a cycle, so it must
|
|
4700
|
+
* never reach `JSON.stringify` - here, in the response, or in the
|
|
4701
|
+
* caller's own logging. Turn it into the message and the place in the
|
|
4702
|
+
* file it was about, which is all anyone downstream can use anyway.
|
|
4703
|
+
*/
|
|
4704
|
+
const reported = err instanceof PatchError ? [err] : flattenSyntaxErrors(err).map(syntaxError => ({
|
|
4705
|
+
message: formatSyntaxErrorAt(path, tsSourceFile, syntaxError),
|
|
4706
|
+
filePath: path
|
|
4707
|
+
}));
|
|
4697
4708
|
Internal.log.error("Could not patch", JSON.stringify({
|
|
4698
4709
|
path,
|
|
4699
4710
|
patchId,
|
|
4700
|
-
|
|
4711
|
+
errors: reported.map(formatPatchSourceError),
|
|
4701
4712
|
op
|
|
4702
4713
|
}, null, 2));
|
|
4703
|
-
|
|
4704
|
-
errors.push(...err);
|
|
4705
|
-
} else {
|
|
4706
|
-
errors.push(err);
|
|
4707
|
-
}
|
|
4714
|
+
errors.push(...reported);
|
|
4708
4715
|
};
|
|
4709
4716
|
const appliedPatches = [];
|
|
4710
4717
|
const triedPatches = [];
|
|
@@ -5663,6 +5670,26 @@ function isFileSource(value) {
|
|
|
5663
5670
|
* only wants a sentence reads it the same way.
|
|
5664
5671
|
*/
|
|
5665
5672
|
|
|
5673
|
+
function flattenSyntaxErrors(tree) {
|
|
5674
|
+
return Array.isArray(tree) ? tree.flatMap(flattenSyntaxErrors) : [tree];
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5677
|
+
/**
|
|
5678
|
+
* `formatSyntaxError` without importing `./patch/ts/syntax`, which imports
|
|
5679
|
+
* `typescript` - this file has to bundle for a browser (see demo mode).
|
|
5680
|
+
* The node's own methods are all it needs.
|
|
5681
|
+
*/
|
|
5682
|
+
function formatSyntaxErrorAt(path, sourceFile, error) {
|
|
5683
|
+
if (error.node.pos < 0) {
|
|
5684
|
+
// A node made by a factory has no place in the file.
|
|
5685
|
+
return `${path}: ${error.message}`;
|
|
5686
|
+
}
|
|
5687
|
+
const {
|
|
5688
|
+
line,
|
|
5689
|
+
character
|
|
5690
|
+
} = sourceFile.getLineAndCharacterOfPosition(error.node.getStart(sourceFile));
|
|
5691
|
+
return `${path}:${line + 1}:${character + 1} ${error.message}`;
|
|
5692
|
+
}
|
|
5666
5693
|
function formatPatchSourceError(error) {
|
|
5667
5694
|
if ("message" in error) {
|
|
5668
5695
|
return error.message;
|
|
@@ -6376,7 +6403,7 @@ var packageJson = {
|
|
|
6376
6403
|
],
|
|
6377
6404
|
exports: true
|
|
6378
6405
|
},
|
|
6379
|
-
version: "0.
|
|
6406
|
+
version: "0.154.1",
|
|
6380
6407
|
scripts: {
|
|
6381
6408
|
typecheck: "tsc --noEmit",
|
|
6382
6409
|
test: "jest",
|
|
@@ -7935,8 +7962,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7935
7962
|
}
|
|
7936
7963
|
};
|
|
7937
7964
|
}
|
|
7938
|
-
const saved = await
|
|
7939
|
-
|
|
7965
|
+
const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
|
|
7966
|
+
if ("saved" in saved) {
|
|
7967
|
+
const savedFirst = saved.saved;
|
|
7968
|
+
const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
|
|
7969
|
+
/*
|
|
7970
|
+
* `savedFirst` goes with content's answer: the tab that staged holds
|
|
7971
|
+
* the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
|
|
7972
|
+
* save made here wrote `.val.ts` files it did not write itself.
|
|
7973
|
+
*/
|
|
7974
|
+
return staged.status === 200 && isJsonObject(staged.json) ? {
|
|
7975
|
+
status: 200,
|
|
7976
|
+
json: {
|
|
7977
|
+
...staged.json,
|
|
7978
|
+
savedFirst
|
|
7979
|
+
}
|
|
7980
|
+
} : staged;
|
|
7981
|
+
}
|
|
7982
|
+
return {
|
|
7940
7983
|
status: saved.status,
|
|
7941
7984
|
json: {
|
|
7942
7985
|
message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
|
|
@@ -7952,6 +7995,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7952
7995
|
* `null` when there was nothing to save or it was saved, otherwise why not.
|
|
7953
7996
|
*/
|
|
7954
7997
|
const saveBeforeCode = async (cookies, message) => {
|
|
7998
|
+
const outcome = await saveBeforeCodeOutcome(cookies, message);
|
|
7999
|
+
return "saved" in outcome ? null : outcome;
|
|
8000
|
+
};
|
|
8001
|
+
|
|
8002
|
+
/**
|
|
8003
|
+
* {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
|
|
8004
|
+
* when nothing was pending. What a staging's answer tells the tab
|
|
8005
|
+
* (`savedFirst`), which holds the proposal's files and has to know whether
|
|
8006
|
+
* a save changed a `.val.ts` under them.
|
|
8007
|
+
*/
|
|
8008
|
+
const saveBeforeCodeOutcome = async (cookies, message) => {
|
|
7955
8009
|
const chain = await serverOps.fetchPatches({
|
|
7956
8010
|
excludePatchOps: true
|
|
7957
8011
|
});
|
|
@@ -7962,12 +8016,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7962
8016
|
};
|
|
7963
8017
|
}
|
|
7964
8018
|
const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
|
|
7965
|
-
if (pending.length === 0) return
|
|
8019
|
+
if (pending.length === 0) return {
|
|
8020
|
+
saved: false
|
|
8021
|
+
};
|
|
7966
8022
|
const saved = await saveChanges(cookies, {
|
|
7967
8023
|
patchIds: pending,
|
|
7968
8024
|
message
|
|
7969
8025
|
});
|
|
7970
|
-
if (saved.status === 200) return
|
|
8026
|
+
if (saved.status === 200) return {
|
|
8027
|
+
saved: true
|
|
8028
|
+
};
|
|
7971
8029
|
const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
|
|
7972
8030
|
/*
|
|
7973
8031
|
* Why, in the words of each module that could not be saved: "Failed to
|
|
@@ -9332,11 +9390,19 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9332
9390
|
const createPatchRes = await serverOps.createPatch(patch.path, patch.patch, patch.patchId, parentRef, sessionId, authorId);
|
|
9333
9391
|
if (result.isErr(createPatchRes)) {
|
|
9334
9392
|
if (createPatchRes.error.errorType === "patch-head-conflict") {
|
|
9393
|
+
/*
|
|
9394
|
+
* The patches before this one in the batch ARE saved: each is
|
|
9395
|
+
* its own write, and someone else's can land between two of
|
|
9396
|
+
* ours. Reported as a 200 would report them, so the client does
|
|
9397
|
+
* not send them again -- the content service refuses a patch it
|
|
9398
|
+
* already has.
|
|
9399
|
+
*/
|
|
9335
9400
|
return {
|
|
9336
9401
|
status: 409,
|
|
9337
9402
|
json: {
|
|
9338
9403
|
type: "patch-head-conflict",
|
|
9339
|
-
message: "The change was written against a different starting point than the server has."
|
|
9404
|
+
message: "The change was written against a different starting point than the server has.",
|
|
9405
|
+
...savedSoFar()
|
|
9340
9406
|
}
|
|
9341
9407
|
};
|
|
9342
9408
|
} else if (createPatchRes.error.errorType === "plan-refused") {
|
|
@@ -9501,6 +9567,25 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9501
9567
|
}
|
|
9502
9568
|
const ids = query.id;
|
|
9503
9569
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
9570
|
+
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
9571
|
+
/*
|
|
9572
|
+
* The store failed -- the content service, or in fs mode the patch
|
|
9573
|
+
* store's lock or log -- so nothing is known to be deleted.
|
|
9574
|
+
* Answered as a failure, never as the 200 below: that names every
|
|
9575
|
+
* id as deleted, and the Studio forgets patches that still exist --
|
|
9576
|
+
* a reload brings the change back, and the next publish ships it.
|
|
9577
|
+
*/
|
|
9578
|
+
Internal.log.error("Failed to delete patches", deleteRes.error);
|
|
9579
|
+
return {
|
|
9580
|
+
status: 502,
|
|
9581
|
+
json: {
|
|
9582
|
+
message: deleteRes.error.message,
|
|
9583
|
+
...(typeof deleteRes.error.details === "string" ? {
|
|
9584
|
+
details: deleteRes.error.details
|
|
9585
|
+
} : {})
|
|
9586
|
+
}
|
|
9587
|
+
};
|
|
9588
|
+
}
|
|
9504
9589
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
9505
9590
|
Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
9506
9591
|
return {
|
|
@@ -11846,6 +11931,9 @@ function sourceFilePatchErrorsOf(json) {
|
|
|
11846
11931
|
}
|
|
11847
11932
|
return messages;
|
|
11848
11933
|
}
|
|
11934
|
+
function isJsonObject(value) {
|
|
11935
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11936
|
+
}
|
|
11849
11937
|
|
|
11850
11938
|
async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
|
|
11851
11939
|
const authHeader = "apiKey" in auth ? {
|
|
@@ -4700,17 +4700,24 @@ class ValOps {
|
|
|
4700
4700
|
return fp.result.ok(entries);
|
|
4701
4701
|
};
|
|
4702
4702
|
const collectPatchError = (err, patchId, op) => {
|
|
4703
|
+
/*
|
|
4704
|
+
* A `ValSyntaxError` holds the TypeScript node it is about, and a
|
|
4705
|
+
* node's `parent` points back up the tree: it is a cycle, so it must
|
|
4706
|
+
* never reach `JSON.stringify` - here, in the response, or in the
|
|
4707
|
+
* caller's own logging. Turn it into the message and the place in the
|
|
4708
|
+
* file it was about, which is all anyone downstream can use anyway.
|
|
4709
|
+
*/
|
|
4710
|
+
const reported = err instanceof patch.PatchError ? [err] : flattenSyntaxErrors(err).map(syntaxError => ({
|
|
4711
|
+
message: formatSyntaxErrorAt(path, tsSourceFile, syntaxError),
|
|
4712
|
+
filePath: path
|
|
4713
|
+
}));
|
|
4703
4714
|
core.Internal.log.error("Could not patch", JSON.stringify({
|
|
4704
4715
|
path,
|
|
4705
4716
|
patchId,
|
|
4706
|
-
|
|
4717
|
+
errors: reported.map(formatPatchSourceError),
|
|
4707
4718
|
op
|
|
4708
4719
|
}, null, 2));
|
|
4709
|
-
|
|
4710
|
-
errors.push(...err);
|
|
4711
|
-
} else {
|
|
4712
|
-
errors.push(err);
|
|
4713
|
-
}
|
|
4720
|
+
errors.push(...reported);
|
|
4714
4721
|
};
|
|
4715
4722
|
const appliedPatches = [];
|
|
4716
4723
|
const triedPatches = [];
|
|
@@ -5669,6 +5676,26 @@ function isFileSource(value) {
|
|
|
5669
5676
|
* only wants a sentence reads it the same way.
|
|
5670
5677
|
*/
|
|
5671
5678
|
|
|
5679
|
+
function flattenSyntaxErrors(tree) {
|
|
5680
|
+
return Array.isArray(tree) ? tree.flatMap(flattenSyntaxErrors) : [tree];
|
|
5681
|
+
}
|
|
5682
|
+
|
|
5683
|
+
/**
|
|
5684
|
+
* `formatSyntaxError` without importing `./patch/ts/syntax`, which imports
|
|
5685
|
+
* `typescript` - this file has to bundle for a browser (see demo mode).
|
|
5686
|
+
* The node's own methods are all it needs.
|
|
5687
|
+
*/
|
|
5688
|
+
function formatSyntaxErrorAt(path, sourceFile, error) {
|
|
5689
|
+
if (error.node.pos < 0) {
|
|
5690
|
+
// A node made by a factory has no place in the file.
|
|
5691
|
+
return `${path}: ${error.message}`;
|
|
5692
|
+
}
|
|
5693
|
+
const {
|
|
5694
|
+
line,
|
|
5695
|
+
character
|
|
5696
|
+
} = sourceFile.getLineAndCharacterOfPosition(error.node.getStart(sourceFile));
|
|
5697
|
+
return `${path}:${line + 1}:${character + 1} ${error.message}`;
|
|
5698
|
+
}
|
|
5672
5699
|
function formatPatchSourceError(error) {
|
|
5673
5700
|
if ("message" in error) {
|
|
5674
5701
|
return error.message;
|
|
@@ -6382,7 +6409,7 @@ var packageJson = {
|
|
|
6382
6409
|
],
|
|
6383
6410
|
exports: true
|
|
6384
6411
|
},
|
|
6385
|
-
version: "0.
|
|
6412
|
+
version: "0.154.1",
|
|
6386
6413
|
scripts: {
|
|
6387
6414
|
typecheck: "tsc --noEmit",
|
|
6388
6415
|
test: "jest",
|
|
@@ -7941,8 +7968,24 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7941
7968
|
}
|
|
7942
7969
|
};
|
|
7943
7970
|
}
|
|
7944
|
-
const saved = await
|
|
7945
|
-
|
|
7971
|
+
const saved = await saveBeforeCodeOutcome(cookies, "Saved before the code was changed");
|
|
7972
|
+
if ("saved" in saved) {
|
|
7973
|
+
const savedFirst = saved.saved;
|
|
7974
|
+
const staged = await proxyProposalsApi(path, "POST", profileId, JSON.stringify(body ?? {}));
|
|
7975
|
+
/*
|
|
7976
|
+
* `savedFirst` goes with content's answer: the tab that staged holds
|
|
7977
|
+
* the proposal's files (`projectSnapshot.ts` in `@valbuild/ui`), and a
|
|
7978
|
+
* save made here wrote `.val.ts` files it did not write itself.
|
|
7979
|
+
*/
|
|
7980
|
+
return staged.status === 200 && isJsonObject(staged.json) ? {
|
|
7981
|
+
status: 200,
|
|
7982
|
+
json: {
|
|
7983
|
+
...staged.json,
|
|
7984
|
+
savedFirst
|
|
7985
|
+
}
|
|
7986
|
+
} : staged;
|
|
7987
|
+
}
|
|
7988
|
+
return {
|
|
7946
7989
|
status: saved.status,
|
|
7947
7990
|
json: {
|
|
7948
7991
|
message: `The code was not changed, because the changes waiting to be saved could not be saved first: ${saved.message}`,
|
|
@@ -7958,6 +8001,17 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7958
8001
|
* `null` when there was nothing to save or it was saved, otherwise why not.
|
|
7959
8002
|
*/
|
|
7960
8003
|
const saveBeforeCode = async (cookies, message) => {
|
|
8004
|
+
const outcome = await saveBeforeCodeOutcome(cookies, message);
|
|
8005
|
+
return "saved" in outcome ? null : outcome;
|
|
8006
|
+
};
|
|
8007
|
+
|
|
8008
|
+
/**
|
|
8009
|
+
* {@link saveBeforeCode}, saying whether anything was saved: `saved: false`
|
|
8010
|
+
* when nothing was pending. What a staging's answer tells the tab
|
|
8011
|
+
* (`savedFirst`), which holds the proposal's files and has to know whether
|
|
8012
|
+
* a save changed a `.val.ts` under them.
|
|
8013
|
+
*/
|
|
8014
|
+
const saveBeforeCodeOutcome = async (cookies, message) => {
|
|
7961
8015
|
const chain = await serverOps.fetchPatches({
|
|
7962
8016
|
excludePatchOps: true
|
|
7963
8017
|
});
|
|
@@ -7968,12 +8022,16 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7968
8022
|
};
|
|
7969
8023
|
}
|
|
7970
8024
|
const pending = chain.patches.filter(patch => patch.appliedAt === null).map(patch => patch.patchId);
|
|
7971
|
-
if (pending.length === 0) return
|
|
8025
|
+
if (pending.length === 0) return {
|
|
8026
|
+
saved: false
|
|
8027
|
+
};
|
|
7972
8028
|
const saved = await saveChanges(cookies, {
|
|
7973
8029
|
patchIds: pending,
|
|
7974
8030
|
message
|
|
7975
8031
|
});
|
|
7976
|
-
if (saved.status === 200) return
|
|
8032
|
+
if (saved.status === 200) return {
|
|
8033
|
+
saved: true
|
|
8034
|
+
};
|
|
7977
8035
|
const said = "message" in saved.json && typeof saved.json.message === "string" ? saved.json.message : `the save answered ${saved.status}`;
|
|
7978
8036
|
/*
|
|
7979
8037
|
* Why, in the words of each module that could not be saved: "Failed to
|
|
@@ -9338,11 +9396,19 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9338
9396
|
const createPatchRes = await serverOps.createPatch(patch.path, patch.patch, patch.patchId, parentRef, sessionId, authorId);
|
|
9339
9397
|
if (fp.result.isErr(createPatchRes)) {
|
|
9340
9398
|
if (createPatchRes.error.errorType === "patch-head-conflict") {
|
|
9399
|
+
/*
|
|
9400
|
+
* The patches before this one in the batch ARE saved: each is
|
|
9401
|
+
* its own write, and someone else's can land between two of
|
|
9402
|
+
* ours. Reported as a 200 would report them, so the client does
|
|
9403
|
+
* not send them again -- the content service refuses a patch it
|
|
9404
|
+
* already has.
|
|
9405
|
+
*/
|
|
9341
9406
|
return {
|
|
9342
9407
|
status: 409,
|
|
9343
9408
|
json: {
|
|
9344
9409
|
type: "patch-head-conflict",
|
|
9345
|
-
message: "The change was written against a different starting point than the server has."
|
|
9410
|
+
message: "The change was written against a different starting point than the server has.",
|
|
9411
|
+
...savedSoFar()
|
|
9346
9412
|
}
|
|
9347
9413
|
};
|
|
9348
9414
|
} else if (createPatchRes.error.errorType === "plan-refused") {
|
|
@@ -9507,6 +9573,25 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9507
9573
|
}
|
|
9508
9574
|
const ids = query.id;
|
|
9509
9575
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
9576
|
+
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
9577
|
+
/*
|
|
9578
|
+
* The store failed -- the content service, or in fs mode the patch
|
|
9579
|
+
* store's lock or log -- so nothing is known to be deleted.
|
|
9580
|
+
* Answered as a failure, never as the 200 below: that names every
|
|
9581
|
+
* id as deleted, and the Studio forgets patches that still exist --
|
|
9582
|
+
* a reload brings the change back, and the next publish ships it.
|
|
9583
|
+
*/
|
|
9584
|
+
core.Internal.log.error("Failed to delete patches", deleteRes.error);
|
|
9585
|
+
return {
|
|
9586
|
+
status: 502,
|
|
9587
|
+
json: {
|
|
9588
|
+
message: deleteRes.error.message,
|
|
9589
|
+
...(typeof deleteRes.error.details === "string" ? {
|
|
9590
|
+
details: deleteRes.error.details
|
|
9591
|
+
} : {})
|
|
9592
|
+
}
|
|
9593
|
+
};
|
|
9594
|
+
}
|
|
9510
9595
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
9511
9596
|
core.Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
9512
9597
|
return {
|
|
@@ -11852,6 +11937,9 @@ function sourceFilePatchErrorsOf(json) {
|
|
|
11852
11937
|
}
|
|
11853
11938
|
return messages;
|
|
11854
11939
|
}
|
|
11940
|
+
function isJsonObject(value) {
|
|
11941
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11942
|
+
}
|
|
11855
11943
|
|
|
11856
11944
|
async function uploadRemoteFile(contentHost, project, bucket, fileHash, fileExt, fileBuffer, auth) {
|
|
11857
11945
|
const authHeader = "apiKey" in auth ? {
|
|
@@ -36,6 +36,28 @@ export declare function deepValidateExpression(value: ts.Expression): result.Res
|
|
|
36
36
|
* Evaluates the expression as a JSON value
|
|
37
37
|
*/
|
|
38
38
|
export declare function evaluateExpression(value: ts.Expression): result.Result<JSONValue, ValSyntaxErrorTree>;
|
|
39
|
+
/**
|
|
40
|
+
* Finds the property `key` is written as in an object literal, for an edit to
|
|
41
|
+
* write into.
|
|
42
|
+
*
|
|
43
|
+
* An object may spread another into itself (`{ ...noMedia, code: null }`): the
|
|
44
|
+
* module evaluates it, so the value reads fine, and an edit to a key written
|
|
45
|
+
* out AFTER every spread can go ahead - that property is the one that wins.
|
|
46
|
+
* What cannot is an edit to a key a spread might supply or override, since we
|
|
47
|
+
* would be writing a value the module does not end up with. Those are
|
|
48
|
+
* refused, naming the spread, so the author knows which line to write out.
|
|
49
|
+
*/
|
|
39
50
|
export declare function findObjectPropertyAssignment(value: ts.ObjectLiteralExpression, key: string): result.Result<LiteralPropertyAssignment | undefined, ValSyntaxErrorTree>;
|
|
51
|
+
/**
|
|
52
|
+
* Finds the property `key` is written as, for a REMOVE: stricter than
|
|
53
|
+
* {@link findObjectPropertyAssignment}, because removing a key from an object
|
|
54
|
+
* that spreads another into it is refused outright. The key's own property may
|
|
55
|
+
* be all that hides a value the spread supplies, and removing it would bring
|
|
56
|
+
* that value back - and for a `.jsonValues()` entry, delete its file as well.
|
|
57
|
+
*
|
|
58
|
+
* Every remove goes through this, so the two that exist (a value, and a
|
|
59
|
+
* `.jsonValues()` entry) cannot disagree about it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function findObjectPropertyAssignmentToRemove(value: ts.ObjectLiteralExpression, key: string): result.Result<LiteralPropertyAssignment | undefined, ValSyntaxErrorTree>;
|
|
40
62
|
export declare function validateInitializers(nodes: ReadonlyArray<ts.Expression>): ValSyntaxErrorTree | undefined;
|
|
41
63
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@valbuild/core');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
|
|
5
5
|
|
|
6
6
|
const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@valbuild/core');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
|
|
5
5
|
|
|
6
6
|
const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CONTENT_HOST } from '@valbuild/core';
|
|
2
|
-
import { e as ValOpsMemory, S as bytesToBase64, O as ValServer, R as createValRequestHandler } from './ValRouterCore-
|
|
2
|
+
import { e as ValOpsMemory, S as bytesToBase64, O as ValServer, R as createValRequestHandler } from './ValRouterCore-be314bc7.esm.js';
|
|
3
3
|
|
|
4
4
|
const NO_SESSIONS = "Val: sessions are not available here -- this server runs in the browser, " + "has no secret to sign them with, and serves without authenticating.";
|
|
5
5
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
4
|
var fp = require('@valbuild/core/fp');
|
|
5
|
-
var ValRouter = require('./ValRouter-
|
|
6
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
5
|
+
var ValRouter = require('./ValRouter-9505c550.cjs.dev.js');
|
|
6
|
+
var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
8
|
require('@valbuild/ui/server');
|
|
9
9
|
require('path');
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
4
|
var fp = require('@valbuild/core/fp');
|
|
5
|
-
var ValRouter = require('./ValRouter-
|
|
6
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
5
|
+
var ValRouter = require('./ValRouter-31f89baf.cjs.prod.js');
|
|
6
|
+
var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
8
|
require('@valbuild/ui/server');
|
|
9
9
|
require('path');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { result, pipe } from '@valbuild/core/fp';
|
|
3
|
-
import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-
|
|
4
|
-
export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-
|
|
5
|
-
import { Y as bytesToUtf8, Z as posixPath } from './ValRouterCore-
|
|
3
|
+
import { a as analyzeValModule, c as analyzeJsonValuesEntries, T as TSOps } from './ValRouter-b7dc784d.esm.js';
|
|
4
|
+
export { c as analyzeJsonValuesEntries, a as analyzeValModule, a8 as evaluateModuleSource, i as insertValJsonEntry, a9 as jsonValuesRecordKeys, r as removeValJsonEntry } from './ValRouter-b7dc784d.esm.js';
|
|
5
|
+
import { Y as bytesToUtf8, Z as posixPath } from './ValRouterCore-be314bc7.esm.js';
|
|
6
6
|
import '@valbuild/core';
|
|
7
7
|
import '@valbuild/ui/server';
|
|
8
8
|
import 'path';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ValRouter = require('./ValRouter-
|
|
5
|
+
var ValRouter = require('./ValRouter-9505c550.cjs.dev.js');
|
|
6
6
|
var patch = require('@valbuild/core/patch');
|
|
7
7
|
var fp = require('@valbuild/core/fp');
|
|
8
8
|
var core = require('@valbuild/core');
|
|
@@ -11,7 +11,7 @@ var path = require('path');
|
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var vm = require('node:vm');
|
|
13
13
|
var node_module = require('node:module');
|
|
14
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
14
|
+
var ValRouterCore = require('./ValRouterCore-361673dc.cjs.dev.js');
|
|
15
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
16
|
var sucrase = require('sucrase');
|
|
17
17
|
var fs$1 = require('fs/promises');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ValRouter = require('./ValRouter-
|
|
5
|
+
var ValRouter = require('./ValRouter-31f89baf.cjs.prod.js');
|
|
6
6
|
var patch = require('@valbuild/core/patch');
|
|
7
7
|
var fp = require('@valbuild/core/fp');
|
|
8
8
|
var core = require('@valbuild/core');
|
|
@@ -11,7 +11,7 @@ var path = require('path');
|
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var vm = require('node:vm');
|
|
13
13
|
var node_module = require('node:module');
|
|
14
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
14
|
+
var ValRouterCore = require('./ValRouterCore-cfb35067.cjs.prod.js');
|
|
15
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
16
|
var sucrase = require('sucrase');
|
|
17
17
|
var fs$1 = require('fs/promises');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-
|
|
2
|
-
export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-
|
|
1
|
+
import { T as TSOps, a as analyzeValModule, f as flatMapErrors, b as formatSyntaxError, c as analyzeJsonValuesEntries, r as removeValJsonEntry, i as insertValJsonEntry, d as collectionReferencePatches, e as checkGalleryFiles, h as handleVideoUploadRemote, g as handleVideoDownloadRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, l as handleVideosetCheckRemote, m as handleVideosetCheckAllFiles, n as canReadVideoMetadata, u as unreadableVideoMetadataMessage, o as localFilesWarning, p as openRemoteUploadSession, q as uploadBytesToRemote, s as getPersonalAccessTokenPath, V as ValOpsFS } from './ValRouter-b7dc784d.esm.js';
|
|
2
|
+
export { F as APP_MODE_REQUIRES_REMOTE_FILES, V as ValOpsFS, X as ValOpsHttp, a as analyzeValModule, R as checkRemoteRef, x as contentFromEnv, H as createFixPatch, t as createValApiRouter, D as createValOps, v as createValServer, a0 as decodeJwtWithoutVerifying, _ as describePatchStoreProblems, S as downloadFileFromRemote, a2 as encodeJwt, M as extractFileMetadata, L as extractImageMetadata, N as extractVideoMetadata, O as extractVideoMetadataFromFile, P as filesOfVideo, J as filesOfVideosetEntry, G as formatSyntaxErrorTree, U as getCachedRemoteFileDir, W as getCachedRemoteFilePath, a1 as getExpire, s as getPersonalAccessTokenPath, Q as getValidationErrorFileRef, m as handleVideosetCheckAllFiles, l as handleVideosetCheckRemote, j as handleVideosetMetadata, k as handleVideosetUploadRemote, C as initHandlerOptions, z as layeredSnapshot, Y as loadTypeScriptKit, K as parsePersonalAccessTokenFile, y as proposalFromEnv, A as proposalSnapshot, B as proposalSnapshotForReaders, Z as readPatchStore, E as resolveRemoteFileAuth, w as safeReadGit, $ as verifyJwt, I as videosetEntryVideoSchema } from './ValRouter-b7dc784d.esm.js';
|
|
3
3
|
import { applyPatch, PatchError, JSONOps, deepClone } from '@valbuild/core/patch';
|
|
4
4
|
import { pipe, result } from '@valbuild/core/fp';
|
|
5
5
|
import { derefPatch, Internal, extractValModules, DEFAULT_CONTENT_HOST } from '@valbuild/core';
|
|
@@ -9,8 +9,8 @@ import path from 'path';
|
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import vm from 'node:vm';
|
|
11
11
|
import { Module } from 'node:module';
|
|
12
|
-
import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-
|
|
13
|
-
export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-
|
|
12
|
+
import { r as resolveExistingJsonPath, f as findNestedJsonValuesRecords, v as validateJsonValuesEntries, g as getNewJsonEntryPaths, a as formatPatchSourceError, V as VAL_CLIENT_HEADERS } from './ValRouterCore-be314bc7.esm.js';
|
|
13
|
+
export { I as InMemoryPatchStore, e as ValOpsMemory, b as askOncePerHost, a as formatPatchSourceError, d as getFileExt, c as getSettings, u as uploadRemoteFile } from './ValRouterCore-be314bc7.esm.js';
|
|
14
14
|
import { isJsonValuesRootOp, rebaseContentOp, classifyJsonValuesOp, richTextImageSchema } from '@valbuild/shared/internal';
|
|
15
15
|
export { classifyJsonValuesOp, rebaseContentOp } from '@valbuild/shared/internal';
|
|
16
16
|
import { transform } from 'sucrase';
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../../dist/inTabFetch-5d0314a3.cjs.dev.js');
|
|
6
6
|
var draftReads = require('../../../dist/draftReads-df44e629.cjs.dev.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
|
-
require('../../../dist/ValRouterCore-
|
|
8
|
+
require('../../../dist/ValRouterCore-361673dc.cjs.dev.js');
|
|
9
9
|
require('zod');
|
|
10
10
|
require('@valbuild/shared/internal');
|
|
11
11
|
require('zod-validation-error');
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var inTabFetch = require('../../../dist/inTabFetch-
|
|
5
|
+
var inTabFetch = require('../../../dist/inTabFetch-56226d62.cjs.prod.js');
|
|
6
6
|
var draftReads = require('../../../dist/draftReads-0dcddf72.cjs.prod.js');
|
|
7
7
|
require('@valbuild/core');
|
|
8
|
-
require('../../../dist/ValRouterCore-
|
|
8
|
+
require('../../../dist/ValRouterCore-cfb35067.cjs.prod.js');
|
|
9
9
|
require('zod');
|
|
10
10
|
require('@valbuild/shared/internal');
|
|
11
11
|
require('zod-validation-error');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as createInTabVal } from '../../../dist/inTabFetch-
|
|
1
|
+
export { a as createInTabVal } from '../../../dist/inTabFetch-7c8a5628.esm.js';
|
|
2
2
|
export { s as serverDraftSource } from '../../../dist/draftReads-1f29aedd.esm.js';
|
|
3
3
|
import '@valbuild/core';
|
|
4
|
-
import '../../../dist/ValRouterCore-
|
|
4
|
+
import '../../../dist/ValRouterCore-be314bc7.esm.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '@valbuild/shared/internal';
|
|
7
7
|
import 'zod-validation-error';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ValRouter = require('../../dist/ValRouter-
|
|
5
|
+
var ValRouter = require('../../dist/ValRouter-9505c550.cjs.dev.js');
|
|
6
6
|
var draftReads = require('../../dist/draftReads-df44e629.cjs.dev.js');
|
|
7
|
-
var ValRouterCore = require('../../dist/ValRouterCore-
|
|
7
|
+
var ValRouterCore = require('../../dist/ValRouterCore-361673dc.cjs.dev.js');
|
|
8
8
|
require('@valbuild/core');
|
|
9
9
|
require('@valbuild/ui/server');
|
|
10
10
|
require('path');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ValRouter = require('../../dist/ValRouter-
|
|
5
|
+
var ValRouter = require('../../dist/ValRouter-31f89baf.cjs.prod.js');
|
|
6
6
|
var draftReads = require('../../dist/draftReads-0dcddf72.cjs.prod.js');
|
|
7
|
-
var ValRouterCore = require('../../dist/ValRouterCore-
|
|
7
|
+
var ValRouterCore = require('../../dist/ValRouterCore-cfb35067.cjs.prod.js');
|
|
8
8
|
require('@valbuild/core');
|
|
9
9
|
require('@valbuild/ui/server');
|
|
10
10
|
require('path');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-
|
|
1
|
+
export { a3 as createValRuntime, a4 as proposalAsBuilt, a5 as servingBuildOf, a6 as stagedAfterBuild, a7 as valRuntime } from '../../dist/ValRouter-b7dc784d.esm.js';
|
|
2
2
|
export { d as draftForRequest, r as readDraftChanges, s as serverDraftSource } from '../../dist/draftReads-1f29aedd.esm.js';
|
|
3
|
-
export { W as HEAD_BUDGET_BYTES, X as HEAD_VERSIONS_PER_MODULE, T as ValHead, U as headWork } from '../../dist/ValRouterCore-
|
|
3
|
+
export { W as HEAD_BUDGET_BYTES, X as HEAD_VERSIONS_PER_MODULE, T as ValHead, U as headWork } from '../../dist/ValRouterCore-be314bc7.esm.js';
|
|
4
4
|
import '@valbuild/core';
|
|
5
5
|
import '@valbuild/ui/server';
|
|
6
6
|
import 'path';
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"exports": true
|
|
39
39
|
},
|
|
40
|
-
"version": "0.
|
|
40
|
+
"version": "0.154.1",
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@prettier/sync": "^0.6.1",
|
|
43
43
|
"@types/jest": "^30.0.0",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
52
|
"zod": "^4.6.6",
|
|
53
53
|
"zod-validation-error": "^5.0.0",
|
|
54
|
-
"@valbuild/shared": "0.
|
|
55
|
-
"@valbuild/
|
|
56
|
-
"@valbuild/
|
|
54
|
+
"@valbuild/shared": "0.154.1",
|
|
55
|
+
"@valbuild/ui": "0.154.1",
|
|
56
|
+
"@valbuild/core": "0.153.5"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": "^20.19.0 || >=22"
|