@valbuild/server 0.144.8 → 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,19 @@
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
+
3
17
  ## 0.144.8
4
18
 
5
19
  ### Patch Changes
@@ -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,7 +10146,7 @@ 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|update-from-site)$/.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
  /**
@@ -10145,7 +10161,7 @@ class ValOpsHttp extends ValOps {
10145
10161
  static proposalFilesWrite(method, path) {
10146
10162
  var _exec;
10147
10163
  if (method !== "POST") return null;
10148
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site)$/.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;
10149
10165
  }
10150
10166
 
10151
10167
  /**
@@ -14959,6 +14975,13 @@ const ValServer = (valModules, options, callbacks) => {
14959
14975
  const sourceMode = serverOps.sourceMode();
14960
14976
  // Spread like the two above: absent is "on the site".
14961
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
+ });
14962
14985
  return {
14963
14986
  status: 200,
14964
14987
  json: {
@@ -14977,10 +15000,13 @@ const ValServer = (valModules, options, callbacks) => {
14977
15000
  ...(proposal ? {
14978
15001
  proposal
14979
15002
  } : {}),
15003
+ ...(historyBranch ? {
15004
+ historyBranch
15005
+ } : {}),
14980
15006
  // Not `options.config` verbatim: in proxy mode the branch the
14981
15007
  // server resolved is filled in where the file did not name one.
14982
15008
  // See `clientConfig`.
14983
- config: clientConfig(options)
15009
+ config
14984
15010
  }
14985
15011
  };
14986
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,7 +10146,7 @@ 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|update-from-site)$/.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
  /**
@@ -10145,7 +10161,7 @@ class ValOpsHttp extends ValOps {
10145
10161
  static proposalFilesWrite(method, path) {
10146
10162
  var _exec;
10147
10163
  if (method !== "POST") return null;
10148
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site)$/.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;
10149
10165
  }
10150
10166
 
10151
10167
  /**
@@ -14959,6 +14975,13 @@ const ValServer = (valModules, options, callbacks) => {
14959
14975
  const sourceMode = serverOps.sourceMode();
14960
14976
  // Spread like the two above: absent is "on the site".
14961
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
+ });
14962
14985
  return {
14963
14986
  status: 200,
14964
14987
  json: {
@@ -14977,10 +15000,13 @@ const ValServer = (valModules, options, callbacks) => {
14977
15000
  ...(proposal ? {
14978
15001
  proposal
14979
15002
  } : {}),
15003
+ ...(historyBranch ? {
15004
+ historyBranch
15005
+ } : {}),
14980
15006
  // Not `options.config` verbatim: in proxy mode the branch the
14981
15007
  // server resolved is filled in where the file did not name one.
14982
15008
  // See `clientConfig`.
14983
- config: clientConfig(options)
15009
+ config
14984
15010
  }
14985
15011
  };
14986
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,7 +10109,7 @@ 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|update-from-site)$/.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
  /**
@@ -10108,7 +10124,7 @@ class ValOpsHttp extends ValOps {
10108
10124
  static proposalFilesWrite(method, path) {
10109
10125
  var _exec;
10110
10126
  if (method !== "POST") return null;
10111
- return ((_exec = /^\/([0-9a-f]{20})\/(files|build|update-from-site)$/.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;
10112
10128
  }
10113
10129
 
10114
10130
  /**
@@ -14922,6 +14938,13 @@ const ValServer = (valModules, options, callbacks) => {
14922
14938
  const sourceMode = serverOps.sourceMode();
14923
14939
  // Spread like the two above: absent is "on the site".
14924
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
+ });
14925
14948
  return {
14926
14949
  status: 200,
14927
14950
  json: {
@@ -14940,10 +14963,13 @@ const ValServer = (valModules, options, callbacks) => {
14940
14963
  ...(proposal ? {
14941
14964
  proposal
14942
14965
  } : {}),
14966
+ ...(historyBranch ? {
14967
+ historyBranch
14968
+ } : {}),
14943
14969
  // Not `options.config` verbatim: in proxy mode the branch the
14944
14970
  // server resolved is filled in where the file did not name one.
14945
14971
  // See `clientConfig`.
14946
- config: clientConfig(options)
14972
+ config
14947
14973
  }
14948
14974
  };
14949
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.8",
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.8"
35
+ "@valbuild/ui": "0.144.9"
36
36
  },
37
37
  "engines": {
38
38
  "node": "^20.19.0 || >=22"