openxiangda 1.0.155 → 1.0.156
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/openxiangda-skills/references/pages/page-sdk.md +1 -1
- package/openxiangda-skills/references/troubleshooting.md +12 -0
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +2 -1
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +2 -1
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +54 -15
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +54 -15
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +54 -15
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.mjs +54 -15
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/AGENTS.md +1 -1
|
@@ -3824,7 +3824,38 @@ var toRuntimeResponse = (response) => {
|
|
|
3824
3824
|
};
|
|
3825
3825
|
};
|
|
3826
3826
|
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
3827
|
+
var FILE_URL_KEYS = [
|
|
3828
|
+
"url",
|
|
3829
|
+
"downloadUrl",
|
|
3830
|
+
"publicUrl",
|
|
3831
|
+
"relayUrl",
|
|
3832
|
+
"previewUrl",
|
|
3833
|
+
"metadataUrl",
|
|
3834
|
+
"officeTextPreviewUrl"
|
|
3835
|
+
];
|
|
3836
|
+
var resolveServicePrefix = (sdk) => {
|
|
3837
|
+
const value = sdk.context?.env?.servicePrefix;
|
|
3838
|
+
return typeof value === "string" && value.trim() ? value.trim().replace(/\/+$/, "") : "/service";
|
|
3839
|
+
};
|
|
3840
|
+
var normalizeServiceFileUrl = (value, servicePrefix) => {
|
|
3841
|
+
if (typeof value !== "string" || !value) return value;
|
|
3842
|
+
if (/^(https?:)?\/\//i.test(value) || /^(blob|data):/i.test(value)) return value;
|
|
3843
|
+
if (value === servicePrefix || value.startsWith(`${servicePrefix}/`)) return value;
|
|
3844
|
+
return value.startsWith("/file/") ? `${servicePrefix}${value}` : value;
|
|
3845
|
+
};
|
|
3846
|
+
var normalizeFileTicketResult2 = (payload, servicePrefix) => {
|
|
3847
|
+
if (typeof payload === "string") {
|
|
3848
|
+
return normalizeServiceFileUrl(payload, servicePrefix);
|
|
3849
|
+
}
|
|
3850
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return payload;
|
|
3851
|
+
const normalized = { ...payload };
|
|
3852
|
+
FILE_URL_KEYS.forEach((key) => {
|
|
3853
|
+
normalized[key] = normalizeServiceFileUrl(normalized[key], servicePrefix);
|
|
3854
|
+
});
|
|
3855
|
+
return normalized;
|
|
3856
|
+
};
|
|
3827
3857
|
var createPageFormRuntimeApi = (sdk) => {
|
|
3858
|
+
const servicePrefix = resolveServicePrefix(sdk);
|
|
3828
3859
|
const request = async (config) => {
|
|
3829
3860
|
const options = toPageRequest(config);
|
|
3830
3861
|
if (config.responseType === "blob") {
|
|
@@ -3834,22 +3865,29 @@ var createPageFormRuntimeApi = (sdk) => {
|
|
|
3834
3865
|
return toRuntimeResponse(await sdk.transport.request(options));
|
|
3835
3866
|
};
|
|
3836
3867
|
return createFormRuntimeApi({
|
|
3868
|
+
baseUrl: servicePrefix,
|
|
3837
3869
|
request,
|
|
3838
|
-
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) =>
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3870
|
+
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => normalizeFileTicketResult2(
|
|
3871
|
+
unwrapPageResult(
|
|
3872
|
+
await sdk.createFileAccessTicket(
|
|
3873
|
+
bucketName,
|
|
3874
|
+
objectName,
|
|
3875
|
+
fileName,
|
|
3876
|
+
purpose,
|
|
3877
|
+
options
|
|
3878
|
+
)
|
|
3879
|
+
),
|
|
3880
|
+
servicePrefix
|
|
3846
3881
|
),
|
|
3847
|
-
createDownloadTicket: async (bucketName, objectName, fileName) =>
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3882
|
+
createDownloadTicket: async (bucketName, objectName, fileName) => normalizeFileTicketResult2(
|
|
3883
|
+
unwrapPageResult(
|
|
3884
|
+
await sdk.request({
|
|
3885
|
+
path: "/file/download-ticket",
|
|
3886
|
+
method: "post",
|
|
3887
|
+
body: { bucketName, objectName, fileName }
|
|
3888
|
+
})
|
|
3889
|
+
),
|
|
3890
|
+
servicePrefix
|
|
3853
3891
|
)
|
|
3854
3892
|
});
|
|
3855
3893
|
};
|
|
@@ -5435,7 +5473,8 @@ var useFilePreviewController = ({
|
|
|
5435
5473
|
);
|
|
5436
5474
|
url = typeof ticket === "string" ? ticket : ticket?.downloadUrl || ticket?.relayUrl || ticket?.url || url;
|
|
5437
5475
|
}
|
|
5438
|
-
|
|
5476
|
+
const resolvedUrl = resolvePreviewServiceUrl(url);
|
|
5477
|
+
if (resolvedUrl && typeof window !== "undefined") window.location.assign(resolvedUrl);
|
|
5439
5478
|
},
|
|
5440
5479
|
[api, bucketName]
|
|
5441
5480
|
);
|