@base44-preview/sdk 0.8.37-pr.227.6e9ea56 → 0.8.37-pr.228.93ccd45
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/dist/client.js +9 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -346,6 +346,7 @@ export function createClientFromRequest(request) {
|
|
|
346
346
|
const serverUrlHeader = request.headers.get("Base44-Api-Url");
|
|
347
347
|
const functionsVersion = request.headers.get("Base44-Functions-Version");
|
|
348
348
|
const stateHeader = request.headers.get("Base44-State");
|
|
349
|
+
const dataEnvHeader = request.headers.get("X-Data-Env");
|
|
349
350
|
if (!appId) {
|
|
350
351
|
throw new Error("Base44-App-Id header is required, but is was not found on the request");
|
|
351
352
|
}
|
|
@@ -373,6 +374,14 @@ export function createClientFromRequest(request) {
|
|
|
373
374
|
if (stateHeader) {
|
|
374
375
|
additionalHeaders["Base44-State"] = stateHeader;
|
|
375
376
|
}
|
|
377
|
+
// Propagate the data environment so entity operations from the function stay
|
|
378
|
+
// in the same environment (e.g. test data) as the triggering request. This
|
|
379
|
+
// matters for the user-scoped client: unlike the service token, the user JWT
|
|
380
|
+
// carries no data-env, so without forwarding this header the callbacks fall
|
|
381
|
+
// back to production data even when the app runs in test-data mode.
|
|
382
|
+
if (dataEnvHeader) {
|
|
383
|
+
additionalHeaders["X-Data-Env"] = dataEnvHeader;
|
|
384
|
+
}
|
|
376
385
|
return createClient({
|
|
377
386
|
serverUrl: serverUrlHeader || "https://base44.app",
|
|
378
387
|
appId,
|