@valbuild/server 0.144.7 → 0.144.9

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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @valbuild/server
2
2
 
3
+ ## 0.144.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#846](https://github.com/valbuild/val/pull/846) [`c44b561`](https://github.com/valbuild/val/commit/c44b5611cf9e557b6b744704703dbff0cb8b23b0) Thanks [@freekh](https://github.com/freekh)! - History is shown for projects hosted by Val Build and inside a proposal, where it lists the proposal's own saves. On the site of a project with proposals, a restore — one field, one module, or "Put everything back" — opens a new proposal with the restored values in it, so it is reviewed there before it is published.
8
+
9
+ History also reads a hosted project's first commit, which has no parent: "Go back to this point" failed on it.
10
+
11
+ "Go back to this point" on the site brings back the code as well as the content: the proposal it opens stages the files of the build the site served then, and serves that build at once.
12
+
13
+ - Updated dependencies [[`c44b561`](https://github.com/valbuild/val/commit/c44b5611cf9e557b6b744704703dbff0cb8b23b0), [`a2125af`](https://github.com/valbuild/val/commit/a2125af79d2b2401c40bce3d8fcf0431bb101cbf)]:
14
+ - @valbuild/ui@0.144.9
15
+ - @valbuild/shared@0.144.9
16
+
17
+ ## 0.144.8
18
+
19
+ ### Patch Changes
20
+
21
+ - [#844](https://github.com/valbuild/val/pull/844) [`b67c03e`](https://github.com/valbuild/val/commit/b67c03ee1876803c31098098ae0becf3f4ad6ade) Thanks [@freekh](https://github.com/freekh)! - Publishing a proposal now says what blocks it, and what to do about it:
22
+
23
+ - When the site's code changed after a proposal with code changes started, the Publish dialog offers **Update from the site**. It moves the proposal onto the site as it is now, and its code then needs building again ("Build required").
24
+ - When someone published changes to the same page since the proposal started, the dialog names the fields each side changed.
25
+
26
+ - Updated dependencies [[`6fd8f79`](https://github.com/valbuild/val/commit/6fd8f791a83d37f95dc3ae12bd8025ccf81e4a7c), [`b67c03e`](https://github.com/valbuild/val/commit/b67c03ee1876803c31098098ae0becf3f4ad6ade)]:
27
+ - @valbuild/ui@0.144.8
28
+
3
29
  ## 0.144.7
4
30
 
5
31
  ### Patch Changes
@@ -294,8 +294,9 @@ export declare class ValOpsHttp extends ValOps {
294
294
  */
295
295
  private static proposalsApiAllowed;
296
296
  /**
297
- * A write to a proposal's FILES -- staging code, or serving a build of it
298
- * (valbuild/home `docs/hosted-publishing.md`, step 7) -- is made by the
297
+ * A write to a proposal's FILES -- staging code, serving a build of it
298
+ * (valbuild/home `docs/hosted-publishing.md`, step 7), or moving it onto the
299
+ * site's code (step 8, "Update from the site") -- is made by the
299
300
  * proposal's own server and nobody else's: the file tools act on the
300
301
  * proposal the Studio is open in (P11), and the site's files change only
301
302
  * when a proposal is merged. The proposal it names, or `null` when this
@@ -2751,6 +2751,21 @@ function withResolvedProject(config, project) {
2751
2751
  };
2752
2752
  }
2753
2753
 
2754
+ /**
2755
+ * The branch History lists, or `null` where there is none to list.
2756
+ *
2757
+ * Not `config.gitBranch` alone, which is the git mirror's and absent for a
2758
+ * managed project -- whose history content holds all the same, under the
2759
+ * branch it reports for the project. In a proposal it is the proposal's, so
2760
+ * its History is its own saves (valbuild/home `docs/hosted-publishing.md`,
2761
+ * step 9). Never in `fs` mode, where `ValOpsFS` has no commits to list.
2762
+ */
2763
+ function historyBranchOf(input) {
2764
+ var _input$proposal;
2765
+ if (input.mode !== "http") return null;
2766
+ return ((_input$proposal = input.proposal) === null || _input$proposal === void 0 ? void 0 : _input$proposal.branch) ?? input.gitBranch ?? input.projectBranch;
2767
+ }
2768
+
2754
2769
  /**
2755
2770
  * Which IP addresses this server may open a connection to.
2756
2771
  *
@@ -9615,7 +9630,8 @@ const CommitPatchesResponse = z.z.object({
9615
9630
  */
9616
9631
  const CommitModulesResponse = z.z.object({
9617
9632
  commitSha: z.z.string(),
9618
- parentCommitSha: z.z.string(),
9633
+ // Null for a project's first commit: a hosted one's first publish has none.
9634
+ parentCommitSha: z.z.string().nullable(),
9619
9635
  /**
9620
9636
  * Whether an `asOf` read covered the whole project.
9621
9637
  *
@@ -10130,12 +10146,13 @@ class ValOpsHttp extends ValOps {
10130
10146
  const one = /^\/[0-9a-f]{20}$/.test(path);
10131
10147
  if (one) return method === "GET" || method === "PATCH";
10132
10148
  if (method === "GET") return /^\/[0-9a-f]{20}\/(merge-checks|files)$/.test(path);
10133
- return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build)$/.test(path);
10149
+ return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build|update-from-site|restore-code)$/.test(path);
10134
10150
  }
10135
10151
 
10136
10152
  /**
10137
- * A write to a proposal's FILES -- staging code, or serving a build of it
10138
- * (valbuild/home `docs/hosted-publishing.md`, step 7) -- is made by the
10153
+ * A write to a proposal's FILES -- staging code, serving a build of it
10154
+ * (valbuild/home `docs/hosted-publishing.md`, step 7), or moving it onto the
10155
+ * site's code (step 8, "Update from the site") -- is made by the
10139
10156
  * proposal's own server and nobody else's: the file tools act on the
10140
10157
  * proposal the Studio is open in (P11), and the site's files change only
10141
10158
  * when a proposal is merged. The proposal it names, or `null` when this
@@ -10144,7 +10161,7 @@ class ValOpsHttp extends ValOps {
10144
10161
  static proposalFilesWrite(method, path) {
10145
10162
  var _exec;
10146
10163
  if (method !== "POST") return null;
10147
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10164
+ return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site|restore-code)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10148
10165
  }
10149
10166
 
10150
10167
  /**
@@ -14958,6 +14975,13 @@ const ValServer = (valModules, options, callbacks) => {
14958
14975
  const sourceMode = serverOps.sourceMode();
14959
14976
  // Spread like the two above: absent is "on the site".
14960
14977
  const proposal = serverOps.currentProposal();
14978
+ const config = clientConfig(options);
14979
+ const historyBranch = historyBranchOf({
14980
+ mode,
14981
+ proposal,
14982
+ gitBranch: config.gitBranch ?? null,
14983
+ projectBranch: serverOps.projectBranch()
14984
+ });
14961
14985
  return {
14962
14986
  status: 200,
14963
14987
  json: {
@@ -14976,10 +15000,13 @@ const ValServer = (valModules, options, callbacks) => {
14976
15000
  ...(proposal ? {
14977
15001
  proposal
14978
15002
  } : {}),
15003
+ ...(historyBranch ? {
15004
+ historyBranch
15005
+ } : {}),
14979
15006
  // Not `options.config` verbatim: in proxy mode the branch the
14980
15007
  // server resolved is filled in where the file did not name one.
14981
15008
  // See `clientConfig`.
14982
- config: clientConfig(options)
15009
+ config
14983
15010
  }
14984
15011
  };
14985
15012
  }
@@ -2751,6 +2751,21 @@ function withResolvedProject(config, project) {
2751
2751
  };
2752
2752
  }
2753
2753
 
2754
+ /**
2755
+ * The branch History lists, or `null` where there is none to list.
2756
+ *
2757
+ * Not `config.gitBranch` alone, which is the git mirror's and absent for a
2758
+ * managed project -- whose history content holds all the same, under the
2759
+ * branch it reports for the project. In a proposal it is the proposal's, so
2760
+ * its History is its own saves (valbuild/home `docs/hosted-publishing.md`,
2761
+ * step 9). Never in `fs` mode, where `ValOpsFS` has no commits to list.
2762
+ */
2763
+ function historyBranchOf(input) {
2764
+ var _input$proposal;
2765
+ if (input.mode !== "http") return null;
2766
+ return ((_input$proposal = input.proposal) === null || _input$proposal === void 0 ? void 0 : _input$proposal.branch) ?? input.gitBranch ?? input.projectBranch;
2767
+ }
2768
+
2754
2769
  /**
2755
2770
  * Which IP addresses this server may open a connection to.
2756
2771
  *
@@ -9615,7 +9630,8 @@ const CommitPatchesResponse = z.z.object({
9615
9630
  */
9616
9631
  const CommitModulesResponse = z.z.object({
9617
9632
  commitSha: z.z.string(),
9618
- parentCommitSha: z.z.string(),
9633
+ // Null for a project's first commit: a hosted one's first publish has none.
9634
+ parentCommitSha: z.z.string().nullable(),
9619
9635
  /**
9620
9636
  * Whether an `asOf` read covered the whole project.
9621
9637
  *
@@ -10130,12 +10146,13 @@ class ValOpsHttp extends ValOps {
10130
10146
  const one = /^\/[0-9a-f]{20}$/.test(path);
10131
10147
  if (one) return method === "GET" || method === "PATCH";
10132
10148
  if (method === "GET") return /^\/[0-9a-f]{20}\/(merge-checks|files)$/.test(path);
10133
- return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build)$/.test(path);
10149
+ return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build|update-from-site|restore-code)$/.test(path);
10134
10150
  }
10135
10151
 
10136
10152
  /**
10137
- * A write to a proposal's FILES -- staging code, or serving a build of it
10138
- * (valbuild/home `docs/hosted-publishing.md`, step 7) -- is made by the
10153
+ * A write to a proposal's FILES -- staging code, serving a build of it
10154
+ * (valbuild/home `docs/hosted-publishing.md`, step 7), or moving it onto the
10155
+ * site's code (step 8, "Update from the site") -- is made by the
10139
10156
  * proposal's own server and nobody else's: the file tools act on the
10140
10157
  * proposal the Studio is open in (P11), and the site's files change only
10141
10158
  * when a proposal is merged. The proposal it names, or `null` when this
@@ -10144,7 +10161,7 @@ class ValOpsHttp extends ValOps {
10144
10161
  static proposalFilesWrite(method, path) {
10145
10162
  var _exec;
10146
10163
  if (method !== "POST") return null;
10147
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10164
+ return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site|restore-code)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10148
10165
  }
10149
10166
 
10150
10167
  /**
@@ -14958,6 +14975,13 @@ const ValServer = (valModules, options, callbacks) => {
14958
14975
  const sourceMode = serverOps.sourceMode();
14959
14976
  // Spread like the two above: absent is "on the site".
14960
14977
  const proposal = serverOps.currentProposal();
14978
+ const config = clientConfig(options);
14979
+ const historyBranch = historyBranchOf({
14980
+ mode,
14981
+ proposal,
14982
+ gitBranch: config.gitBranch ?? null,
14983
+ projectBranch: serverOps.projectBranch()
14984
+ });
14961
14985
  return {
14962
14986
  status: 200,
14963
14987
  json: {
@@ -14976,10 +15000,13 @@ const ValServer = (valModules, options, callbacks) => {
14976
15000
  ...(proposal ? {
14977
15001
  proposal
14978
15002
  } : {}),
15003
+ ...(historyBranch ? {
15004
+ historyBranch
15005
+ } : {}),
14979
15006
  // Not `options.config` verbatim: in proxy mode the branch the
14980
15007
  // server resolved is filled in where the file did not name one.
14981
15008
  // See `clientConfig`.
14982
- config: clientConfig(options)
15009
+ config
14983
15010
  }
14984
15011
  };
14985
15012
  }
@@ -2714,6 +2714,21 @@ function withResolvedProject(config, project) {
2714
2714
  };
2715
2715
  }
2716
2716
 
2717
+ /**
2718
+ * The branch History lists, or `null` where there is none to list.
2719
+ *
2720
+ * Not `config.gitBranch` alone, which is the git mirror's and absent for a
2721
+ * managed project -- whose history content holds all the same, under the
2722
+ * branch it reports for the project. In a proposal it is the proposal's, so
2723
+ * its History is its own saves (valbuild/home `docs/hosted-publishing.md`,
2724
+ * step 9). Never in `fs` mode, where `ValOpsFS` has no commits to list.
2725
+ */
2726
+ function historyBranchOf(input) {
2727
+ var _input$proposal;
2728
+ if (input.mode !== "http") return null;
2729
+ return ((_input$proposal = input.proposal) === null || _input$proposal === void 0 ? void 0 : _input$proposal.branch) ?? input.gitBranch ?? input.projectBranch;
2730
+ }
2731
+
2717
2732
  /**
2718
2733
  * Which IP addresses this server may open a connection to.
2719
2734
  *
@@ -9578,7 +9593,8 @@ const CommitPatchesResponse = z.object({
9578
9593
  */
9579
9594
  const CommitModulesResponse = z.object({
9580
9595
  commitSha: z.string(),
9581
- parentCommitSha: z.string(),
9596
+ // Null for a project's first commit: a hosted one's first publish has none.
9597
+ parentCommitSha: z.string().nullable(),
9582
9598
  /**
9583
9599
  * Whether an `asOf` read covered the whole project.
9584
9600
  *
@@ -10093,12 +10109,13 @@ class ValOpsHttp extends ValOps {
10093
10109
  const one = /^\/[0-9a-f]{20}$/.test(path);
10094
10110
  if (one) return method === "GET" || method === "PATCH";
10095
10111
  if (method === "GET") return /^\/[0-9a-f]{20}\/(merge-checks|files)$/.test(path);
10096
- return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build)$/.test(path);
10112
+ return method === "POST" && /^\/[0-9a-f]{20}\/(close|reopen|setup\/retry|merge|files|build|update-from-site|restore-code)$/.test(path);
10097
10113
  }
10098
10114
 
10099
10115
  /**
10100
- * A write to a proposal's FILES -- staging code, or serving a build of it
10101
- * (valbuild/home `docs/hosted-publishing.md`, step 7) -- is made by the
10116
+ * A write to a proposal's FILES -- staging code, serving a build of it
10117
+ * (valbuild/home `docs/hosted-publishing.md`, step 7), or moving it onto the
10118
+ * site's code (step 8, "Update from the site") -- is made by the
10102
10119
  * proposal's own server and nobody else's: the file tools act on the
10103
10120
  * proposal the Studio is open in (P11), and the site's files change only
10104
10121
  * when a proposal is merged. The proposal it names, or `null` when this
@@ -10107,7 +10124,7 @@ class ValOpsHttp extends ValOps {
10107
10124
  static proposalFilesWrite(method, path) {
10108
10125
  var _exec;
10109
10126
  if (method !== "POST") return null;
10110
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10127
+ return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site|restore-code)$/.exec(path)) === null || _exec === void 0 ? void 0 : _exec[1]) ?? null;
10111
10128
  }
10112
10129
 
10113
10130
  /**
@@ -14921,6 +14938,13 @@ const ValServer = (valModules, options, callbacks) => {
14921
14938
  const sourceMode = serverOps.sourceMode();
14922
14939
  // Spread like the two above: absent is "on the site".
14923
14940
  const proposal = serverOps.currentProposal();
14941
+ const config = clientConfig(options);
14942
+ const historyBranch = historyBranchOf({
14943
+ mode,
14944
+ proposal,
14945
+ gitBranch: config.gitBranch ?? null,
14946
+ projectBranch: serverOps.projectBranch()
14947
+ });
14924
14948
  return {
14925
14949
  status: 200,
14926
14950
  json: {
@@ -14939,10 +14963,13 @@ const ValServer = (valModules, options, callbacks) => {
14939
14963
  ...(proposal ? {
14940
14964
  proposal
14941
14965
  } : {}),
14966
+ ...(historyBranch ? {
14967
+ historyBranch
14968
+ } : {}),
14942
14969
  // Not `options.config` verbatim: in proxy mode the branch the
14943
14970
  // server resolved is filled in where the file did not name one.
14944
14971
  // See `clientConfig`.
14945
- config: clientConfig(options)
14972
+ config
14946
14973
  }
14947
14974
  };
14948
14975
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "types": "dist/valbuild-server.cjs.d.ts",
19
- "version": "0.144.7",
19
+ "version": "0.144.9",
20
20
  "devDependencies": {
21
21
  "@prettier/sync": "^0.6.1",
22
22
  "@types/jest": "^30.0.0",
@@ -30,9 +30,9 @@
30
30
  "typescript": "^6.0.3",
31
31
  "zod": "^4.4.3",
32
32
  "zod-validation-error": "^5.0.0",
33
+ "@valbuild/shared": "0.144.9",
33
34
  "@valbuild/core": "0.144.0",
34
- "@valbuild/shared": "0.144.5",
35
- "@valbuild/ui": "0.144.7"
35
+ "@valbuild/ui": "0.144.9"
36
36
  },
37
37
  "engines": {
38
38
  "node": "^20.19.0 || >=22"