@howone/sdk 0.1.6 → 0.1.8
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -293,14 +293,14 @@ var FloatingButton = ({
|
|
|
293
293
|
fontWeight: "bold",
|
|
294
294
|
bottom: "28px"
|
|
295
295
|
},
|
|
296
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 shadow-xl", children: [
|
|
297
297
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { width: 20, className: "pointer-events-auto", src: "https://sxwxqoixnnklnpeutjrj.supabase.co/storage/v1/object/public/create-x/logo/logo-sm.svg", alt: "" }),
|
|
298
298
|
text,
|
|
299
299
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_iconify.Icon, { icon: "mdi:close", onClick: (e) => {
|
|
300
300
|
e.stopPropagation();
|
|
301
301
|
const btn = document.getElementById("floating-howone-btn");
|
|
302
|
-
|
|
303
|
-
}, className: "w-5 h-5 font-bold pointer-events-auto" })
|
|
302
|
+
if (btn) btn.style.display = "none";
|
|
303
|
+
}, className: "w-5 h-5 font-bold pointer-events-auto", style: { cursor: "pointer" } })
|
|
304
304
|
] })
|
|
305
305
|
}
|
|
306
306
|
);
|
|
@@ -1001,9 +1001,42 @@ var aiRequest = new request_default({
|
|
|
1001
1001
|
}
|
|
1002
1002
|
});
|
|
1003
1003
|
var workflowRequest = aiRequest;
|
|
1004
|
+
function wrapRequestWithProjectPrefix(biz, projectId) {
|
|
1005
|
+
if (!projectId) return biz;
|
|
1006
|
+
const prefix = `/entities/apps/${String(projectId)}`;
|
|
1007
|
+
function shouldPrefix(url) {
|
|
1008
|
+
if (!url) return false;
|
|
1009
|
+
const u = String(url);
|
|
1010
|
+
if (u.startsWith(prefix)) return false;
|
|
1011
|
+
if (/^https?:\/\//.test(u) || u.startsWith("//")) return false;
|
|
1012
|
+
if (u.startsWith("/data")) return true;
|
|
1013
|
+
return false;
|
|
1014
|
+
}
|
|
1015
|
+
const wrapped = {
|
|
1016
|
+
instance: biz.instance,
|
|
1017
|
+
request: (config) => {
|
|
1018
|
+
try {
|
|
1019
|
+
if (config && typeof config.url === "string" && shouldPrefix(config.url)) {
|
|
1020
|
+
config = { ...config, url: `${prefix}${config.url}` };
|
|
1021
|
+
}
|
|
1022
|
+
} catch (_e) {
|
|
1023
|
+
}
|
|
1024
|
+
return biz.request(config);
|
|
1025
|
+
},
|
|
1026
|
+
get: (config) => wrapped.request({ ...config, method: "GET" }),
|
|
1027
|
+
post: (config) => wrapped.request({ ...config, method: "POST" }),
|
|
1028
|
+
put: (config) => wrapped.request({ ...config, method: "PUT" }),
|
|
1029
|
+
patch: (config) => wrapped.request({ ...config, method: "PATCH" }),
|
|
1030
|
+
delete: (config) => wrapped.request({ ...config, method: "DELETE" }),
|
|
1031
|
+
cancelRequest: (url) => biz.cancelRequest(url),
|
|
1032
|
+
cancelAllRequests: () => biz.cancelAllRequests()
|
|
1033
|
+
};
|
|
1034
|
+
return wrapped;
|
|
1035
|
+
}
|
|
1004
1036
|
function createClient(opts) {
|
|
1005
1037
|
const biz = opts?.requestInstance || request;
|
|
1006
1038
|
const ai = opts?.aiRequestInstance || aiRequest;
|
|
1039
|
+
const bizWrapped = wrapRequestWithProjectPrefix(biz, opts?.projectId);
|
|
1007
1040
|
let token = null;
|
|
1008
1041
|
try {
|
|
1009
1042
|
if (opts?.projectId) {
|
|
@@ -1092,7 +1125,7 @@ function createClient(opts) {
|
|
|
1092
1125
|
return {
|
|
1093
1126
|
// expose projectId so consumers can read it from the client instance
|
|
1094
1127
|
projectId: opts?.projectId ?? null,
|
|
1095
|
-
request:
|
|
1128
|
+
request: bizWrapped,
|
|
1096
1129
|
aiRequest: ai,
|
|
1097
1130
|
workflowRequest: ai,
|
|
1098
1131
|
// artifact helpers using artifacts-client
|