@valbuild/react 0.152.2 → 0.153.0

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,23 @@
1
1
  # @valbuild/react
2
2
 
3
+ ## 0.153.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1016](https://github.com/valbuild/val/pull/1016) [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9) Thanks [@freekh](https://github.com/freekh)! - Removed what 0.151.0 kept only so that a Studio, a page and a server from the release before could still talk to each other during a deploy:
8
+
9
+ - **`PUT /api/val/sources/~`** is gone. Nothing in 0.151.0 asked it: the Studio reads modules through `GET /api/val/manifest` and `GET /api/val/modules/~<path>`, and `fetchVal`, `useVal` and the MCP tools read the server's content in-process. If a script or test of yours read content through it, read one module with `GET /api/val/modules/~<path>` instead. Its answer has the module's `source` and `version`, and an `entries` map holding the `.jsonValues()` entries pending changes touched.
10
+ - **`ValDraft.base`** is gone from the type. It has not been sent or read since 0.151.0, so a `draft` you pass to `ValProvider` is not affected.
11
+ - **A page no longer accepts edits relayed by a Studio from before 0.151.0.** Such a Studio sent each module as a bare `source`. After the upgrade, the Studio and your pages come from the same deploy, so this only matters while an older Studio is still open in a tab during a rollout. Reloading that tab fixes it.
12
+ - **`/api/val/stat`** no longer needs `sourcesSha` and `schemaSha`. The Studio now tells your local server which version it last saw, and the server still sends both fields for a Studio of 0.151.0. They stop being sent in the next release.
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`27e51ba`](https://github.com/valbuild/val/commit/27e51baadce61b2cbee2d5ef227aae045ccb2e21), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`2e70d13`](https://github.com/valbuild/val/commit/2e70d13cf7ca25874900c9ea25227df2876727b9), [`67145fd`](https://github.com/valbuild/val/commit/67145fd16e35f2e3e0988ca5690fe5a4f84c1a41), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`efa1f7d`](https://github.com/valbuild/val/commit/efa1f7d810f3c4e4e21502c9cc81ce86da93650c), [`56ab7d5`](https://github.com/valbuild/val/commit/56ab7d5818772a9e310a561ebdb798b27ee704c9)]:
17
+ - @valbuild/ui@0.153.0
18
+ - @valbuild/core@0.153.0
19
+ - @valbuild/shared@0.153.0
20
+
3
21
  ## 0.152.2
4
22
 
5
23
  ### Patch Changes
@@ -45,13 +45,6 @@ export type ValDraft = {
45
45
  * looking at the proposal too. A draft, when there is one, applies on top.
46
46
  */
47
47
  snapshot?: Record<ModuleFilePath, Json>;
48
- /**
49
- * @deprecated Not sent any more, and not read: the Studio's overlay reads
50
- * the base the server is on by version (the manifest names it), so a page
51
- * no longer hands it over. Kept on the type for a release, so a draft of
52
- * the release before still type-checks; it goes after that.
53
- */
54
- base?: Record<ModuleFilePath, Json>;
55
48
  /**
56
49
  * `false` when no draft was read -- draft mode is off -- and this carries
57
50
  * only the {@link snapshot}. Absent: a draft, as it always was.
@@ -86,14 +86,6 @@ export type ValEventOutcome = {
86
86
  | {
87
87
  type: "updated";
88
88
  changed: boolean;
89
- /**
90
- * Sent by a Studio of the release before: a bare `source`, from a
91
- * Studio that never says `confirmed` -- so the page refreshes on the
92
- * change itself (`RefreshLoop.changedByPreviousStudio`), as that
93
- * release's page did. Goes with the relay's `source` (see
94
- * "Release-delayed deletions" in `docs/plans/one-content-model.md`).
95
- */
96
- fromPreviousStudio?: true;
97
89
  } | {
98
90
  type: "invalid";
99
91
  detail: unknown;
@@ -103,9 +95,7 @@ export type ValEventOutcome = {
103
95
  * `sources-synced` says the editor has sent everything it holds;
104
96
  * `confirmed` how far the server holds the editor's changes; a
105
97
  * `source-update` hands over one module's read, which the store keeps as it
106
- * is (`read`). A Studio from the release before sent the bare `source`
107
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
108
- * out -- still takes that.
98
+ * is (`read`).
109
99
  *
110
100
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
111
101
  * provider had the same rule written inline.
@@ -25,22 +25,10 @@
25
25
  * moved what it holds (`changed`): its server render is older than what the
26
26
  * Studio has. A page rendered from the draft the Studio holds -- the
27
27
  * `draft` prop, read for this request -- is not refreshed for loading.
28
- * - **A Studio of the release before never says `confirmed`** (a deploy
29
- * rolling out: this page, that Studio). Its changes refresh the page as
30
- * they arrive (`changedByPreviousStudio`), as that release's page did,
31
- * until a `confirmed` says the Studio is this release's. They race the
32
- * write, as they did then; it lasts as long as the rollout.
33
28
  */
34
29
  export type RefreshLoop = {
35
30
  /** A relayed module moved what the page's store holds. */
36
31
  changed(): void;
37
- /**
38
- * A relayed module moved what the page's store holds, sent by a Studio of
39
- * the release before (a bare `source`), which never says `confirmed`: a
40
- * refresh, unless a `confirmed` has been told on this page. Goes with the
41
- * relay's `source` ("Release-delayed deletions").
42
- */
43
- changedByPreviousStudio(): void;
44
32
  /** The server holds the editor's changes up to `seq` (`null`: unknown). */
45
33
  confirmed(seq: number | null): void;
46
34
  /**
@@ -485,9 +485,7 @@ function includesPath(subscriberId, path) {
485
485
  * `sources-synced` says the editor has sent everything it holds;
486
486
  * `confirmed` how far the server holds the editor's changes; a
487
487
  * `source-update` hands over one module's read, which the store keeps as it
488
- * is (`read`). A Studio from the release before sent the bare `source`
489
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
490
- * out -- still takes that.
488
+ * is (`read`).
491
489
  *
492
490
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
493
491
  * provider had the same rule written inline.
@@ -532,17 +530,8 @@ function applyValEvent(store, detail) {
532
530
  changed: store.receive(moduleFilePath, read)
533
531
  };
534
532
  }
535
- // A Studio of the release before sent the bare `source`. This fallback
536
- // goes with the relay's `source` field: see "Release-delayed deletions"
537
- // in `docs/plans/one-content-model.md`.
538
- var source = "source" in detail ? detail.source : undefined;
539
- if (isJson(source)) {
540
- return {
541
- type: "updated",
542
- changed: store.update(moduleFilePath, source),
543
- fromPreviousStudio: true
544
- };
545
- }
533
+ // A bare `source` without `read` was a Studio of the release before
534
+ // the one content model; the release after it stopped reading it.
546
535
  }
547
536
  return {
548
537
  type: "invalid",
@@ -707,11 +696,6 @@ function isModuleFilePathOf(sources) {
707
696
  * moved what it holds (`changed`): its server render is older than what the
708
697
  * Studio has. A page rendered from the draft the Studio holds -- the
709
698
  * `draft` prop, read for this request -- is not refreshed for loading.
710
- * - **A Studio of the release before never says `confirmed`** (a deploy
711
- * rolling out: this page, that Studio). Its changes refresh the page as
712
- * they arrive (`changedByPreviousStudio`), as that release's page did,
713
- * until a `confirmed` says the Studio is this release's. They race the
714
- * write, as they did then; it lasts as long as the rollout.
715
699
  */
716
700
 
717
701
  function startRefreshLoop(options) {
@@ -745,13 +729,6 @@ function startRefreshLoop(options) {
745
729
  changed: function changed() {
746
730
  if (told === undefined) behind = true;
747
731
  },
748
- changedByPreviousStudio: function changedByPreviousStudio() {
749
- if (told !== undefined) {
750
- // A Studio that confirms: its `confirmed` is the refresh.
751
- return;
752
- }
753
- _run();
754
- },
755
732
  confirmed: function confirmed(seq) {
756
733
  if (told !== undefined && told !== null && seq !== null && seq <= told) {
757
734
  return;
@@ -493,9 +493,7 @@ function includesPath(subscriberId, path) {
493
493
  * `sources-synced` says the editor has sent everything it holds;
494
494
  * `confirmed` how far the server holds the editor's changes; a
495
495
  * `source-update` hands over one module's read, which the store keeps as it
496
- * is (`read`). A Studio from the release before sent the bare `source`
497
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
498
- * out -- still takes that.
496
+ * is (`read`).
499
497
  *
500
498
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
501
499
  * provider had the same rule written inline.
@@ -540,17 +538,8 @@ function applyValEvent(store, detail) {
540
538
  changed: store.receive(moduleFilePath, read)
541
539
  };
542
540
  }
543
- // A Studio of the release before sent the bare `source`. This fallback
544
- // goes with the relay's `source` field: see "Release-delayed deletions"
545
- // in `docs/plans/one-content-model.md`.
546
- var source = "source" in detail ? detail.source : undefined;
547
- if (isJson(source)) {
548
- return {
549
- type: "updated",
550
- changed: store.update(moduleFilePath, source),
551
- fromPreviousStudio: true
552
- };
553
- }
541
+ // A bare `source` without `read` was a Studio of the release before
542
+ // the one content model; the release after it stopped reading it.
554
543
  }
555
544
  return {
556
545
  type: "invalid",
@@ -715,11 +704,6 @@ function isModuleFilePathOf(sources) {
715
704
  * moved what it holds (`changed`): its server render is older than what the
716
705
  * Studio has. A page rendered from the draft the Studio holds -- the
717
706
  * `draft` prop, read for this request -- is not refreshed for loading.
718
- * - **A Studio of the release before never says `confirmed`** (a deploy
719
- * rolling out: this page, that Studio). Its changes refresh the page as
720
- * they arrive (`changedByPreviousStudio`), as that release's page did,
721
- * until a `confirmed` says the Studio is this release's. They race the
722
- * write, as they did then; it lasts as long as the rollout.
723
707
  */
724
708
 
725
709
  function startRefreshLoop(options) {
@@ -753,13 +737,6 @@ function startRefreshLoop(options) {
753
737
  changed: function changed() {
754
738
  if (told === undefined) behind = true;
755
739
  },
756
- changedByPreviousStudio: function changedByPreviousStudio() {
757
- if (told !== undefined) {
758
- // A Studio that confirms: its `confirmed` is the refresh.
759
- return;
760
- }
761
- _run();
762
- },
763
740
  confirmed: function confirmed(seq) {
764
741
  if (told !== undefined && told !== null && seq !== null && seq <= told) {
765
742
  return;
@@ -493,9 +493,7 @@ function includesPath(subscriberId, path) {
493
493
  * `sources-synced` says the editor has sent everything it holds;
494
494
  * `confirmed` how far the server holds the editor's changes; a
495
495
  * `source-update` hands over one module's read, which the store keeps as it
496
- * is (`read`). A Studio from the release before sent the bare `source`
497
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
498
- * out -- still takes that.
496
+ * is (`read`).
499
497
  *
500
498
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
501
499
  * provider had the same rule written inline.
@@ -540,17 +538,8 @@ function applyValEvent(store, detail) {
540
538
  changed: store.receive(moduleFilePath, read)
541
539
  };
542
540
  }
543
- // A Studio of the release before sent the bare `source`. This fallback
544
- // goes with the relay's `source` field: see "Release-delayed deletions"
545
- // in `docs/plans/one-content-model.md`.
546
- var source = "source" in detail ? detail.source : undefined;
547
- if (isJson(source)) {
548
- return {
549
- type: "updated",
550
- changed: store.update(moduleFilePath, source),
551
- fromPreviousStudio: true
552
- };
553
- }
541
+ // A bare `source` without `read` was a Studio of the release before
542
+ // the one content model; the release after it stopped reading it.
554
543
  }
555
544
  return {
556
545
  type: "invalid",
@@ -715,11 +704,6 @@ function isModuleFilePathOf(sources) {
715
704
  * moved what it holds (`changed`): its server render is older than what the
716
705
  * Studio has. A page rendered from the draft the Studio holds -- the
717
706
  * `draft` prop, read for this request -- is not refreshed for loading.
718
- * - **A Studio of the release before never says `confirmed`** (a deploy
719
- * rolling out: this page, that Studio). Its changes refresh the page as
720
- * they arrive (`changedByPreviousStudio`), as that release's page did,
721
- * until a `confirmed` says the Studio is this release's. They race the
722
- * write, as they did then; it lasts as long as the rollout.
723
707
  */
724
708
 
725
709
  function startRefreshLoop(options) {
@@ -753,13 +737,6 @@ function startRefreshLoop(options) {
753
737
  changed: function changed() {
754
738
  if (told === undefined) behind = true;
755
739
  },
756
- changedByPreviousStudio: function changedByPreviousStudio() {
757
- if (told !== undefined) {
758
- // A Studio that confirms: its `confirmed` is the refresh.
759
- return;
760
- }
761
- _run();
762
- },
763
740
  confirmed: function confirmed(seq) {
764
741
  if (told !== undefined && told !== null && seq !== null && seq <= told) {
765
742
  return;
@@ -485,9 +485,7 @@ function includesPath(subscriberId, path) {
485
485
  * `sources-synced` says the editor has sent everything it holds;
486
486
  * `confirmed` how far the server holds the editor's changes; a
487
487
  * `source-update` hands over one module's read, which the store keeps as it
488
- * is (`read`). A Studio from the release before sent the bare `source`
489
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
490
- * out -- still takes that.
488
+ * is (`read`).
491
489
  *
492
490
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
493
491
  * provider had the same rule written inline.
@@ -532,17 +530,8 @@ function applyValEvent(store, detail) {
532
530
  changed: store.receive(moduleFilePath, read)
533
531
  };
534
532
  }
535
- // A Studio of the release before sent the bare `source`. This fallback
536
- // goes with the relay's `source` field: see "Release-delayed deletions"
537
- // in `docs/plans/one-content-model.md`.
538
- var source = "source" in detail ? detail.source : undefined;
539
- if (isJson(source)) {
540
- return {
541
- type: "updated",
542
- changed: store.update(moduleFilePath, source),
543
- fromPreviousStudio: true
544
- };
545
- }
533
+ // A bare `source` without `read` was a Studio of the release before
534
+ // the one content model; the release after it stopped reading it.
546
535
  }
547
536
  return {
548
537
  type: "invalid",
@@ -707,11 +696,6 @@ function isModuleFilePathOf(sources) {
707
696
  * moved what it holds (`changed`): its server render is older than what the
708
697
  * Studio has. A page rendered from the draft the Studio holds -- the
709
698
  * `draft` prop, read for this request -- is not refreshed for loading.
710
- * - **A Studio of the release before never says `confirmed`** (a deploy
711
- * rolling out: this page, that Studio). Its changes refresh the page as
712
- * they arrive (`changedByPreviousStudio`), as that release's page did,
713
- * until a `confirmed` says the Studio is this release's. They race the
714
- * write, as they did then; it lasts as long as the rollout.
715
699
  */
716
700
 
717
701
  function startRefreshLoop(options) {
@@ -745,13 +729,6 @@ function startRefreshLoop(options) {
745
729
  changed: function changed() {
746
730
  if (told === undefined) behind = true;
747
731
  },
748
- changedByPreviousStudio: function changedByPreviousStudio() {
749
- if (told !== undefined) {
750
- // A Studio that confirms: its `confirmed` is the refresh.
751
- return;
752
- }
753
- _run();
754
- },
755
732
  confirmed: function confirmed(seq) {
756
733
  if (told !== undefined && told !== null && seq !== null && seq <= told) {
757
734
  return;
@@ -485,9 +485,7 @@ function includesPath(subscriberId, path) {
485
485
  * `sources-synced` says the editor has sent everything it holds;
486
486
  * `confirmed` how far the server holds the editor's changes; a
487
487
  * `source-update` hands over one module's read, which the store keeps as it
488
- * is (`read`). A Studio from the release before sent the bare `source`
489
- * instead, and a page newer than the Studio it is open in -- a deploy rolling
490
- * out -- still takes that.
488
+ * is (`read`).
491
489
  *
492
490
  * Moved here from `@valbuild/tanstack`'s draft store; `@valbuild/next`'s
493
491
  * provider had the same rule written inline.
@@ -532,17 +530,8 @@ function applyValEvent(store, detail) {
532
530
  changed: store.receive(moduleFilePath, read)
533
531
  };
534
532
  }
535
- // A Studio of the release before sent the bare `source`. This fallback
536
- // goes with the relay's `source` field: see "Release-delayed deletions"
537
- // in `docs/plans/one-content-model.md`.
538
- var source = "source" in detail ? detail.source : undefined;
539
- if (isJson(source)) {
540
- return {
541
- type: "updated",
542
- changed: store.update(moduleFilePath, source),
543
- fromPreviousStudio: true
544
- };
545
- }
533
+ // A bare `source` without `read` was a Studio of the release before
534
+ // the one content model; the release after it stopped reading it.
546
535
  }
547
536
  return {
548
537
  type: "invalid",
@@ -707,11 +696,6 @@ function isModuleFilePathOf(sources) {
707
696
  * moved what it holds (`changed`): its server render is older than what the
708
697
  * Studio has. A page rendered from the draft the Studio holds -- the
709
698
  * `draft` prop, read for this request -- is not refreshed for loading.
710
- * - **A Studio of the release before never says `confirmed`** (a deploy
711
- * rolling out: this page, that Studio). Its changes refresh the page as
712
- * they arrive (`changedByPreviousStudio`), as that release's page did,
713
- * until a `confirmed` says the Studio is this release's. They race the
714
- * write, as they did then; it lasts as long as the rollout.
715
699
  */
716
700
 
717
701
  function startRefreshLoop(options) {
@@ -745,13 +729,6 @@ function startRefreshLoop(options) {
745
729
  changed: function changed() {
746
730
  if (told === undefined) behind = true;
747
731
  },
748
- changedByPreviousStudio: function changedByPreviousStudio() {
749
- if (told !== undefined) {
750
- // A Studio that confirms: its `confirmed` is the refresh.
751
- return;
752
- }
753
- _run();
754
- },
755
732
  confirmed: function confirmed(seq) {
756
733
  if (told !== undefined && told !== null && seq !== null && seq <= told) {
757
734
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/react",
3
- "version": "0.152.2",
3
+ "version": "0.153.0",
4
4
  "private": false,
5
5
  "description": "Val - React internal helpers",
6
6
  "repository": {
@@ -11,9 +11,9 @@
11
11
  "dependencies": {
12
12
  "@vercel/stega": "^1.1.0",
13
13
  "base64-arraybuffer": "^1.0.2",
14
- "@valbuild/core": "0.151.0",
15
- "@valbuild/shared": "0.152.1",
16
- "@valbuild/ui": "0.152.2"
14
+ "@valbuild/core": "0.153.0",
15
+ "@valbuild/shared": "0.153.0",
16
+ "@valbuild/ui": "0.153.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@testing-library/react": "^16.3.3",