@valbuild/shared 0.139.1 → 0.140.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,31 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.140.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#792](https://github.com/valbuild/val/pull/792) [`df1e5f5`](https://github.com/valbuild/val/commit/df1e5f5f94391f25c71839cc476a51198b90db4d) Thanks [@freekh](https://github.com/freekh)! - The Publish button no longer turns green while a publish is still running, in any tab or on any device. Before, the changes being published still counted as unpublished until the publish went live. So from about 64% on the progress, Publish lit up over them again: in the tab that pressed it, in every other open Studio, and on another device.
8
+
9
+ The button now reads "Publishing" for those changes until the publish is live, and you can press it again only for changes made since. If a publish fails, its changes become publishable again straight away.
10
+
11
+ Val Build's content service now reports which changes a running publish holds, and the Studio reads that from `/stat` and the live connection. A content service that doesn't report it keeps the previous behaviour, except in the tab that pressed Publish.
12
+
13
+ ## 0.140.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#769](https://github.com/valbuild/val/pull/769) [`cb93874`](https://github.com/valbuild/val/commit/cb938748aec15fd0ac3814c1696a2dd78ad63c27) Thanks [@freekh](https://github.com/freekh)! - The project name in the Studio's top bar is now a project switcher, for projects connected to Val Build. It shows the project you are in, the projects you pinned and the five you opened most recently, and searches every project in your organisations. Choosing one opens its Studio.
18
+
19
+ The top bar also gets a **Share** button (an icon on a phone). It shows who is in the project's organisation. Owners can create invite links for a role (each works once and expires after 7 days), see and revoke pending links, and change members' roles. Everyone else can see the members and which owners to ask.
20
+
21
+ The assistant can be set up from the Studio too. Settings › Assistant shows the AI key this project runs on and whether it works. From there you can add a key, update it, remove it, or choose one that already exists: the organisation's, your own, or another project's. The assistant's empty state offers the same when no key is set up. Every key is checked with the provider before it is saved, and once a key is saved the assistant turns on without a reload.
22
+
23
+ The panels are served by Val's content server (`content.val.build/wc/v1/project-switcher.js`, `members.js` and `ai-setup.js`), beside the API they read and write, so they can improve without a Val release. The Studio draws the project name and the Share button itself, and loads the switcher and Share panels only when the button is first hovered or clicked, so opening the Studio fetches nothing extra. If a panel cannot load, for example offline or under a strict Content Security Policy, the click opens the same page in Val Build instead, and the AI setup is a link to the project's AI keys there. If your app sets a CSP, allow `script-src https://content.val.build` to get them.
24
+
25
+ They reach Val Build through a new route on your app's Val server, `/api/val/admin/proxy/*`, which adds the editor's existing Val Build session. That route forwards only to the Studio API on Val's content server (`/v1/studio/*` on `VAL_CONTENT_URL`, `https://content.val.build` by default), and only with the `x-val-studio` header that a cross-site request cannot send.
26
+
27
+ In local development they appear once you have run `val login`, and use that login. Without one the Studio keeps the plain project name, as before; it does not load them just to say you are not logged in.
28
+
3
29
  ## 0.139.1
4
30
 
5
31
  ### Patch Changes
@@ -1,6 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import { type ModuleFilePath } from "@valbuild/core";
3
3
  declare const ModuleFilePath: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
4
+ /**
5
+ * The header a request to `/admin/proxy` must carry. A cross-site form or
6
+ * `<img>` cannot set a custom header, so without it the proxy cannot be driven
7
+ * with the editor's cookie from another site.
8
+ */
9
+ export declare const VAL_STUDIO_HEADER = "x-val-studio";
4
10
  /**
5
11
  * A patch group: the set of patches one user has chosen to publish.
6
12
  *
@@ -406,6 +412,7 @@ export declare const Api: {
406
412
  sourcesSha: z.ZodString;
407
413
  patches: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
408
414
  appliedPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
415
+ publishingPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
409
416
  headCommitSha: z.ZodOptional<z.ZodString>;
410
417
  removed: z.ZodOptional<z.ZodArray<z.ZodObject<{
411
418
  patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
@@ -439,6 +446,7 @@ export declare const Api: {
439
446
  commitSha: z.ZodOptional<z.ZodString>;
440
447
  patches: z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>;
441
448
  appliedPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
449
+ publishingPatches: z.ZodOptional<z.ZodArray<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
442
450
  headCommitSha: z.ZodOptional<z.ZodString>;
443
451
  headPatchId: z.ZodOptional<z.ZodNullable<z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>>>;
444
452
  headVersion: z.ZodOptional<z.ZodNumber>;
@@ -1975,6 +1983,95 @@ export declare const Api: {
1975
1983
  }, z.core.$strip>]>;
1976
1984
  };
1977
1985
  };
1986
+ "/admin/status": {
1987
+ GET: {
1988
+ req: {
1989
+ cookies: {
1990
+ val_session: z.ZodOptional<z.ZodString>;
1991
+ };
1992
+ };
1993
+ res: z.ZodObject<{
1994
+ status: z.ZodLiteral<200>;
1995
+ json: z.ZodObject<{
1996
+ connected: z.ZodBoolean;
1997
+ signIn: z.ZodOptional<z.ZodEnum<{
1998
+ "val-login": "val-login";
1999
+ studio: "studio";
2000
+ }>>;
2001
+ }, z.core.$strip>;
2002
+ }, z.core.$strip>;
2003
+ };
2004
+ };
2005
+ "/admin/proxy": {
2006
+ GET: {
2007
+ req: {
2008
+ path: z.ZodString;
2009
+ rawQuery: z.ZodString;
2010
+ headers: {
2011
+ "x-val-studio": z.ZodOptional<z.ZodString>;
2012
+ };
2013
+ cookies: {
2014
+ val_session: z.ZodOptional<z.ZodString>;
2015
+ };
2016
+ body: z.ZodUnknown;
2017
+ };
2018
+ res: z.ZodObject<{
2019
+ status: z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>;
2020
+ json: z.ZodUnknown;
2021
+ }, z.core.$strip>;
2022
+ };
2023
+ POST: {
2024
+ req: {
2025
+ path: z.ZodString;
2026
+ rawQuery: z.ZodString;
2027
+ headers: {
2028
+ "x-val-studio": z.ZodOptional<z.ZodString>;
2029
+ };
2030
+ cookies: {
2031
+ val_session: z.ZodOptional<z.ZodString>;
2032
+ };
2033
+ body: z.ZodUnknown;
2034
+ };
2035
+ res: z.ZodObject<{
2036
+ status: z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>;
2037
+ json: z.ZodUnknown;
2038
+ }, z.core.$strip>;
2039
+ };
2040
+ PUT: {
2041
+ req: {
2042
+ path: z.ZodString;
2043
+ rawQuery: z.ZodString;
2044
+ headers: {
2045
+ "x-val-studio": z.ZodOptional<z.ZodString>;
2046
+ };
2047
+ cookies: {
2048
+ val_session: z.ZodOptional<z.ZodString>;
2049
+ };
2050
+ body: z.ZodUnknown;
2051
+ };
2052
+ res: z.ZodObject<{
2053
+ status: z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>;
2054
+ json: z.ZodUnknown;
2055
+ }, z.core.$strip>;
2056
+ };
2057
+ DELETE: {
2058
+ req: {
2059
+ path: z.ZodString;
2060
+ rawQuery: z.ZodString;
2061
+ headers: {
2062
+ "x-val-studio": z.ZodOptional<z.ZodString>;
2063
+ };
2064
+ cookies: {
2065
+ val_session: z.ZodOptional<z.ZodString>;
2066
+ };
2067
+ body: z.ZodUnknown;
2068
+ };
2069
+ res: z.ZodObject<{
2070
+ status: z.ZodUnion<readonly [z.ZodLiteral<200>, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>;
2071
+ json: z.ZodUnknown;
2072
+ }, z.core.$strip>;
2073
+ };
2074
+ };
1978
2075
  };
1979
2076
  /**
1980
2077
  * Extracts the keys of an object where the value is not undefined.
@@ -2008,6 +2105,16 @@ export type ApiEndpoint = {
2008
2105
  body?: z.ZodTypeAny;
2009
2106
  query?: Record<string, z.ZodSchema<ValidQueryParamTypes, string[] | undefined>>;
2010
2107
  cookies?: Record<string, z.ZodSchema<string | undefined>>;
2108
+ /**
2109
+ * Request headers, by lower-case name, parsed the way `cookies` are.
2110
+ * Absent ones are `undefined`.
2111
+ */
2112
+ headers?: Record<string, z.ZodSchema<string | undefined>>;
2113
+ /**
2114
+ * The query string exactly as sent (`?a=1&b=2`, or `""`), for a route that
2115
+ * forwards it rather than reading it. `query` is for routes that read it.
2116
+ */
2117
+ rawQuery?: z.ZodString;
2011
2118
  };
2012
2119
  res: z.ZodSchema<{
2013
2120
  status: number;
@@ -2036,6 +2143,10 @@ export type ServerOf<Api extends ApiGuard> = {
2036
2143
  cookies: Api[Route][Method]["req"]["cookies"] extends Record<string, z.ZodSchema<string | undefined>> ? {
2037
2144
  [key in keyof Api[Route][Method]["req"]["cookies"]]: z.infer<Api[Route][Method]["req"]["cookies"][key]>;
2038
2145
  } : undefined;
2146
+ headers: Api[Route][Method]["req"]["headers"] extends Record<string, z.ZodSchema<string | undefined>> ? {
2147
+ [key in keyof Api[Route][Method]["req"]["headers"]]: z.infer<Api[Route][Method]["req"]["headers"][key]>;
2148
+ } : undefined;
2149
+ rawQuery: Api[Route][Method]["req"]["rawQuery"] extends z.ZodString ? string : undefined;
2039
2150
  }>) => Promise<z.infer<Api[Route][Method]["res"]>> : never;
2040
2151
  };
2041
2152
  };
@@ -1504,6 +1504,35 @@ var GenericError = zod.z.object({
1504
1504
  message: zod.z.string()
1505
1505
  });
1506
1506
 
1507
+ /**
1508
+ * The header a request to `/admin/proxy` must carry. A cross-site form or
1509
+ * `<img>` cannot set a custom header, so without it the proxy cannot be driven
1510
+ * with the editor's cookie from another site.
1511
+ */
1512
+ var VAL_STUDIO_HEADER = "x-val-studio";
1513
+
1514
+ /**
1515
+ * What Val Build answered, mapped onto the statuses this server speaks: a
1516
+ * `code` in the JSON is what the web components act on, so it is passed
1517
+ * through untouched.
1518
+ */
1519
+ var AdminProxyResponse = zod.z.object({
1520
+ status: zod.z.union([zod.z.literal(200), zod.z.literal(400), zod.z.literal(401), zod.z.literal(403), zod.z.literal(404), zod.z.literal(500)]),
1521
+ json: zod.z.unknown()
1522
+ });
1523
+ function adminProxyEndpoint() {
1524
+ return {
1525
+ req: {
1526
+ path: zod.z.string(),
1527
+ rawQuery: zod.z.string(),
1528
+ headers: getSitemapTree._defineProperty({}, VAL_STUDIO_HEADER, zod.z.string().optional()),
1529
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional()),
1530
+ body: zod.z.unknown()
1531
+ },
1532
+ res: AdminProxyResponse
1533
+ };
1534
+ }
1535
+
1507
1536
  /**
1508
1537
  * What answered when one URL was opened.
1509
1538
  *
@@ -1915,6 +1944,12 @@ var Api = {
1915
1944
  * client that ignores this behaves exactly as it did before.
1916
1945
  */
1917
1946
  appliedPatches: zod.z.array(PatchId).optional(),
1947
+ /*
1948
+ * Of `patches`, the ones a publish that is still running holds.
1949
+ * The Studio does not offer Publish over these. Whole on every
1950
+ * answer: a job that ends without sealing gives them back.
1951
+ */
1952
+ publishingPatches: zod.z.array(PatchId).optional(),
1918
1953
  /**
1919
1954
  * The newest commit, which is the PUBLISH head.
1920
1955
  *
@@ -2005,6 +2040,12 @@ var Api = {
2005
2040
  * client that ignores this behaves exactly as it did before.
2006
2041
  */
2007
2042
  appliedPatches: zod.z.array(PatchId).optional(),
2043
+ /*
2044
+ * Of `patches`, the ones a publish that is still running holds.
2045
+ * The Studio does not offer Publish over these. Whole on every
2046
+ * answer: a job that ends without sealing gives them back.
2047
+ */
2048
+ publishingPatches: zod.z.array(PatchId).optional(),
2008
2049
  /**
2009
2050
  * The newest commit, which is the PUBLISH head.
2010
2051
  *
@@ -3446,6 +3487,50 @@ var Api = {
3446
3487
  json: GenericError
3447
3488
  })])
3448
3489
  }
3490
+ },
3491
+ /*
3492
+ * Val Build, on the editor's behalf, for the web components the Studio
3493
+ * mounts from admin.val.build (`<val-project-switcher>` and the ones after
3494
+ * it). `/admin/proxy/projects/overview?current=…` is
3495
+ * `{valBuildUrl}/api/studio/v1/projects/overview?current=…`, with the
3496
+ * editor's token from the session cookie: the component cannot send that
3497
+ * token itself, because it is in an httpOnly cookie only this server reads.
3498
+ *
3499
+ * A pipe, deliberately: the path, the query and the JSON body go through as
3500
+ * they are, so a new component or endpoint on Val Build needs no Val
3501
+ * release. What it does NOT pass through is anything that would let it be
3502
+ * aimed elsewhere — see `adminProxy.ts`.
3503
+ */
3504
+ /*
3505
+ * Whether this Studio has a Val Build credential for the editor: a session,
3506
+ * or in local development a `val login`. The Studio asks before it loads a
3507
+ * web component, so a developer who never logged in sees the plain project
3508
+ * name rather than a component explaining that they are not logged in.
3509
+ */
3510
+ "/admin/status": {
3511
+ GET: {
3512
+ req: {
3513
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
3514
+ },
3515
+ res: zod.z.object({
3516
+ status: zod.z.literal(200),
3517
+ json: zod.z.object({
3518
+ connected: zod.z["boolean"](),
3519
+ /**
3520
+ * `val-login` on a developer's own checkout, `studio` anywhere the
3521
+ * Studio's sign-in is the way in. Optional: an older server does
3522
+ * not send it.
3523
+ */
3524
+ signIn: zod.z["enum"](["val-login", "studio"]).optional()
3525
+ })
3526
+ })
3527
+ }
3528
+ },
3529
+ "/admin/proxy": {
3530
+ GET: adminProxyEndpoint(),
3531
+ POST: adminProxyEndpoint(),
3532
+ PUT: adminProxyEndpoint(),
3533
+ DELETE: adminProxyEndpoint()
3449
3534
  }
3450
3535
  };
3451
3536
 
@@ -7772,6 +7857,7 @@ exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
7772
7857
  exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
7773
7858
  exports.VAL_SESSION_COOKIE = VAL_SESSION_COOKIE;
7774
7859
  exports.VAL_STATE_COOKIE = VAL_STATE_COOKIE;
7860
+ exports.VAL_STUDIO_HEADER = VAL_STUDIO_HEADER;
7775
7861
  exports.ValCommit = ValCommit;
7776
7862
  exports.ValDeployment = ValDeployment;
7777
7863
  exports.accentRamp = accentRamp;
@@ -1504,6 +1504,35 @@ var GenericError = zod.z.object({
1504
1504
  message: zod.z.string()
1505
1505
  });
1506
1506
 
1507
+ /**
1508
+ * The header a request to `/admin/proxy` must carry. A cross-site form or
1509
+ * `<img>` cannot set a custom header, so without it the proxy cannot be driven
1510
+ * with the editor's cookie from another site.
1511
+ */
1512
+ var VAL_STUDIO_HEADER = "x-val-studio";
1513
+
1514
+ /**
1515
+ * What Val Build answered, mapped onto the statuses this server speaks: a
1516
+ * `code` in the JSON is what the web components act on, so it is passed
1517
+ * through untouched.
1518
+ */
1519
+ var AdminProxyResponse = zod.z.object({
1520
+ status: zod.z.union([zod.z.literal(200), zod.z.literal(400), zod.z.literal(401), zod.z.literal(403), zod.z.literal(404), zod.z.literal(500)]),
1521
+ json: zod.z.unknown()
1522
+ });
1523
+ function adminProxyEndpoint() {
1524
+ return {
1525
+ req: {
1526
+ path: zod.z.string(),
1527
+ rawQuery: zod.z.string(),
1528
+ headers: getSitemapTree._defineProperty({}, VAL_STUDIO_HEADER, zod.z.string().optional()),
1529
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional()),
1530
+ body: zod.z.unknown()
1531
+ },
1532
+ res: AdminProxyResponse
1533
+ };
1534
+ }
1535
+
1507
1536
  /**
1508
1537
  * What answered when one URL was opened.
1509
1538
  *
@@ -1915,6 +1944,12 @@ var Api = {
1915
1944
  * client that ignores this behaves exactly as it did before.
1916
1945
  */
1917
1946
  appliedPatches: zod.z.array(PatchId).optional(),
1947
+ /*
1948
+ * Of `patches`, the ones a publish that is still running holds.
1949
+ * The Studio does not offer Publish over these. Whole on every
1950
+ * answer: a job that ends without sealing gives them back.
1951
+ */
1952
+ publishingPatches: zod.z.array(PatchId).optional(),
1918
1953
  /**
1919
1954
  * The newest commit, which is the PUBLISH head.
1920
1955
  *
@@ -2005,6 +2040,12 @@ var Api = {
2005
2040
  * client that ignores this behaves exactly as it did before.
2006
2041
  */
2007
2042
  appliedPatches: zod.z.array(PatchId).optional(),
2043
+ /*
2044
+ * Of `patches`, the ones a publish that is still running holds.
2045
+ * The Studio does not offer Publish over these. Whole on every
2046
+ * answer: a job that ends without sealing gives them back.
2047
+ */
2048
+ publishingPatches: zod.z.array(PatchId).optional(),
2008
2049
  /**
2009
2050
  * The newest commit, which is the PUBLISH head.
2010
2051
  *
@@ -3446,6 +3487,50 @@ var Api = {
3446
3487
  json: GenericError
3447
3488
  })])
3448
3489
  }
3490
+ },
3491
+ /*
3492
+ * Val Build, on the editor's behalf, for the web components the Studio
3493
+ * mounts from admin.val.build (`<val-project-switcher>` and the ones after
3494
+ * it). `/admin/proxy/projects/overview?current=…` is
3495
+ * `{valBuildUrl}/api/studio/v1/projects/overview?current=…`, with the
3496
+ * editor's token from the session cookie: the component cannot send that
3497
+ * token itself, because it is in an httpOnly cookie only this server reads.
3498
+ *
3499
+ * A pipe, deliberately: the path, the query and the JSON body go through as
3500
+ * they are, so a new component or endpoint on Val Build needs no Val
3501
+ * release. What it does NOT pass through is anything that would let it be
3502
+ * aimed elsewhere — see `adminProxy.ts`.
3503
+ */
3504
+ /*
3505
+ * Whether this Studio has a Val Build credential for the editor: a session,
3506
+ * or in local development a `val login`. The Studio asks before it loads a
3507
+ * web component, so a developer who never logged in sees the plain project
3508
+ * name rather than a component explaining that they are not logged in.
3509
+ */
3510
+ "/admin/status": {
3511
+ GET: {
3512
+ req: {
3513
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
3514
+ },
3515
+ res: zod.z.object({
3516
+ status: zod.z.literal(200),
3517
+ json: zod.z.object({
3518
+ connected: zod.z["boolean"](),
3519
+ /**
3520
+ * `val-login` on a developer's own checkout, `studio` anywhere the
3521
+ * Studio's sign-in is the way in. Optional: an older server does
3522
+ * not send it.
3523
+ */
3524
+ signIn: zod.z["enum"](["val-login", "studio"]).optional()
3525
+ })
3526
+ })
3527
+ }
3528
+ },
3529
+ "/admin/proxy": {
3530
+ GET: adminProxyEndpoint(),
3531
+ POST: adminProxyEndpoint(),
3532
+ PUT: adminProxyEndpoint(),
3533
+ DELETE: adminProxyEndpoint()
3449
3534
  }
3450
3535
  };
3451
3536
 
@@ -7772,6 +7857,7 @@ exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
7772
7857
  exports.VAL_GREEN_RAMP = VAL_GREEN_RAMP;
7773
7858
  exports.VAL_SESSION_COOKIE = VAL_SESSION_COOKIE;
7774
7859
  exports.VAL_STATE_COOKIE = VAL_STATE_COOKIE;
7860
+ exports.VAL_STUDIO_HEADER = VAL_STUDIO_HEADER;
7775
7861
  exports.ValCommit = ValCommit;
7776
7862
  exports.ValDeployment = ValDeployment;
7777
7863
  exports.accentRamp = accentRamp;
@@ -1497,6 +1497,35 @@ var GenericError = z.object({
1497
1497
  message: z.string()
1498
1498
  });
1499
1499
 
1500
+ /**
1501
+ * The header a request to `/admin/proxy` must carry. A cross-site form or
1502
+ * `<img>` cannot set a custom header, so without it the proxy cannot be driven
1503
+ * with the editor's cookie from another site.
1504
+ */
1505
+ var VAL_STUDIO_HEADER = "x-val-studio";
1506
+
1507
+ /**
1508
+ * What Val Build answered, mapped onto the statuses this server speaks: a
1509
+ * `code` in the JSON is what the web components act on, so it is passed
1510
+ * through untouched.
1511
+ */
1512
+ var AdminProxyResponse = z.object({
1513
+ status: z.union([z.literal(200), z.literal(400), z.literal(401), z.literal(403), z.literal(404), z.literal(500)]),
1514
+ json: z.unknown()
1515
+ });
1516
+ function adminProxyEndpoint() {
1517
+ return {
1518
+ req: {
1519
+ path: z.string(),
1520
+ rawQuery: z.string(),
1521
+ headers: _defineProperty({}, VAL_STUDIO_HEADER, z.string().optional()),
1522
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional()),
1523
+ body: z.unknown()
1524
+ },
1525
+ res: AdminProxyResponse
1526
+ };
1527
+ }
1528
+
1500
1529
  /**
1501
1530
  * What answered when one URL was opened.
1502
1531
  *
@@ -1908,6 +1937,12 @@ var Api = {
1908
1937
  * client that ignores this behaves exactly as it did before.
1909
1938
  */
1910
1939
  appliedPatches: z.array(PatchId).optional(),
1940
+ /*
1941
+ * Of `patches`, the ones a publish that is still running holds.
1942
+ * The Studio does not offer Publish over these. Whole on every
1943
+ * answer: a job that ends without sealing gives them back.
1944
+ */
1945
+ publishingPatches: z.array(PatchId).optional(),
1911
1946
  /**
1912
1947
  * The newest commit, which is the PUBLISH head.
1913
1948
  *
@@ -1998,6 +2033,12 @@ var Api = {
1998
2033
  * client that ignores this behaves exactly as it did before.
1999
2034
  */
2000
2035
  appliedPatches: z.array(PatchId).optional(),
2036
+ /*
2037
+ * Of `patches`, the ones a publish that is still running holds.
2038
+ * The Studio does not offer Publish over these. Whole on every
2039
+ * answer: a job that ends without sealing gives them back.
2040
+ */
2041
+ publishingPatches: z.array(PatchId).optional(),
2001
2042
  /**
2002
2043
  * The newest commit, which is the PUBLISH head.
2003
2044
  *
@@ -3439,6 +3480,50 @@ var Api = {
3439
3480
  json: GenericError
3440
3481
  })])
3441
3482
  }
3483
+ },
3484
+ /*
3485
+ * Val Build, on the editor's behalf, for the web components the Studio
3486
+ * mounts from admin.val.build (`<val-project-switcher>` and the ones after
3487
+ * it). `/admin/proxy/projects/overview?current=…` is
3488
+ * `{valBuildUrl}/api/studio/v1/projects/overview?current=…`, with the
3489
+ * editor's token from the session cookie: the component cannot send that
3490
+ * token itself, because it is in an httpOnly cookie only this server reads.
3491
+ *
3492
+ * A pipe, deliberately: the path, the query and the JSON body go through as
3493
+ * they are, so a new component or endpoint on Val Build needs no Val
3494
+ * release. What it does NOT pass through is anything that would let it be
3495
+ * aimed elsewhere — see `adminProxy.ts`.
3496
+ */
3497
+ /*
3498
+ * Whether this Studio has a Val Build credential for the editor: a session,
3499
+ * or in local development a `val login`. The Studio asks before it loads a
3500
+ * web component, so a developer who never logged in sees the plain project
3501
+ * name rather than a component explaining that they are not logged in.
3502
+ */
3503
+ "/admin/status": {
3504
+ GET: {
3505
+ req: {
3506
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
3507
+ },
3508
+ res: z.object({
3509
+ status: z.literal(200),
3510
+ json: z.object({
3511
+ connected: z["boolean"](),
3512
+ /**
3513
+ * `val-login` on a developer's own checkout, `studio` anywhere the
3514
+ * Studio's sign-in is the way in. Optional: an older server does
3515
+ * not send it.
3516
+ */
3517
+ signIn: z["enum"](["val-login", "studio"]).optional()
3518
+ })
3519
+ })
3520
+ }
3521
+ },
3522
+ "/admin/proxy": {
3523
+ GET: adminProxyEndpoint(),
3524
+ POST: adminProxyEndpoint(),
3525
+ PUT: adminProxyEndpoint(),
3526
+ DELETE: adminProxyEndpoint()
3442
3527
  }
3443
3528
  };
3444
3529
 
@@ -7676,4 +7761,4 @@ function parse(schema, body, call) {
7676
7761
  return parsed.data;
7677
7762
  }
7678
7763
 
7679
- export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, PublishProtocolError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, memoizePerRequest, newestCommitSha, parseArtifacts, parseBuildTarget, parseCancel, parseDeclare, parseDiscard, parseJob, parseNewestCiRun, parsePress, parseProblems, parseProjectSource, parsePromote, parsePublishToken, parseRenew, parseRequestStatus, parseStatus, parseUpdateTarget, parseVerify, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
7764
+ export { AA_LARGE, AA_TEXT, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchGroup, PatchId, PatchJSON, PublishProtocolError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, explainIncompatible, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, indexModule, isMimeTypeAccepted, isRemoteSchema, isSchemaSourceFixError, isSkippedSource, keyOfRecordPath, levenshtein, localeAt, memoizePerRequest, newestCommitSha, parseArtifacts, parseBuildTarget, parseCancel, parseDeclare, parseDiscard, parseJob, parseNewestCiRun, parsePress, parseProblems, parseProjectSource, parsePromote, parsePublishToken, parseRenew, parseRequestStatus, parseStatus, parseUpdateTarget, parseVerify, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextToRemirror, safeParsePatch, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.139.1",
3
+ "version": "0.140.2",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {