@sandboxsonny/ace-kit 0.1.1 → 0.1.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,11 @@
1
1
  # @sandboxsonny/ace-kit
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7980e43: Server-rendered sites now identify themselves to the API with a header of their own, `X-Ace-Site-Domain`, as well as `X-Forwarded-Host`. Some platforms' proxies (Railway's, for one) rewrite `X-Forwarded-Host` on the way in, so the API could not tell which site was asking and answered "no site for this domain". Needs a CMS Ace API that reads the new header; against an older API the site works as before wherever the proxy leaves `X-Forwarded-Host` alone.
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ### Patch Changes
package/dist/astro.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createAceClient, loadMenuLinks, loadPage } from './chunk-KLRCWAE4.js';
1
+ import { createAceClient, loadMenuLinks, loadPage } from './chunk-XYOW63V6.js';
2
2
  import './chunk-M5WR5TCR.js';
3
3
  import './chunk-YLO6IAXF.js';
4
4
  import { ACE_SITE_DOMAIN, ACE_API_URL } from 'astro:env/server';
@@ -39,7 +39,7 @@ function createAceClient({
39
39
  let response;
40
40
  try {
41
41
  response = await fetchImplementation(`${apiUrl.replace(/\/+$/, "")}${path}`, {
42
- headers: { Accept: "application/json", "X-Forwarded-Host": siteDomain },
42
+ headers: { Accept: "application/json", "X-Ace-Site-Domain": siteDomain, "X-Forwarded-Host": siteDomain },
43
43
  signal: AbortSignal.timeout(requestTimeoutMilliseconds)
44
44
  });
45
45
  } catch {
package/dist/cli.js CHANGED
@@ -43,7 +43,7 @@ function createAceClient({
43
43
  let response;
44
44
  try {
45
45
  response = await fetchImplementation(`${apiUrl.replace(/\/+$/, "")}${path}`, {
46
- headers: { Accept: "application/json", "X-Forwarded-Host": siteDomain },
46
+ headers: { Accept: "application/json", "X-Ace-Site-Domain": siteDomain, "X-Forwarded-Host": siteDomain },
47
47
  signal: AbortSignal.timeout(requestTimeoutMilliseconds)
48
48
  });
49
49
  } catch {
package/dist/index.d.ts CHANGED
@@ -86,7 +86,8 @@ type AceNavigationLink = {
86
86
 
87
87
  /**
88
88
  * A client for the CMS Ace public API. It runs on the server only, so the visitor's browser never talks to the
89
- * API. The API finds the site from X-Forwarded-Host, which this client sets to the site's domain.
89
+ * API. The API finds the site from X-Ace-Site-Domain, which this client sets to the site's domain. X-Forwarded-Host
90
+ * is sent too, for an API that predates the first (some platforms' proxies rewrite X-Forwarded-Host on the way in).
90
91
  */
91
92
  declare function createAceClient({ apiUrl, siteDomain, cacheSeconds, fetchImplementation, now, }: AceClientOptions): {
92
93
  /**
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { pageNotices } from './chunk-XPZY5R5A.js';
2
2
  export { headingLevel, imageAttributes, isInternalPath, linkAddress, listStart, renderRichText, renderTextArea, richTextImageSizes } from './chunk-URLKW2YS.js';
3
3
  export { listenForPreviewRefresh, refreshPageContent } from './chunk-YN7LJWGI.js';
4
- export { AcePreviewExpiredError, AceUnavailableError, createAceClient, isCurrentPage, linksFromMenu, loadMenuLinks, loadPage } from './chunk-KLRCWAE4.js';
4
+ export { AcePreviewExpiredError, AceUnavailableError, createAceClient, isCurrentPage, linksFromMenu, loadMenuLinks, loadPage } from './chunk-XYOW63V6.js';
5
5
  export { addressFromPath, homeAddress, isHomeAddress, pathOfAddress, visitablePath } from './chunk-M5WR5TCR.js';
6
6
  export { addFramingPolicy, framingPolicy, isRefreshRequest, originOf, previewHeaders, previewParameter, previewTokenFrom, refreshMessageType, swapPageContent } from './chunk-YLO6IAXF.js';
@@ -89,7 +89,8 @@ type AceContentTypeSchema = {
89
89
 
90
90
  /**
91
91
  * A client for the CMS Ace public API. It runs on the server only, so the visitor's browser never talks to the
92
- * API. The API finds the site from X-Forwarded-Host, which this client sets to the site's domain.
92
+ * API. The API finds the site from X-Ace-Site-Domain, which this client sets to the site's domain. X-Forwarded-Host
93
+ * is sent too, for an API that predates the first (some platforms' proxies rewrite X-Forwarded-Host on the way in).
93
94
  */
94
95
  declare function createAceClient({ apiUrl, siteDomain, cacheSeconds, fetchImplementation, now, }: AceClientOptions): {
95
96
  /**
@@ -1,4 +1,4 @@
1
- import { createAceClient, loadMenuLinks, loadPage } from './chunk-KLRCWAE4.js';
1
+ import { createAceClient, loadMenuLinks, loadPage } from './chunk-XYOW63V6.js';
2
2
  import './chunk-M5WR5TCR.js';
3
3
  import { previewTokenFrom, addFramingPolicy } from './chunk-YLO6IAXF.js';
4
4
  import { createReadableStreamFromReadable } from '@react-router/node';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandboxsonny/ace-kit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Everything a website needs to use CMS Ace: a typed client, addressing, images, menus, rich text, live preview, and Astro and React adapters.",
5
5
  "keywords": [
6
6
  "cms",