@softr/sdk 0.0.62 → 0.0.63
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/datasource/record.js +11 -5
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { readSessionToken } from "../auth/session.js";
|
|
|
5
5
|
import { isDatasourceAction } from "../action.js";
|
|
6
6
|
import { buildFilterCriteria, buildOrderBy, dealiasFilterCriteria, dealiasOrderBy } from "./filter.js";
|
|
7
7
|
import { andAll, makeFieldSet, makeSortSet } from "./fields.js";
|
|
8
|
-
import { getRequestHeader } from "@tanstack/react-start/server";
|
|
8
|
+
import { getRequestHeader, getRequestUrl } from "@tanstack/react-start/server";
|
|
9
9
|
|
|
10
10
|
//#region src/datasource/record.ts
|
|
11
11
|
const MAX_RECORD_COUNT = 100;
|
|
@@ -17,13 +17,19 @@ const dsUrl = (actionId) => {
|
|
|
17
17
|
return `${withoutTrailingSlash(datasourceApiUrl)}/v1/datasource/vibe/applications/${applicationId}/actions/${actionId}`;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* The datasource API wants to know which page made the call.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* The datasource API wants to know which page made the call, and rejects a call without it.
|
|
21
|
+
*
|
|
22
|
+
* A call from the browser has a Referer on this app's origin, and that Referer names the page.
|
|
23
|
+
* A page load has the previous page as its Referer: Studio, or none for a pasted link.
|
|
24
|
+
* There the page is the request itself, so we send the request URL.
|
|
23
25
|
*/
|
|
24
26
|
function refererHeader() {
|
|
27
|
+
const page = getRequestUrl({
|
|
28
|
+
xForwardedHost: true,
|
|
29
|
+
xForwardedProto: true
|
|
30
|
+
});
|
|
25
31
|
const referer = getRequestHeader("referer");
|
|
26
|
-
return
|
|
32
|
+
return { Referer: referer !== void 0 && URL.parse(referer)?.origin === page.origin ? referer : page.href };
|
|
27
33
|
}
|
|
28
34
|
async function describeFailure(res) {
|
|
29
35
|
const body = await res.json().catch(() => null);
|
package/dist/package.js
CHANGED