@salesforce/ui-bundle 11.56.4 → 11.57.1
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/package.json.js +1 -1
- package/dist/proxy/handler.d.ts +12 -0
- package/dist/proxy/handler.d.ts.map +1 -1
- package/dist/proxy/handler.js +30 -1
- package/package.json +2 -2
package/dist/package.json.js
CHANGED
package/dist/proxy/handler.d.ts
CHANGED
|
@@ -14,6 +14,18 @@ export declare const UIBUNDLE_PROXY_HEADER = "X-Salesforce-UIBundle-Proxy";
|
|
|
14
14
|
export interface ProxyOptions {
|
|
15
15
|
debug?: boolean;
|
|
16
16
|
onTokenRefresh?: (updatedOrgInfo: OrgInfo) => void;
|
|
17
|
+
/**
|
|
18
|
+
* UI-only preview mode. When true, the handler carries no org credential and
|
|
19
|
+
* returns an explicit `403` (`ORG_DATA_DISABLED`) for every org-data route it
|
|
20
|
+
* owns — the matched REST/GraphQL/file-upload routes, the Lightning Out
|
|
21
|
+
* frontdoor, and the whole `${basePath}/services/*` surface (fail-closed, so
|
|
22
|
+
* an endpoint `matchRoute` doesn't recognize is still blocked rather than
|
|
23
|
+
* falling through) — while letting all other requests (shell, HMR, assets,
|
|
24
|
+
* pure routing rewrites/redirects) fall through. Mirrors starting the dev
|
|
25
|
+
* server without authenticating the SF CLI, but as a deliberate kill-switch
|
|
26
|
+
* rather than a no-org error condition.
|
|
27
|
+
*/
|
|
28
|
+
uiOnly?: boolean;
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
19
31
|
* Proxy handler function type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/proxy/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG9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G,MAAM,CAE5D"}
|
package/dist/proxy/handler.js
CHANGED
|
@@ -38,13 +38,25 @@ class UIBundleProxyHandler {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
let pathname = url.pathname;
|
|
41
|
-
|
|
41
|
+
const base = (this.basePath ?? "").replace(/\/$/, "");
|
|
42
|
+
const relPath = pathname.startsWith(base) ? pathname.slice(base.length) : pathname;
|
|
43
|
+
if (relPath === "/__lo/frontdoor") {
|
|
44
|
+
if (this.options?.uiOnly) {
|
|
45
|
+
this.sendOrgDataDisabled(res);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
42
48
|
await this.handleLightningOutFrontdoor(req, res, url);
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
if (this.options?.debug) {
|
|
46
52
|
console.log(`[ui-bundle-proxy] ${req.method} ${pathname}`);
|
|
47
53
|
}
|
|
54
|
+
if (this.options?.uiOnly) {
|
|
55
|
+
if (relPath === "/services" || relPath.startsWith("/services/")) {
|
|
56
|
+
this.sendOrgDataDisabled(res);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
48
60
|
pathname = applyTrailingSlash(pathname, this.manifest.routing?.trailingSlash);
|
|
49
61
|
const match = matchRoute(
|
|
50
62
|
pathname,
|
|
@@ -53,6 +65,10 @@ class UIBundleProxyHandler {
|
|
|
53
65
|
this.manifest.routing?.redirects
|
|
54
66
|
);
|
|
55
67
|
if (match) {
|
|
68
|
+
if (this.options?.uiOnly && (match.type === "api" || match.type === "gql" || match.type === "file-upload")) {
|
|
69
|
+
this.sendOrgDataDisabled(res);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
56
72
|
if (match.type === "api") {
|
|
57
73
|
await this.handleSalesforceApi(req, res, match.path);
|
|
58
74
|
return;
|
|
@@ -153,6 +169,19 @@ class UIBundleProxyHandler {
|
|
|
153
169
|
})
|
|
154
170
|
);
|
|
155
171
|
}
|
|
172
|
+
sendOrgDataDisabled(res) {
|
|
173
|
+
res.writeHead(403, {
|
|
174
|
+
"Content-Type": "application/json",
|
|
175
|
+
[UIBUNDLE_PROXY_HEADER]: "ui-only"
|
|
176
|
+
});
|
|
177
|
+
res.end(
|
|
178
|
+
JSON.stringify({
|
|
179
|
+
error: "ORG_DATA_DISABLED",
|
|
180
|
+
mode: "ui-only",
|
|
181
|
+
message: "This preview is running in UI-only mode — the Salesforce org-data proxy is disabled, so org-data requests are intentionally blocked. Deploy to a preview org to test with live data."
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
}
|
|
156
185
|
sendJson(res, statusCode, body) {
|
|
157
186
|
res.writeHead(statusCode, { "Content-Type": "application/json" });
|
|
158
187
|
res.end(JSON.stringify(body));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle",
|
|
3
3
|
"description": "Core package for Salesforce UI Bundles",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.57.1",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@salesforce/core": "^8.23.4",
|
|
42
|
-
"@salesforce/platform-sdk": "^11.
|
|
42
|
+
"@salesforce/platform-sdk": "^11.57.1",
|
|
43
43
|
"micromatch": "^4.0.8",
|
|
44
44
|
"path-to-regexp": "^8.4.2"
|
|
45
45
|
},
|