@avocadostudio-ai/site-sdk 0.11.5 → 0.11.6

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.
Files changed (2) hide show
  1. package/dist/editor-cors.js +14 -19
  2. package/package.json +6 -6
@@ -9,7 +9,7 @@
9
9
  * site's draft content out of its own browser. Now the development default is
10
10
  * only assumed in development, and a deployment says what it allows.
11
11
  */
12
- import { withLoopbackSpellings } from "@avocadostudio-ai/shared";
12
+ import { withLoopbackSpellings, editorAllowHeaders } from "@avocadostudio-ai/shared";
13
13
  /*
14
14
  * Both spellings of the same loopback address, because the product uses both.
15
15
  *
@@ -80,28 +80,23 @@ export function applyEditorCors(response, requestOrigin) {
80
80
  response.headers.set("Access-Control-Allow-Origin", requestOrigin);
81
81
  response.headers.set("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
82
82
  /*
83
- * `x-access-token` is not optional here, and leaving it out shut the editor.
83
+ * Derived, not restated.
84
84
  *
85
- * The editor installs a global `fetch` wrapper that stamps its access token on
86
- * every request whose *origin* matches the orchestrator's — not whose path
87
- * does. In library mode the orchestrator is mounted inside the site, so
88
- * `/api/avocado/*` and `/api/editor/*` share an origin and both get the
89
- * header. The orchestrator's own CORS lists it; this list did not, so once a
90
- * production gate was configured and a token minted, the browser refused the
91
- * preflight for `/api/editor/blocks` and `/api/editor/pages` — the component
92
- * manifest the whole editing surface is derived from — with the requests
93
- * never leaving the browser. The server saw nothing and logged nothing.
85
+ * This list was a literal, and being a literal is how it shipped one header
86
+ * short in three of four consecutive releases: `x-access-token` missing at
87
+ * 0.11.3 (the component manifest died once a gate existed), then
88
+ * `x-publish-token` missing at 0.11.5 (publish died — the last step of the
89
+ * loop, from a UI that said only "Failed to trigger publish").
94
90
  *
95
- * It only bites in production with a gate on, which is why `curl` and every
96
- * development run looked fine: in development no token exists to stamp.
91
+ * A browser refuses the preflight and the request never leaves it, so the
92
+ * server sees nothing and logs nothing, and `curl` — which sends no
93
+ * `Access-Control-Request-Headers` — reports everything working.
97
94
  *
98
- * These names must stay in step with the `access-control-allow-headers` the
99
- * orchestrator's own preflight sends, in
100
- * `orchestrator-core/src/handler/create-orchestrator.ts`. A header one group accepts
101
- * and the other rejects is indistinguishable, from the browser, from the
102
- * server being down.
95
+ * `EDITOR_REQUEST_HEADERS` is checked against the editor's own source, so a
96
+ * header added to a `fetch` and not to the list fails a test rather than a
97
+ * user's publish. See `shared/src/editor-request-headers.ts`.
103
98
  */
104
- response.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization, x-access-token");
99
+ response.headers.set("Access-Control-Allow-Headers", editorAllowHeaders());
105
100
  return response;
106
101
  }
107
102
  export function createEditorCorsOptionsHandler() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avocadostudio-ai/site-sdk",
3
- "version": "0.11.5",
3
+ "version": "0.11.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -147,17 +147,17 @@
147
147
  ],
148
148
  "dependencies": {
149
149
  "zod": "^4.3.6",
150
- "@avocadostudio-ai/blocks": "^0.11.5",
151
- "@avocadostudio-ai/preview-adapter": "^0.11.5",
152
- "@avocadostudio-ai/richtext": "^0.11.5",
153
- "@avocadostudio-ai/shared": "^0.11.5"
150
+ "@avocadostudio-ai/preview-adapter": "^0.11.6",
151
+ "@avocadostudio-ai/richtext": "^0.11.6",
152
+ "@avocadostudio-ai/shared": "^0.11.6",
153
+ "@avocadostudio-ai/blocks": "^0.11.6"
154
154
  },
155
155
  "peerDependencies": {
156
156
  "next": ">=15.0.0",
157
157
  "react": ">=19.0.0",
158
158
  "react-dom": ">=19.0.0",
159
159
  "better-sqlite3": ">=12.0.0",
160
- "@avocadostudio-ai/orchestrator-core": "^0.11.5"
160
+ "@avocadostudio-ai/orchestrator-core": "^0.11.6"
161
161
  },
162
162
  "peerDependenciesMeta": {
163
163
  "@avocadostudio-ai/orchestrator-core": {