@decocms/tanstack 7.43.1 → 7.44.0
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 +4 -4
- package/src/sdk/workerEntry.ts +15 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/tanstack",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.44.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco framework binding for TanStack Start + Cloudflare Workers",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"lint:unused": "knip"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@decocms/blocks": "7.
|
|
28
|
-
"@decocms/blocks-admin": "7.
|
|
29
|
-
"@decocms/blocks-cli": "7.
|
|
27
|
+
"@decocms/blocks": "7.44.0",
|
|
28
|
+
"@decocms/blocks-admin": "7.44.0",
|
|
29
|
+
"@decocms/blocks-cli": "7.44.0",
|
|
30
30
|
"@deco-cx/warp-node": "^0.3.16",
|
|
31
31
|
"fast-json-patch": "^3.1.0",
|
|
32
32
|
"ws": "^8.18.0"
|
package/src/sdk/workerEntry.ts
CHANGED
|
@@ -245,13 +245,13 @@ export interface DecoWorkerEntryOptions {
|
|
|
245
245
|
asJson?: boolean;
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
|
-
* Cross-origin
|
|
249
|
-
*
|
|
250
|
-
* - unset (default)
|
|
251
|
-
* - `string[]`
|
|
252
|
-
* - `
|
|
248
|
+
* Cross-origin access to the `?renderJson` response. It is public page data
|
|
249
|
+
* (secrets + request-derived keys are stripped), so it defaults to open.
|
|
250
|
+
* - unset (default) / `"*"` → any origin, without credentials (public API).
|
|
251
|
+
* - `string[]` → reflect a matching request Origin, *with* credentials.
|
|
252
|
+
* - `false` → no CORS headers (same-origin + native apps only).
|
|
253
253
|
*/
|
|
254
|
-
pageJsonCors?: string[] | "*";
|
|
254
|
+
pageJsonCors?: string[] | "*" | false;
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* Build a full segment key from the incoming request.
|
|
@@ -885,25 +885,27 @@ let _redirectMapRevision: string | null = null;
|
|
|
885
885
|
|
|
886
886
|
/**
|
|
887
887
|
* CORS headers for the `?renderJson` response, from
|
|
888
|
-
* {@link DecoWorkerEntryOptions.pageJsonCors}.
|
|
889
|
-
*
|
|
890
|
-
*
|
|
888
|
+
* {@link DecoWorkerEntryOptions.pageJsonCors}. `?renderJson` is public page data
|
|
889
|
+
* (secrets + request-derived keys are stripped), so the default is `"*"` — any
|
|
890
|
+
* origin, no credentials (the standard public-API CORS). `false` turns it off;
|
|
891
|
+
* a list reflects an allow-listed request Origin *with* credentials.
|
|
891
892
|
*/
|
|
892
893
|
function pageJsonCorsHeaders(
|
|
893
894
|
request: Request,
|
|
894
|
-
cors: string[] | "*" | undefined,
|
|
895
|
+
cors: string[] | "*" | false | undefined,
|
|
895
896
|
): Record<string, string> {
|
|
896
|
-
if (
|
|
897
|
+
if (cors === false) return {}; // explicitly disabled
|
|
898
|
+
const effective = cors ?? "*"; // default: any origin (no credentials)
|
|
897
899
|
const base = {
|
|
898
900
|
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
899
901
|
"Access-Control-Allow-Headers": "Content-Type, If-None-Match, Authorization",
|
|
900
902
|
"Access-Control-Expose-Headers": "ETag",
|
|
901
903
|
};
|
|
902
|
-
if (
|
|
904
|
+
if (effective === "*") {
|
|
903
905
|
return { ...base, "Access-Control-Allow-Origin": "*" };
|
|
904
906
|
}
|
|
905
907
|
const origin = request.headers.get("origin");
|
|
906
|
-
if (origin &&
|
|
908
|
+
if (origin && effective.includes(origin)) {
|
|
907
909
|
return {
|
|
908
910
|
...base,
|
|
909
911
|
"Access-Control-Allow-Origin": origin,
|