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
|
@@ -3919,7 +3919,38 @@ var toRuntimeResponse = (response) => {
|
|
|
3919
3919
|
};
|
|
3920
3920
|
};
|
|
3921
3921
|
var unwrapPageResult = (response) => response.result ?? response.data ?? null;
|
|
3922
|
+
var FILE_URL_KEYS = [
|
|
3923
|
+
"url",
|
|
3924
|
+
"downloadUrl",
|
|
3925
|
+
"publicUrl",
|
|
3926
|
+
"relayUrl",
|
|
3927
|
+
"previewUrl",
|
|
3928
|
+
"metadataUrl",
|
|
3929
|
+
"officeTextPreviewUrl"
|
|
3930
|
+
];
|
|
3931
|
+
var resolveServicePrefix = (sdk) => {
|
|
3932
|
+
const value = sdk.context?.env?.servicePrefix;
|
|
3933
|
+
return typeof value === "string" && value.trim() ? value.trim().replace(/\/+$/, "") : "/service";
|
|
3934
|
+
};
|
|
3935
|
+
var normalizeServiceFileUrl = (value, servicePrefix) => {
|
|
3936
|
+
if (typeof value !== "string" || !value) return value;
|
|
3937
|
+
if (/^(https?:)?\/\//i.test(value) || /^(blob|data):/i.test(value)) return value;
|
|
3938
|
+
if (value === servicePrefix || value.startsWith(`${servicePrefix}/`)) return value;
|
|
3939
|
+
return value.startsWith("/file/") ? `${servicePrefix}${value}` : value;
|
|
3940
|
+
};
|
|
3941
|
+
var normalizeFileTicketResult2 = (payload, servicePrefix) => {
|
|
3942
|
+
if (typeof payload === "string") {
|
|
3943
|
+
return normalizeServiceFileUrl(payload, servicePrefix);
|
|
3944
|
+
}
|
|
3945
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return payload;
|
|
3946
|
+
const normalized = { ...payload };
|
|
3947
|
+
FILE_URL_KEYS.forEach((key) => {
|
|
3948
|
+
normalized[key] = normalizeServiceFileUrl(normalized[key], servicePrefix);
|
|
3949
|
+
});
|
|
3950
|
+
return normalized;
|
|
3951
|
+
};
|
|
3922
3952
|
var createPageFormRuntimeApi = (sdk) => {
|
|
3953
|
+
const servicePrefix = resolveServicePrefix(sdk);
|
|
3923
3954
|
const request = async (config) => {
|
|
3924
3955
|
const options = toPageRequest(config);
|
|
3925
3956
|
if (config.responseType === "blob") {
|
|
@@ -3929,22 +3960,29 @@ var createPageFormRuntimeApi = (sdk) => {
|
|
|
3929
3960
|
return toRuntimeResponse(await sdk.transport.request(options));
|
|
3930
3961
|
};
|
|
3931
3962
|
return createFormRuntimeApi({
|
|
3963
|
+
baseUrl: servicePrefix,
|
|
3932
3964
|
request,
|
|
3933
|
-
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) =>
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3965
|
+
createFileAccessTicket: async (bucketName, objectName, fileName, purpose = "preview", options = {}) => normalizeFileTicketResult2(
|
|
3966
|
+
unwrapPageResult(
|
|
3967
|
+
await sdk.createFileAccessTicket(
|
|
3968
|
+
bucketName,
|
|
3969
|
+
objectName,
|
|
3970
|
+
fileName,
|
|
3971
|
+
purpose,
|
|
3972
|
+
options
|
|
3973
|
+
)
|
|
3974
|
+
),
|
|
3975
|
+
servicePrefix
|
|
3941
3976
|
),
|
|
3942
|
-
createDownloadTicket: async (bucketName, objectName, fileName) =>
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3977
|
+
createDownloadTicket: async (bucketName, objectName, fileName) => normalizeFileTicketResult2(
|
|
3978
|
+
unwrapPageResult(
|
|
3979
|
+
await sdk.request({
|
|
3980
|
+
path: "/file/download-ticket",
|
|
3981
|
+
method: "post",
|
|
3982
|
+
body: { bucketName, objectName, fileName }
|
|
3983
|
+
})
|
|
3984
|
+
),
|
|
3985
|
+
servicePrefix
|
|
3948
3986
|
)
|
|
3949
3987
|
});
|
|
3950
3988
|
};
|
|
@@ -5525,7 +5563,8 @@ var useFilePreviewController = ({
|
|
|
5525
5563
|
);
|
|
5526
5564
|
url = typeof ticket === "string" ? ticket : ticket?.downloadUrl || ticket?.relayUrl || ticket?.url || url;
|
|
5527
5565
|
}
|
|
5528
|
-
|
|
5566
|
+
const resolvedUrl = resolvePreviewServiceUrl(url);
|
|
5567
|
+
if (resolvedUrl && typeof window !== "undefined") window.location.assign(resolvedUrl);
|
|
5529
5568
|
},
|
|
5530
5569
|
[api, bucketName]
|
|
5531
5570
|
);
|