@valbuild/server 0.136.8 → 0.136.10

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,24 @@
1
1
  # @valbuild/server
2
2
 
3
+ ## 0.136.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#743](https://github.com/valbuild/val/pull/743) [`fef29b0`](https://github.com/valbuild/val/commit/fef29b0d9e826e4e7e63a3ae61553137a3f9d280) Thanks [@freekh](https://github.com/freekh)! - Saving no longer gets stuck on "Changes cannot be saved: something else keeps changing them first" when another editor has an unpublished change and later work has been published.
8
+
9
+ A new change is now written on top of the latest change the content service has registered, which it reports alongside the list of pending changes, instead of the last change this deployment was shown. Since changes can be published independently, those two can differ for good: an unpublished change can sit before published ones that the running deployment already contains. The Studio and the MCP tools both name the reported head, and fall back to the old behaviour against a content service that does not report one.
10
+
11
+ - Updated dependencies [[`fef29b0`](https://github.com/valbuild/val/commit/fef29b0d9e826e4e7e63a3ae61553137a3f9d280)]:
12
+ - @valbuild/ui@0.136.10
13
+ - @valbuild/shared@0.136.10
14
+
15
+ ## 0.136.9
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`c2bd7e7`](https://github.com/valbuild/val/commit/c2bd7e7e537f00a269a54b72274fe5efb81c0ae9)]:
20
+ - @valbuild/ui@0.136.9
21
+
3
22
  ## 0.136.8
4
23
 
5
24
  ### Patch Changes
@@ -141,6 +141,11 @@ export declare abstract class ValOps {
141
141
  commitSha?: CommitSha;
142
142
  sourcesSha: SourcesSha;
143
143
  patches: PatchId[];
144
+ /**
145
+ * The head of the chain, when the store reports one. See
146
+ * {@link OrderedPatches.headPatchId}.
147
+ */
148
+ headPatchId?: PatchId | null;
144
149
  } | {
145
150
  type: "error";
146
151
  error: GenericErrorMessage;
@@ -851,6 +856,16 @@ export type OrderedPatches = {
851
856
  } | null;
852
857
  }[];
853
858
  commits?: ValCommit[];
859
+ /**
860
+ * The head of the patch chain: the last patch registered on the branch,
861
+ * published or not. `null` when there is none.
862
+ *
863
+ * What a new patch names as its parent, and NOT the last of `patches` — see
864
+ * `chainHeadOf` in `@valbuild/shared` for why. Absent means the store does
865
+ * not report one: `ValOpsFS` (whose ordering log defines order, and which
866
+ * ignores the parent) and a content service that predates the field.
867
+ */
868
+ headPatchId?: PatchId | null;
854
869
  error?: GenericErrorMessage;
855
870
  errors?: PatchReadError[];
856
871
  unauthorized?: boolean;
@@ -862,6 +877,8 @@ export type OrderedPatchesMetadata = {
862
877
  })[];
863
878
  commits?: ValCommit[];
864
879
  deployments?: ValDeployment[];
880
+ /** See {@link OrderedPatches.headPatchId}. */
881
+ headPatchId?: OrderedPatches["headPatchId"];
865
882
  error?: GenericErrorMessage;
866
883
  errors?: OrderedPatches["errors"];
867
884
  unauthorized?: boolean;
@@ -256,6 +256,8 @@ export declare class ValOpsHttp extends ValOps {
256
256
  patches: PatchId[];
257
257
  /** Of `patches`, the ones that have shipped. See the implementation. */
258
258
  appliedPatches: PatchId[];
259
+ /** The head of the chain. See {@link OrderedPatchesMetadata.headPatchId}. */
260
+ headPatchId?: PatchId | null;
259
261
  /** The newest commit, which is the publish head. */
260
262
  headCommitSha?: string;
261
263
  } | {
@@ -7706,6 +7706,11 @@ const GetApplicablePatches = z.z.object({
7706
7706
  commitSha: z.z.string()
7707
7707
  }).nullable()
7708
7708
  })),
7709
+ /**
7710
+ * The head of the chain. See `OrderedPatches.headPatchId`. Optional because
7711
+ * a content service that predates it sends nothing.
7712
+ */
7713
+ headPatchId: internal.PatchId.nullable().optional(),
7709
7714
  commits: z.z.array(z.z.object({
7710
7715
  commitSha: z.z.string(),
7711
7716
  /*
@@ -8431,6 +8436,13 @@ class ValOpsHttp extends ValOps {
8431
8436
  deployments: allPatchData.deployments || [],
8432
8437
  patches,
8433
8438
  appliedPatches,
8439
+ /*
8440
+ * The CHAIN head, not the publish head below. Spread: absent is a content
8441
+ * service that does not report it, which is not the same as `null`.
8442
+ */
8443
+ ...(allPatchData.headPatchId !== undefined ? {
8444
+ headPatchId: allPatchData.headPatchId
8445
+ } : {}),
8434
8446
  /*
8435
8447
  * The PUBLISH head, which is not `commitSha`.
8436
8448
  *
@@ -8555,6 +8567,9 @@ class ValOpsHttp extends ValOps {
8555
8567
  * the same treatment and a home on `OrderedPatches` first.
8556
8568
  */
8557
8569
  let commits;
8570
+ // A fact about the branch too, so taken from the first chunk that has it
8571
+ // for the same reason `commits` is.
8572
+ let headPatchId;
8558
8573
  if (patchIds === undefined || patchIds.length === 0) {
8559
8574
  return this.fetchPatchesInternal({
8560
8575
  patchIds: patchIds,
@@ -8575,6 +8590,9 @@ class ValOpsHttp extends ValOps {
8575
8590
  if (commits === undefined && res.commits !== undefined) {
8576
8591
  commits = res.commits;
8577
8592
  }
8593
+ if (headPatchId === undefined && res.headPatchId !== undefined) {
8594
+ headPatchId = res.headPatchId;
8595
+ }
8578
8596
  }
8579
8597
  // Chunking is a query-string-length workaround, NOT a filter: the content
8580
8598
  // api returns every applicable patch per request regardless of which
@@ -8607,6 +8625,9 @@ class ValOpsHttp extends ValOps {
8607
8625
  // readers do — sees the same shape the unchunked path gives it.
8608
8626
  ...(commits !== undefined ? {
8609
8627
  commits
8628
+ } : {}),
8629
+ ...(headPatchId !== undefined ? {
8630
+ headPatchId
8610
8631
  } : {})
8611
8632
  };
8612
8633
  }
@@ -8702,7 +8723,10 @@ class ValOpsHttp extends ValOps {
8702
8723
  commits,
8703
8724
  deployments,
8704
8725
  patches,
8705
- errors
8726
+ errors,
8727
+ ...(data.headPatchId !== undefined ? {
8728
+ headPatchId: data.headPatchId
8729
+ } : {})
8706
8730
  };
8707
8731
  }
8708
8732
  console.error("Could not parse patches response. Error: " + zodValidationError.fromError(parsed.error));
@@ -7706,6 +7706,11 @@ const GetApplicablePatches = z.z.object({
7706
7706
  commitSha: z.z.string()
7707
7707
  }).nullable()
7708
7708
  })),
7709
+ /**
7710
+ * The head of the chain. See `OrderedPatches.headPatchId`. Optional because
7711
+ * a content service that predates it sends nothing.
7712
+ */
7713
+ headPatchId: internal.PatchId.nullable().optional(),
7709
7714
  commits: z.z.array(z.z.object({
7710
7715
  commitSha: z.z.string(),
7711
7716
  /*
@@ -8431,6 +8436,13 @@ class ValOpsHttp extends ValOps {
8431
8436
  deployments: allPatchData.deployments || [],
8432
8437
  patches,
8433
8438
  appliedPatches,
8439
+ /*
8440
+ * The CHAIN head, not the publish head below. Spread: absent is a content
8441
+ * service that does not report it, which is not the same as `null`.
8442
+ */
8443
+ ...(allPatchData.headPatchId !== undefined ? {
8444
+ headPatchId: allPatchData.headPatchId
8445
+ } : {}),
8434
8446
  /*
8435
8447
  * The PUBLISH head, which is not `commitSha`.
8436
8448
  *
@@ -8555,6 +8567,9 @@ class ValOpsHttp extends ValOps {
8555
8567
  * the same treatment and a home on `OrderedPatches` first.
8556
8568
  */
8557
8569
  let commits;
8570
+ // A fact about the branch too, so taken from the first chunk that has it
8571
+ // for the same reason `commits` is.
8572
+ let headPatchId;
8558
8573
  if (patchIds === undefined || patchIds.length === 0) {
8559
8574
  return this.fetchPatchesInternal({
8560
8575
  patchIds: patchIds,
@@ -8575,6 +8590,9 @@ class ValOpsHttp extends ValOps {
8575
8590
  if (commits === undefined && res.commits !== undefined) {
8576
8591
  commits = res.commits;
8577
8592
  }
8593
+ if (headPatchId === undefined && res.headPatchId !== undefined) {
8594
+ headPatchId = res.headPatchId;
8595
+ }
8578
8596
  }
8579
8597
  // Chunking is a query-string-length workaround, NOT a filter: the content
8580
8598
  // api returns every applicable patch per request regardless of which
@@ -8607,6 +8625,9 @@ class ValOpsHttp extends ValOps {
8607
8625
  // readers do — sees the same shape the unchunked path gives it.
8608
8626
  ...(commits !== undefined ? {
8609
8627
  commits
8628
+ } : {}),
8629
+ ...(headPatchId !== undefined ? {
8630
+ headPatchId
8610
8631
  } : {})
8611
8632
  };
8612
8633
  }
@@ -8702,7 +8723,10 @@ class ValOpsHttp extends ValOps {
8702
8723
  commits,
8703
8724
  deployments,
8704
8725
  patches,
8705
- errors
8726
+ errors,
8727
+ ...(data.headPatchId !== undefined ? {
8728
+ headPatchId: data.headPatchId
8729
+ } : {})
8706
8730
  };
8707
8731
  }
8708
8732
  console.error("Could not parse patches response. Error: " + zodValidationError.fromError(parsed.error));
@@ -8,7 +8,7 @@ import path__default from 'path';
8
8
  import fs from 'fs';
9
9
  import vm from 'node:vm';
10
10
  import { Module } from 'node:module';
11
- import { isSchemaSourceFixError, resolveSchemaSourceFixForError, Patch, getErrorMessageFromUnknownJson, JSONValue, PatchGroup, newestCommitSha, SerializedSchema, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, Api } from '@valbuild/shared/internal';
11
+ import { isSchemaSourceFixError, resolveSchemaSourceFixForError, Patch, getErrorMessageFromUnknownJson, PatchId as PatchId$1, JSONValue, PatchGroup, newestCommitSha, SerializedSchema, VAL_ENABLE_COOKIE_NAME, VAL_STATE_COOKIE, VAL_SESSION_COOKIE, Api } from '@valbuild/shared/internal';
12
12
  import { createUIRequestHandler } from '@valbuild/ui/server';
13
13
  import crypto$1 from 'crypto';
14
14
  import z$1, { z } from 'zod';
@@ -7672,6 +7672,11 @@ const GetApplicablePatches = z.object({
7672
7672
  commitSha: z.string()
7673
7673
  }).nullable()
7674
7674
  })),
7675
+ /**
7676
+ * The head of the chain. See `OrderedPatches.headPatchId`. Optional because
7677
+ * a content service that predates it sends nothing.
7678
+ */
7679
+ headPatchId: PatchId$1.nullable().optional(),
7675
7680
  commits: z.array(z.object({
7676
7681
  commitSha: z.string(),
7677
7682
  /*
@@ -8397,6 +8402,13 @@ class ValOpsHttp extends ValOps {
8397
8402
  deployments: allPatchData.deployments || [],
8398
8403
  patches,
8399
8404
  appliedPatches,
8405
+ /*
8406
+ * The CHAIN head, not the publish head below. Spread: absent is a content
8407
+ * service that does not report it, which is not the same as `null`.
8408
+ */
8409
+ ...(allPatchData.headPatchId !== undefined ? {
8410
+ headPatchId: allPatchData.headPatchId
8411
+ } : {}),
8400
8412
  /*
8401
8413
  * The PUBLISH head, which is not `commitSha`.
8402
8414
  *
@@ -8521,6 +8533,9 @@ class ValOpsHttp extends ValOps {
8521
8533
  * the same treatment and a home on `OrderedPatches` first.
8522
8534
  */
8523
8535
  let commits;
8536
+ // A fact about the branch too, so taken from the first chunk that has it
8537
+ // for the same reason `commits` is.
8538
+ let headPatchId;
8524
8539
  if (patchIds === undefined || patchIds.length === 0) {
8525
8540
  return this.fetchPatchesInternal({
8526
8541
  patchIds: patchIds,
@@ -8541,6 +8556,9 @@ class ValOpsHttp extends ValOps {
8541
8556
  if (commits === undefined && res.commits !== undefined) {
8542
8557
  commits = res.commits;
8543
8558
  }
8559
+ if (headPatchId === undefined && res.headPatchId !== undefined) {
8560
+ headPatchId = res.headPatchId;
8561
+ }
8544
8562
  }
8545
8563
  // Chunking is a query-string-length workaround, NOT a filter: the content
8546
8564
  // api returns every applicable patch per request regardless of which
@@ -8573,6 +8591,9 @@ class ValOpsHttp extends ValOps {
8573
8591
  // readers do — sees the same shape the unchunked path gives it.
8574
8592
  ...(commits !== undefined ? {
8575
8593
  commits
8594
+ } : {}),
8595
+ ...(headPatchId !== undefined ? {
8596
+ headPatchId
8576
8597
  } : {})
8577
8598
  };
8578
8599
  }
@@ -8668,7 +8689,10 @@ class ValOpsHttp extends ValOps {
8668
8689
  commits,
8669
8690
  deployments,
8670
8691
  patches,
8671
- errors
8692
+ errors,
8693
+ ...(data.headPatchId !== undefined ? {
8694
+ headPatchId: data.headPatchId
8695
+ } : {})
8672
8696
  };
8673
8697
  }
8674
8698
  console.error("Could not parse patches response. Error: " + fromError(parsed.error));
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.136.8",
19
+ "version": "0.136.10",
20
20
  "devDependencies": {
21
21
  "@prettier/sync": "^0.6.1",
22
22
  "@types/jest": "^30.0.0",
@@ -31,8 +31,8 @@
31
31
  "zod": "^4.4.3",
32
32
  "zod-validation-error": "^5.0.0",
33
33
  "@valbuild/core": "0.136.8",
34
- "@valbuild/ui": "0.136.8",
35
- "@valbuild/shared": "0.136.8"
34
+ "@valbuild/shared": "0.136.10",
35
+ "@valbuild/ui": "0.136.10"
36
36
  },
37
37
  "engines": {
38
38
  "node": "^20.19.0 || >=22"