@stelstone/server 0.30.0 → 0.30.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stelstone/server",
3
- "version": "0.30.0",
3
+ "version": "0.30.1",
4
4
  "description": "Runtime-agnostic CMS server built on the Web Fetch API, with pluggable adapters for content, media, auth, and build.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/routes.mjs CHANGED
@@ -87,7 +87,12 @@ export const apiRoutes = [
87
87
  handler: ({ env, runtime, adminUiVersion }) =>
88
88
  ok({
89
89
  serverVersion: SERVER_VERSION,
90
- adminUiVersion: adminUiVersion ?? null,
90
+ // The Node server reads this off the package it resolved. A Worker
91
+ // cannot: the SPA is served by the assets binding and its package.json
92
+ // is not in the bundle. The deployment composed that directory, so it
93
+ // can state the version the way it states the commit below — a stated
94
+ // version beats a null on the About screen.
95
+ adminUiVersion: adminUiVersion ?? env("CMS_ADMIN_UI_VERSION") ?? null,
91
96
  // Declared by whoever constructed the handler, not sniffed: with
92
97
  // nodejs_compat enabled a Worker also exposes process.versions.node,
93
98
  // so feature detection reported "node" from inside a Worker.
@@ -643,11 +648,20 @@ export const apiRoutes = [
643
648
  method: "GET",
644
649
  path: "/api/deploy/status",
645
650
  auth: "any",
646
- handler: async ({ adapters, query }) => {
651
+ handler: async ({ adapters, config, query }) => {
647
652
  if (!adapters.build.configured) return ok({ configured: false });
653
+ // Which branch's build to watch. After publishing to a target the new
654
+ // commit exists only on that target's branch, so without this the run
655
+ // is looked for on the deploy branch and never found — the pill then
656
+ // spins until it gives up, for a build that actually succeeded.
657
+ const target = resolveTarget(config, query.target);
658
+ if (target.error) return { status: 400, json: { error: target.error } };
648
659
  try {
649
660
  return ok(
650
- await adapters.build.getDeployStatus({ branch: query.branch, sha: query.sha }),
661
+ await adapters.build.getDeployStatus({
662
+ branch: target.branch ?? query.branch,
663
+ sha: query.sha,
664
+ }),
651
665
  );
652
666
  } catch (err) {
653
667
  if (err.upstreamStatus) {
package/src/version.mjs CHANGED
@@ -5,4 +5,4 @@
5
5
  * require() and no import.meta.url, so reading the manifest at runtime yields
6
6
  * "unknown" there.
7
7
  */
8
- export const SERVER_VERSION = "0.30.0";
8
+ export const SERVER_VERSION = "0.30.1";