@valbuild/shared 0.136.1 → 0.136.2

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,16 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.136.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#720](https://github.com/valbuild/val/pull/720) [`f76cd56`](https://github.com/valbuild/val/commit/f76cd56b9f1c1bcc0a608a7a4de24b1e776adccb) Thanks [@freekh](https://github.com/freekh)! - A managed project published from the Studio keeps its images, and a project created from a template can publish from the Studio at all.
8
+
9
+ - A publish from the Studio carries over every file under `public/` that the site already serves, so the favicon and images no longer disappear after the first Studio publish. When content published the live build, it already holds those files and nothing is uploaded again. When it didn't (a project cloned from a template), the Studio reads them from the site it runs on and builds with them.
10
+ - An image uploaded in the Studio is now part of the build that publishes it. For a managed project, `/save` returns the files the commit wrote (`binaryFiles`), the same way it already returns the `.val.ts` text.
11
+ - `/save` also returns the project's branch for a managed project, and the Studio's build uses it. A project cloned from a template was wired at no commit and no branch, so its first Studio publish went out branchless and the platform refused it.
12
+ - When neither content nor the platform can say which public files the live site serves, the Studio refuses to publish and says so, rather than publishing a site without them.
13
+
3
14
  ## 0.136.1
4
15
 
5
16
  ### Patch Changes
@@ -1077,6 +1077,9 @@ export declare const Api: {
1077
1077
  json: z.ZodObject<{
1078
1078
  commitSha: z.ZodOptional<z.ZodString>;
1079
1079
  sourceFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
1080
+ binaryFiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1081
+ branch: z.ZodOptional<z.ZodString>;
1082
+ binaryFilesUnread: z.ZodOptional<z.ZodArray<z.ZodString>>;
1080
1083
  removed: z.ZodOptional<z.ZodArray<z.ZodObject<{
1081
1084
  patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
1082
1085
  moduleFilePath: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
@@ -107,6 +107,12 @@ export type BuildTargetResponse = z.infer<typeof buildTargetResponse>;
107
107
  */
108
108
  declare const projectSourceResponse: z.ZodObject<{
109
109
  files: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
110
+ publicFiles: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
111
+ key: z.ZodString;
112
+ sha256: z.ZodString;
113
+ bytes: z.ZodNumber;
114
+ }, z.core.$strip>>>>;
115
+ publicPaths: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
110
116
  }, z.core.$strip>;
111
117
  export type ProjectSourceResponse = z.infer<typeof projectSourceResponse>;
112
118
  export declare const parseBuildTarget: (body: unknown) => BuildTargetResponse;
@@ -2606,6 +2606,34 @@ var Api = {
2606
2606
  * repository, and from a server that predates it.
2607
2607
  */
2608
2608
  sourceFiles: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
2609
+ /**
2610
+ * The binary files this commit wrote -- an image uploaded in the
2611
+ * Studio -- base64, by path, for a MANAGED project.
2612
+ *
2613
+ * The same reason as `sourceFiles`: the in-tab build publishes the
2614
+ * site, and a file this commit added is in no earlier build. Local
2615
+ * files only; a remote one is served from its own URL and was never
2616
+ * part of a build. A deleted file is a `null` in `sourceFiles`, as
2617
+ * it always was.
2618
+ */
2619
+ binaryFiles: zod.z.record(zod.z.string(), zod.z.string()).optional(),
2620
+ /**
2621
+ * The branch this commit is on, for a MANAGED project -- the
2622
+ * content service's word for it.
2623
+ *
2624
+ * The in-tab build has to name the branch it was made at, and its
2625
+ * only other source is the `val.server.ts` the last build was
2626
+ * wired with: a project cloned from a template seed has one wired
2627
+ * at no commit, so without this its first publish is branchless
2628
+ * and the loader refuses it.
2629
+ */
2630
+ branch: zod.z.string().optional(),
2631
+ /**
2632
+ * Binary files this commit wrote whose bytes the server could not
2633
+ * read back before committing. Named so the Studio refuses to build
2634
+ * a site that would 404 them, rather than publishing it.
2635
+ */
2636
+ binaryFilesUnread: zod.z.array(zod.z.string()).optional(),
2609
2637
  /**
2610
2638
  * Unpublished changes the save threw away because they could not be
2611
2639
  * applied.
@@ -7231,7 +7259,37 @@ var buildTargetResponse = zod.z.object({
7231
7259
  * "there is nothing here yet".
7232
7260
  */
7233
7261
  var projectSourceResponse = zod.z.object({
7234
- files: zod.z.record(zod.z.string(), zod.z.string()).nullable()
7262
+ files: zod.z.record(zod.z.string(), zod.z.string()).nullable(),
7263
+ /**
7264
+ * The live build's `public/*` artifacts, by hash -- what a publisher with no
7265
+ * checkout carries into its build so the site keeps its favicon and images.
7266
+ *
7267
+ * The loader stores public files PER BUILD, so a build that names none
7268
+ * serves none. A publisher with a checkout has them on disk; the Studio has
7269
+ * this. Re-declaring one costs nothing: content holds the bytes for the
7270
+ * project already and asks for no upload.
7271
+ *
7272
+ * `null` when content cannot say -- the live build was not published through
7273
+ * it -- and absent from a content service that predates it. A publisher
7274
+ * must treat both as "unknown", never as "none": publishing on that guess
7275
+ * deletes every public file the site has.
7276
+ */
7277
+ publicFiles: zod.z.array(zod.z.object({
7278
+ key: zod.z.string(),
7279
+ sha256: zod.z.string(),
7280
+ bytes: zod.z.number()["int"]().nonnegative()
7281
+ })).nullable().optional(),
7282
+ /**
7283
+ * The URL paths the live build serves from `public/`, as the loader has
7284
+ * them -- without the bytes' hashes.
7285
+ *
7286
+ * The fallback for when `publicFiles` is `null`: a build content has no
7287
+ * record of, which is every project cloned from a template seed. A publisher
7288
+ * running on the site's own origin can fetch these and build with them;
7289
+ * after that publish content holds their hashes and `publicFiles` answers.
7290
+ * `null` when the loader serves no build or does not say.
7291
+ */
7292
+ publicPaths: zod.z.array(zod.z.string()).nullable().optional()
7235
7293
  });
7236
7294
  var parseBuildTarget = function parseBuildTarget(body) {
7237
7295
  return parse(buildTargetResponse, body, "GET /v1/build-target");
@@ -2606,6 +2606,34 @@ var Api = {
2606
2606
  * repository, and from a server that predates it.
2607
2607
  */
2608
2608
  sourceFiles: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
2609
+ /**
2610
+ * The binary files this commit wrote -- an image uploaded in the
2611
+ * Studio -- base64, by path, for a MANAGED project.
2612
+ *
2613
+ * The same reason as `sourceFiles`: the in-tab build publishes the
2614
+ * site, and a file this commit added is in no earlier build. Local
2615
+ * files only; a remote one is served from its own URL and was never
2616
+ * part of a build. A deleted file is a `null` in `sourceFiles`, as
2617
+ * it always was.
2618
+ */
2619
+ binaryFiles: zod.z.record(zod.z.string(), zod.z.string()).optional(),
2620
+ /**
2621
+ * The branch this commit is on, for a MANAGED project -- the
2622
+ * content service's word for it.
2623
+ *
2624
+ * The in-tab build has to name the branch it was made at, and its
2625
+ * only other source is the `val.server.ts` the last build was
2626
+ * wired with: a project cloned from a template seed has one wired
2627
+ * at no commit, so without this its first publish is branchless
2628
+ * and the loader refuses it.
2629
+ */
2630
+ branch: zod.z.string().optional(),
2631
+ /**
2632
+ * Binary files this commit wrote whose bytes the server could not
2633
+ * read back before committing. Named so the Studio refuses to build
2634
+ * a site that would 404 them, rather than publishing it.
2635
+ */
2636
+ binaryFilesUnread: zod.z.array(zod.z.string()).optional(),
2609
2637
  /**
2610
2638
  * Unpublished changes the save threw away because they could not be
2611
2639
  * applied.
@@ -7231,7 +7259,37 @@ var buildTargetResponse = zod.z.object({
7231
7259
  * "there is nothing here yet".
7232
7260
  */
7233
7261
  var projectSourceResponse = zod.z.object({
7234
- files: zod.z.record(zod.z.string(), zod.z.string()).nullable()
7262
+ files: zod.z.record(zod.z.string(), zod.z.string()).nullable(),
7263
+ /**
7264
+ * The live build's `public/*` artifacts, by hash -- what a publisher with no
7265
+ * checkout carries into its build so the site keeps its favicon and images.
7266
+ *
7267
+ * The loader stores public files PER BUILD, so a build that names none
7268
+ * serves none. A publisher with a checkout has them on disk; the Studio has
7269
+ * this. Re-declaring one costs nothing: content holds the bytes for the
7270
+ * project already and asks for no upload.
7271
+ *
7272
+ * `null` when content cannot say -- the live build was not published through
7273
+ * it -- and absent from a content service that predates it. A publisher
7274
+ * must treat both as "unknown", never as "none": publishing on that guess
7275
+ * deletes every public file the site has.
7276
+ */
7277
+ publicFiles: zod.z.array(zod.z.object({
7278
+ key: zod.z.string(),
7279
+ sha256: zod.z.string(),
7280
+ bytes: zod.z.number()["int"]().nonnegative()
7281
+ })).nullable().optional(),
7282
+ /**
7283
+ * The URL paths the live build serves from `public/`, as the loader has
7284
+ * them -- without the bytes' hashes.
7285
+ *
7286
+ * The fallback for when `publicFiles` is `null`: a build content has no
7287
+ * record of, which is every project cloned from a template seed. A publisher
7288
+ * running on the site's own origin can fetch these and build with them;
7289
+ * after that publish content holds their hashes and `publicFiles` answers.
7290
+ * `null` when the loader serves no build or does not say.
7291
+ */
7292
+ publicPaths: zod.z.array(zod.z.string()).nullable().optional()
7235
7293
  });
7236
7294
  var parseBuildTarget = function parseBuildTarget(body) {
7237
7295
  return parse(buildTargetResponse, body, "GET /v1/build-target");
@@ -2599,6 +2599,34 @@ var Api = {
2599
2599
  * repository, and from a server that predates it.
2600
2600
  */
2601
2601
  sourceFiles: z.record(z.string(), z.string().nullable()).optional(),
2602
+ /**
2603
+ * The binary files this commit wrote -- an image uploaded in the
2604
+ * Studio -- base64, by path, for a MANAGED project.
2605
+ *
2606
+ * The same reason as `sourceFiles`: the in-tab build publishes the
2607
+ * site, and a file this commit added is in no earlier build. Local
2608
+ * files only; a remote one is served from its own URL and was never
2609
+ * part of a build. A deleted file is a `null` in `sourceFiles`, as
2610
+ * it always was.
2611
+ */
2612
+ binaryFiles: z.record(z.string(), z.string()).optional(),
2613
+ /**
2614
+ * The branch this commit is on, for a MANAGED project -- the
2615
+ * content service's word for it.
2616
+ *
2617
+ * The in-tab build has to name the branch it was made at, and its
2618
+ * only other source is the `val.server.ts` the last build was
2619
+ * wired with: a project cloned from a template seed has one wired
2620
+ * at no commit, so without this its first publish is branchless
2621
+ * and the loader refuses it.
2622
+ */
2623
+ branch: z.string().optional(),
2624
+ /**
2625
+ * Binary files this commit wrote whose bytes the server could not
2626
+ * read back before committing. Named so the Studio refuses to build
2627
+ * a site that would 404 them, rather than publishing it.
2628
+ */
2629
+ binaryFilesUnread: z.array(z.string()).optional(),
2602
2630
  /**
2603
2631
  * Unpublished changes the save threw away because they could not be
2604
2632
  * applied.
@@ -7224,7 +7252,37 @@ var buildTargetResponse = z.object({
7224
7252
  * "there is nothing here yet".
7225
7253
  */
7226
7254
  var projectSourceResponse = z.object({
7227
- files: z.record(z.string(), z.string()).nullable()
7255
+ files: z.record(z.string(), z.string()).nullable(),
7256
+ /**
7257
+ * The live build's `public/*` artifacts, by hash -- what a publisher with no
7258
+ * checkout carries into its build so the site keeps its favicon and images.
7259
+ *
7260
+ * The loader stores public files PER BUILD, so a build that names none
7261
+ * serves none. A publisher with a checkout has them on disk; the Studio has
7262
+ * this. Re-declaring one costs nothing: content holds the bytes for the
7263
+ * project already and asks for no upload.
7264
+ *
7265
+ * `null` when content cannot say -- the live build was not published through
7266
+ * it -- and absent from a content service that predates it. A publisher
7267
+ * must treat both as "unknown", never as "none": publishing on that guess
7268
+ * deletes every public file the site has.
7269
+ */
7270
+ publicFiles: z.array(z.object({
7271
+ key: z.string(),
7272
+ sha256: z.string(),
7273
+ bytes: z.number()["int"]().nonnegative()
7274
+ })).nullable().optional(),
7275
+ /**
7276
+ * The URL paths the live build serves from `public/`, as the loader has
7277
+ * them -- without the bytes' hashes.
7278
+ *
7279
+ * The fallback for when `publicFiles` is `null`: a build content has no
7280
+ * record of, which is every project cloned from a template seed. A publisher
7281
+ * running on the site's own origin can fetch these and build with them;
7282
+ * after that publish content holds their hashes and `publicFiles` answers.
7283
+ * `null` when the loader serves no build or does not say.
7284
+ */
7285
+ publicPaths: z.array(z.string()).nullable().optional()
7228
7286
  });
7229
7287
  var parseBuildTarget = function parseBuildTarget(body) {
7230
7288
  return parse(buildTargetResponse, body, "GET /v1/build-target");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.136.1",
3
+ "version": "0.136.2",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {