@tokenoftrust/storefront-runner 2.4.46 → 2.4.48
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.
|
@@ -45,7 +45,12 @@ export class FetchHttpTransport implements HttpTransport, HttpGetTransport {
|
|
|
45
45
|
async post(url: string, headers: Record<string, string>, body: unknown): Promise<HttpResponseLike> {
|
|
46
46
|
const res = await fetch(url, {
|
|
47
47
|
method: "POST",
|
|
48
|
-
|
|
48
|
+
// `post()` always JSON.stringify()s the body below, so every call sends JSON —
|
|
49
|
+
// declare it by default rather than leaving a caller that forgets its own
|
|
50
|
+
// `content-type` to silently send an unparseable body (the receiving server's
|
|
51
|
+
// JSON body-parser skips a request with no/wrong content-type and sees an empty
|
|
52
|
+
// body). A per-call or per-transport header of the same name still wins.
|
|
53
|
+
headers: { "content-type": "application/json", ...this.defaultHeaders, ...headers },
|
|
49
54
|
body: JSON.stringify(body),
|
|
50
55
|
signal: this.signal(),
|
|
51
56
|
});
|
|
@@ -80,6 +80,9 @@ export async function callMcpService(req: McpServiceRequest): Promise<McpService
|
|
|
80
80
|
);
|
|
81
81
|
return { kind: "misconfigured", status: res.status, reason };
|
|
82
82
|
}
|
|
83
|
-
if (res.status < 200 || res.status >= 300)
|
|
83
|
+
if (res.status < 200 || res.status >= 300) {
|
|
84
|
+
console.error(`[mcp-service-seam] ${req.method} ${req.path} answered ${res.status}`);
|
|
85
|
+
return { kind: "http-error", status: res.status };
|
|
86
|
+
}
|
|
84
87
|
return { kind: "ok", status: res.status, json: () => res.json() };
|
|
85
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.48",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|
|
@@ -134,18 +134,16 @@ export function applyDeclaredTenantConfig(tenant, declared) {
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
* The declaration a tenant repo commits at `ref`, read through any source with the
|
|
137
|
-
* reconcile's `readFile(path, ref)` shape. `{}` when the file is absent
|
|
137
|
+
* reconcile's `readFile(path, ref)` shape. `{}` when the file is absent. A read that fails
|
|
138
|
+
* or a file that does not parse THROWS: an unknown declaration is never "declares nothing",
|
|
139
|
+
* which would judge a regulated store as unregulated.
|
|
138
140
|
*
|
|
139
141
|
* @param {{ readFile(path: string, ref: string): Promise<string | null> }} source
|
|
140
142
|
* @param {string} ref
|
|
141
143
|
*/
|
|
142
144
|
export async function readDeclaredTenantConfigAt(source, ref) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return raw ? declaredTenantConfig(JSON.parse(raw)) : {};
|
|
146
|
-
} catch {
|
|
147
|
-
return {};
|
|
148
|
-
}
|
|
145
|
+
const raw = await source.readFile(".tot/config.json", ref);
|
|
146
|
+
return raw ? declaredTenantConfig(JSON.parse(raw)) : {};
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
/**
|