@chaibuilder/sdk 4.0.0-beta.30 → 4.0.0-beta.32
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/{2SSKDMRQ-Dub3pRV1.cjs → 2SSKDMRQ-DfXKDvXk.cjs} +1 -1
- package/dist/{2SSKDMRQ-B5Tzwoh4.js → 2SSKDMRQ-pPung-JB.js} +2 -2
- package/dist/{AP7HFJJL-CfmdXP9M.js → AP7HFJJL-CEJuc_Ox.js} +1 -1
- package/dist/{AP7HFJJL-Dt6MglIr.cjs → AP7HFJJL-PvPBwV6T.cjs} +1 -1
- package/dist/{IconPicker-DLqOB-ri.cjs → IconPicker-BJHUCDn4.cjs} +1 -1
- package/dist/{IconPicker-Cn8Z42-Z.js → IconPicker-D_GRfhwS.js} +1 -1
- package/dist/{WDYDFRGG-BOpmZGHS.js → WDYDFRGG-B3FrCE_j.js} +2 -2
- package/dist/{WDYDFRGG-Dfj1ikzw.cjs → WDYDFRGG-BPHlcLi5.cjs} +1 -1
- package/dist/{active-in-another-tab-CEWvA8SG.js → active-in-another-tab-C_Ma7oFU.js} +2 -2
- package/dist/{active-in-another-tab-DV83cJ_v.cjs → active-in-another-tab-WVYf-z5w.cjs} +1 -1
- package/dist/{add-new-language-page-C3Uu92KN.cjs → add-new-language-page-CxW2Vuyr.cjs} +1 -1
- package/dist/{add-new-language-page-B3wK94-S.js → add-new-language-page-DtsBO739.js} +3 -3
- package/dist/{add-new-page-BOE-xwBc.cjs → add-new-page-BfKt72NF.cjs} +1 -1
- package/dist/{add-new-page-DsvGVrR8.js → add-new-page-DG38rI6S.js} +2 -2
- package/dist/{ai-panel-content-DBlnfRRi.cjs → ai-panel-content-Dfo4jOVB.cjs} +1 -1
- package/dist/{ai-panel-content-BBSzHZG6.js → ai-panel-content-dktE9CIO.js} +3 -3
- package/dist/{ai-panel-default-lang-BVBuwnyU.js → ai-panel-default-lang-BbUTXMbm.js} +9 -9
- package/dist/{ai-panel-default-lang-DJJWAtN0.cjs → ai-panel-default-lang-GQCtwlPs.cjs} +2 -2
- package/dist/{ai-panel-other-lang-fIEZkmRy.js → ai-panel-other-lang-DIDS-mTi.js} +13 -13
- package/dist/{ai-panel-other-lang-v8Yd5ggR.cjs → ai-panel-other-lang-nCUxwpLX.cjs} +1 -1
- package/dist/{ai-prompt-input-CmSfGxTN.js → ai-prompt-input-B2q30bhR.js} +16 -16
- package/dist/{ai-prompt-input-C7ha_0Cn.cjs → ai-prompt-input-Dws5BHhQ.cjs} +1 -1
- package/dist/{ai-translation-prompt-BzTGAS3W.cjs → ai-translation-prompt-CJVcuWrs.cjs} +1 -1
- package/dist/{ai-translation-prompt-CtBmvsRy.js → ai-translation-prompt-D87qk3C1.js} +1 -1
- package/dist/{change-password-modal-CdOwtCWN.cjs → change-password-modal-CVUa60pC.cjs} +1 -1
- package/dist/{change-password-modal-DxkhBI5d.js → change-password-modal-PahNYs8x.js} +2 -2
- package/dist/{code-editor-Bpn8z2fo.js → code-editor-CWOmKcUc.js} +1 -1
- package/dist/{code-editor-fL3s6Hk7.cjs → code-editor-Cim6jQVF.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DDB816CQ.js → continue-editing-in-this-client-BYFOU3hH.js} +2 -2
- package/dist/{continue-editing-in-this-client-DjxpjsA8.cjs → continue-editing-in-this-client-CW0f2LRk.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +37 -37
- package/dist/{css-import-modal-CL8SIC3K.js → css-import-modal-6bMTRlCg.js} +1 -1
- package/dist/{css-import-modal-CRC7bK1c.cjs → css-import-modal-CXulmaB4.cjs} +1 -1
- package/dist/{delete-page-41tvYcEw.js → delete-page-BDViv7Xm.js} +2 -2
- package/dist/{delete-page-BHPlx8ec.cjs → delete-page-CdByrw3j.cjs} +1 -1
- package/dist/{design-token-usage-DtdjTCn3.cjs → design-token-usage-D-hrcKz1.cjs} +1 -1
- package/dist/{design-token-usage-CyOY4Pni.js → design-token-usage-lf7N_uOk.js} +28 -28
- package/dist/digital-asset-manager-CxxhsToc.cjs +1 -0
- package/dist/{digital-asset-manager-C_ru4Zes.js → digital-asset-manager-PcYficIX.js} +5 -5
- package/dist/{duplicate-page-BvggF83O.cjs → duplicate-page-D2f3HvWX.cjs} +1 -1
- package/dist/{duplicate-page-DMmDdmfS.js → duplicate-page-DfEA148D.js} +3 -3
- package/dist/{dynamic-page-selector-D2z51nLi.js → dynamic-page-selector-DB__KD2y.js} +2 -2
- package/dist/{dynamic-page-selector-C5agz2Ze.cjs → dynamic-page-selector-Dz7D1Wdr.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DNp8Vhme.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-k8l5sdcw.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +3 -3
- package/dist/{get-chai-builder-theme-BSUcPs5t.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
- package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
- package/dist/image-compression-UaU7Bwqe.cjs +1 -0
- package/dist/{image-editor-DFmlG348.cjs → image-editor-BdW476J8.cjs} +1 -1
- package/dist/{image-editor-sKvOFo-S.js → image-editor-CilPMtAC.js} +1 -1
- package/dist/index-Bzyv7mAh.cjs +5 -0
- package/dist/{index-BFnMzGe6.js → index-DsQXiNA_.js} +4997 -4877
- package/dist/{index-CA1OwKJX.js → index-IQefjAA0.js} +1696 -1640
- package/dist/index-mPCp0j2h.cjs +160 -0
- package/dist/{json-diff-viewer-DRQSNhaS.cjs → json-diff-viewer-BPqY25PU.cjs} +1 -1
- package/dist/{json-diff-viewer-B5wAR5GY.js → json-diff-viewer-Ci2IbgDn.js} +34 -34
- package/dist/{lang-panel-q04hEq5o.js → lang-panel-DlAQr-y9.js} +3 -3
- package/dist/{lang-panel-BZsICcBR.cjs → lang-panel-jebYHYGD.cjs} +1 -1
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
- package/dist/library-blocks/bento/product-features/product-features.html +159 -0
- package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
- package/dist/library-blocks/blocks-list.json +145 -12
- package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
- package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
- package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
- package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
- package/dist/manage-design-tokens-BknGNAKE.cjs +1 -0
- package/dist/manage-design-tokens-Co5677WS.js +428 -0
- package/dist/manage-design-tokens-modal-9qpcb-EC.js +161 -0
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +1 -0
- package/dist/{mark-as-template-raTtKmQ9.js → mark-as-template-DOZL3umP.js} +2 -2
- package/dist/{mark-as-template-CT-hLGIW.cjs → mark-as-template-DS-tMllK.cjs} +1 -1
- package/dist/{nested-path-selector-content-CzQ2Lorl.js → nested-path-selector-content-Be-pbnVl.js} +1 -1
- package/dist/{nested-path-selector-content-CSUHTj9G.cjs → nested-path-selector-content-CWmPgU-L.cjs} +1 -1
- package/dist/{no-language-page-content-Bg6VjMVY.js → no-language-page-content-C8W0M_Fj.js} +4 -4
- package/dist/{no-language-page-content-Bkj8JpEY.cjs → no-language-page-content-DWtEo657.cjs} +1 -1
- package/dist/{no-language-page-dialog-TffLjvJn.cjs → no-language-page-dialog-FVXkSnfT.cjs} +1 -1
- package/dist/{no-language-page-dialog-CRPMr9YT.js → no-language-page-dialog-cpCZ9vES.js} +2 -2
- package/dist/{page-creator-CQhE1tgn.js → page-creator-CFtxeW_t.js} +172 -172
- package/dist/{page-creator-RrUhy8uH.cjs → page-creator-o6yRzsVf.cjs} +1 -1
- package/dist/{page-lock-D9h5pgxn.cjs → page-lock-BS_ErOIW.cjs} +1 -1
- package/dist/{page-lock-Dye1JZBB.js → page-lock-Cthbk6Pg.js} +2 -2
- package/dist/{page-locked-dialog-b2_f-A7a.cjs → page-locked-dialog-BWXifuQ8.cjs} +1 -1
- package/dist/{page-locked-dialog-BMjPVyHF.js → page-locked-dialog-D5hmaWqw.js} +16 -16
- package/dist/page-manager-new-Dl5YwsMm.js +418 -0
- package/dist/page-manager-new-DpSqBzeh.cjs +1 -0
- package/dist/{page-manager-search-and-filter-DCcYyoPO.js → page-manager-search-and-filter-iFsFJhn4.js} +27 -26
- package/dist/{page-manager-search-and-filter-D0ZXojiu.cjs → page-manager-search-and-filter-jDoLrCB7.cjs} +1 -1
- package/dist/{page-revisions-content-mDwvH6J-.js → page-revisions-content-C1IGUurW.js} +13 -13
- package/dist/{page-revisions-content-BX8ZWebc.cjs → page-revisions-content-CeBepZEw.cjs} +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +3 -0
- package/dist/pages.js +1 -1
- package/dist/{plugin-Dkmjb2_e.js → plugin-BSjgGgwo.js} +10 -10
- package/dist/{publish-pages-content-M_Kb8b-F.js → publish-pages-content-BpEoA1T6.js} +3 -3
- package/dist/{publish-pages-content-CR4e9inX.cjs → publish-pages-content-PNsiaGI-.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.js +32 -32
- package/dist/{rte-widget-modal-BRSm1Lnp.cjs → rte-widget-modal-CC1KcrAT.cjs} +1 -1
- package/dist/{rte-widget-modal-CVZDktXI.js → rte-widget-modal-c3T09VeO.js} +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/{save-to-lib-B1ccNhR2.js → save-to-lib-BERYhyxq.js} +27 -27
- package/dist/{save-to-lib-CYEAWxL9.cjs → save-to-lib-Bk59qO1r.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-aGR7p5JC.js → selected-block-display-C6NxfC0N.js} +11 -11
- package/dist/{selected-block-display-MyU0rS4q.cjs → selected-block-display-vFSCOnw8.cjs} +1 -1
- package/dist/{seo-panel-B5mDwpaT.cjs → seo-panel-0vlr_dBq.cjs} +1 -1
- package/dist/{seo-panel-P9uixkoZ.js → seo-panel-COrEJZLA.js} +138 -138
- package/dist/{shared-json-ld-DhQJh_mT.cjs → shared-json-ld-C46hURIr.cjs} +1 -1
- package/dist/{shared-json-ld-Ba9GcvLr.js → shared-json-ld-DnTuCBc3.js} +70 -70
- package/dist/{slug-input-CAfGHqMW.js → slug-input-CAqkFZBq.js} +1 -1
- package/dist/{slug-input-BdMnlYKT.cjs → slug-input-Curnt2n3.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +193 -195
- package/dist/{take-over-request-BeHTL28z.cjs → take-over-request-6fliSr8w.cjs} +1 -1
- package/dist/{take-over-request-CXjaDliJ.js → take-over-request-DvmM5qTu.js} +10 -10
- package/dist/{theme-panel-footer-D_gxD0j4.cjs → theme-panel-footer-3ixmq107.cjs} +1 -1
- package/dist/{theme-panel-footer-BkwhuXM7.js → theme-panel-footer-BlsXRcEY.js} +2 -2
- package/dist/{translation-warning-modal-D_vt37fW.cjs → translation-warning-modal-B876S5yp.cjs} +1 -1
- package/dist/{translation-warning-modal-CTfArsb1.js → translation-warning-modal-kRcfrPgo.js} +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/{unmark-as-template-vFgMIdxN.js → unmark-as-template-Dn3klZKq.js} +2 -2
- package/dist/{unmark-as-template-D2bvjGKt.cjs → unmark-as-template-q1GblG-u.cjs} +1 -1
- package/dist/{unpublish-page-CxkjTzBB.js → unpublish-page-BbFZw0so.js} +2 -2
- package/dist/{unpublish-page-CPjHmtSM.cjs → unpublish-page-DMbcHmUV.cjs} +1 -1
- package/dist/unpublished-partials-modal-CEFXp1D1.cjs +1 -0
- package/dist/unpublished-partials-modal-Ts5ZhAK9.js +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/{web-preview--by73Vvr.js → web-preview-B2YGL26D.js} +1 -1
- package/dist/{web-preview-C3AMe_BB.cjs → web-preview-C6SLwtqv.cjs} +1 -1
- package/package.json +2 -7
- package/dist/delete-design-token-B0md8qUi.js +0 -40
- package/dist/delete-design-token-C94IgWdi.cjs +0 -1
- package/dist/digital-asset-manager-DSLQz8qk.cjs +0 -1
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-Bzn_gpaK.cjs +0 -5
- package/dist/index-D30xvFa5.cjs +0 -160
- package/dist/library-blocks/hero-1/hero-1.html +0 -74
- package/dist/library-blocks/hero-1/hero-1.webp +0 -0
- package/dist/library-blocks/hero-2/hero-2.html +0 -95
- package/dist/library-blocks/hero-2/hero-2.webp +0 -0
- package/dist/manage-design-tokens-Cene3KEu.js +0 -241
- package/dist/manage-design-tokens-Di5C6nTj.cjs +0 -1
- package/dist/page-manager-new-2mDjnSqc.cjs +0 -1
- package/dist/page-manager-new-DP1b_dXt.js +0 -411
package/dist/supabase-actions.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { g as
|
|
5
|
-
import { isEmpty as
|
|
6
|
-
import
|
|
7
|
-
import { z as i } from "zod";
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var x = (d, t, e) => t in d ? I(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
|
|
3
|
+
var S = (d, t, e) => x(d, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { g as U, C as g, A as y } from "./actions-registery-Bj-j1k5i.js";
|
|
5
|
+
import { isEmpty as k, kebabCase as T, set as b } from "lodash-es";
|
|
6
|
+
import { z as n } from "zod";
|
|
8
7
|
class A {
|
|
9
8
|
constructor(t, e, r) {
|
|
10
9
|
this.appId = t, this.userId = e, this.supabase = r;
|
|
11
10
|
}
|
|
12
11
|
appendUpdatedAtToUrl(t, e) {
|
|
13
|
-
if (
|
|
12
|
+
if (k(t))
|
|
14
13
|
return "";
|
|
15
|
-
const r = new URL(t),
|
|
16
|
-
return r.searchParams.set("t",
|
|
14
|
+
const r = new URL(t), a = new Date(e).getTime();
|
|
15
|
+
return r.searchParams.set("t", a.toString()), `${r.origin}${r.pathname}${r.search}${r.hash}`;
|
|
17
16
|
}
|
|
18
17
|
getBufferFromBase64(t) {
|
|
19
18
|
try {
|
|
@@ -23,48 +22,47 @@ class A {
|
|
|
23
22
|
throw new Error("Invalid base64 string format");
|
|
24
23
|
}
|
|
25
24
|
}
|
|
25
|
+
getMimeType(t) {
|
|
26
|
+
var a;
|
|
27
|
+
const e = ((a = t.split(".").pop()) == null ? void 0 : a.toLowerCase()) || "";
|
|
28
|
+
return {
|
|
29
|
+
jpg: "image/jpeg",
|
|
30
|
+
jpeg: "image/jpeg",
|
|
31
|
+
png: "image/png",
|
|
32
|
+
webp: "image/webp",
|
|
33
|
+
gif: "image/gif",
|
|
34
|
+
tiff: "image/tiff",
|
|
35
|
+
svg: "image/svg+xml"
|
|
36
|
+
}[e] || "application/octet-stream";
|
|
37
|
+
}
|
|
26
38
|
/**
|
|
27
39
|
* Upload an image file using UPLOAD_TO_STORAGE action
|
|
28
|
-
*
|
|
40
|
+
* Uploads the image as-is without server-side processing for cross-platform compatibility
|
|
29
41
|
*/
|
|
30
|
-
async uploadImageFile(t, e, r,
|
|
42
|
+
async uploadImageFile(t, e, r, a) {
|
|
31
43
|
try {
|
|
32
|
-
const s = this.getBufferFromBase64(t),
|
|
33
|
-
if (!
|
|
34
|
-
throw new Error(`Invalid image format: ${
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
if (o && d.length > 120 * 1024) {
|
|
38
|
-
const O = Math.floor(90 * (122880 / d.length));
|
|
39
|
-
a = await f(s).webp({ quality: O }).resize({ width: Math.min(n.width || 2e3, 2e3) }).toBuffer();
|
|
40
|
-
}
|
|
41
|
-
const l = await f(a).metadata(), m = await f(s).webp({ quality: 70 }).resize({ width: 300 }).toBuffer(), p = r.split("."), h = p.length > 1 ? p.slice(0, -1).join(".") : r, w = `${_(h)}.webp`, D = `${w}_thumbnail.webp`, I = this.appId, x = e ? `${I}/${e}` : I, U = T("UPLOAD_TO_STORAGE");
|
|
42
|
-
if (!U)
|
|
44
|
+
const s = this.getBufferFromBase64(t), i = this.getMimeType(r);
|
|
45
|
+
if (!["image/jpeg", "image/png", "image/webp", "image/gif", "image/tiff"].includes(i))
|
|
46
|
+
throw new Error(`Invalid image format: ${i}`);
|
|
47
|
+
const u = r.split("."), o = u.length > 1 ? u.slice(0, -1).join(".") : r, l = u.length > 1 ? u[u.length - 1].toLowerCase() : "png", m = `${T(o)}.${l}`, p = this.appId, h = e ? `${p}/${e}` : p, f = U("UPLOAD_TO_STORAGE");
|
|
48
|
+
if (!f)
|
|
43
49
|
throw new Error("UPLOAD_TO_STORAGE action not found");
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
file:
|
|
47
|
-
fileName:
|
|
48
|
-
contentType:
|
|
49
|
-
folder:
|
|
50
|
+
f.setContext({ appId: this.appId, userId: this.userId });
|
|
51
|
+
const w = await f.execute({
|
|
52
|
+
file: s.toString("base64"),
|
|
53
|
+
fileName: m,
|
|
54
|
+
contentType: i,
|
|
55
|
+
folder: h
|
|
50
56
|
});
|
|
51
|
-
if (
|
|
52
|
-
throw new Error(
|
|
53
|
-
const E = await U.execute({
|
|
54
|
-
file: m.toString("base64"),
|
|
55
|
-
fileName: D,
|
|
56
|
-
contentType: "image/webp",
|
|
57
|
-
folder: x
|
|
58
|
-
});
|
|
59
|
-
if (E.error)
|
|
60
|
-
throw new Error(E.error);
|
|
57
|
+
if (w.error)
|
|
58
|
+
throw new Error(w.error);
|
|
61
59
|
return {
|
|
62
|
-
url:
|
|
63
|
-
thumbnailUrl:
|
|
64
|
-
size:
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
67
|
-
mimeType:
|
|
60
|
+
url: w.data.url,
|
|
61
|
+
thumbnailUrl: w.data.url,
|
|
62
|
+
size: s.length,
|
|
63
|
+
width: 0,
|
|
64
|
+
height: 0,
|
|
65
|
+
mimeType: i
|
|
68
66
|
};
|
|
69
67
|
} catch (s) {
|
|
70
68
|
return console.error("Upload image error:", s), { error: s instanceof Error ? s.message : "Unknown error" };
|
|
@@ -75,20 +73,20 @@ class A {
|
|
|
75
73
|
*/
|
|
76
74
|
async uploadSvgFile(t, e, r) {
|
|
77
75
|
try {
|
|
78
|
-
const
|
|
79
|
-
let s,
|
|
76
|
+
const a = this.getBufferFromBase64(t);
|
|
77
|
+
let s, i;
|
|
80
78
|
try {
|
|
81
|
-
const w =
|
|
82
|
-
s = w
|
|
79
|
+
const f = a.toString("utf-8"), w = f.match(/\bwidth=["'](\d+)/), E = f.match(/\bheight=["'](\d+)/);
|
|
80
|
+
w && (s = parseInt(w[1], 10)), E && (i = parseInt(E[1], 10));
|
|
83
81
|
} catch {
|
|
84
82
|
}
|
|
85
|
-
const c = r.split("."),
|
|
83
|
+
const c = r.split("."), u = c.length > 1 ? c.slice(0, -1).join(".") : r, o = `${T(u)}.svg`, l = this.appId, m = e ? `${l}/${e}` : l, p = U("UPLOAD_TO_STORAGE");
|
|
86
84
|
if (!p)
|
|
87
85
|
throw new Error("UPLOAD_TO_STORAGE action not found");
|
|
88
86
|
p.setContext({ appId: this.appId, userId: this.userId });
|
|
89
87
|
const h = await p.execute({
|
|
90
|
-
file:
|
|
91
|
-
fileName:
|
|
88
|
+
file: a.toString("base64"),
|
|
89
|
+
fileName: o,
|
|
92
90
|
contentType: "image/svg+xml",
|
|
93
91
|
folder: m
|
|
94
92
|
});
|
|
@@ -97,27 +95,27 @@ class A {
|
|
|
97
95
|
return {
|
|
98
96
|
url: h.data.url,
|
|
99
97
|
thumbnailUrl: h.data.url,
|
|
100
|
-
size:
|
|
98
|
+
size: a.length,
|
|
101
99
|
width: s,
|
|
102
|
-
height:
|
|
100
|
+
height: i,
|
|
103
101
|
mimeType: "image/svg+xml"
|
|
104
102
|
};
|
|
105
|
-
} catch (
|
|
106
|
-
return console.error("SVG upload error:",
|
|
103
|
+
} catch (a) {
|
|
104
|
+
return console.error("SVG upload error:", a), { error: a instanceof Error ? a.message : "Unknown error" };
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
107
|
async upload({
|
|
110
108
|
file: t,
|
|
111
109
|
folderId: e,
|
|
112
110
|
name: r,
|
|
113
|
-
optimize:
|
|
111
|
+
optimize: a = !0
|
|
114
112
|
}) {
|
|
115
113
|
var s;
|
|
116
114
|
try {
|
|
117
|
-
const c = r.toLowerCase().endsWith(".svg") || t.includes("data:image/svg+xml") ? await this.uploadSvgFile(t, e, r) : await this.uploadImageFile(t, e, r,
|
|
115
|
+
const c = r.toLowerCase().endsWith(".svg") || t.includes("data:image/svg+xml") ? await this.uploadSvgFile(t, e, r) : await this.uploadImageFile(t, e, r, a ?? !0);
|
|
118
116
|
if ("error" in c)
|
|
119
117
|
return c;
|
|
120
|
-
const
|
|
118
|
+
const u = {
|
|
121
119
|
name: r,
|
|
122
120
|
app: this.appId,
|
|
123
121
|
url: c.url,
|
|
@@ -130,26 +128,26 @@ class A {
|
|
|
130
128
|
type: c.mimeType.startsWith("image/") ? "image" : "file",
|
|
131
129
|
createdBy: this.userId,
|
|
132
130
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
133
|
-
}, { data:
|
|
131
|
+
}, { data: o, error: l } = await this.supabase.from("app_assets").insert(u).select("*").single();
|
|
134
132
|
if (l)
|
|
135
133
|
throw new Error(`Failed to store asset in database: ${l.message}`);
|
|
136
134
|
return {
|
|
137
|
-
id:
|
|
138
|
-
name:
|
|
139
|
-
type:
|
|
140
|
-
url: this.appendUpdatedAtToUrl(
|
|
141
|
-
size:
|
|
142
|
-
thumbnailUrl: this.appendUpdatedAtToUrl(
|
|
143
|
-
width:
|
|
144
|
-
height:
|
|
145
|
-
format:
|
|
146
|
-
folderId:
|
|
147
|
-
createdBy:
|
|
148
|
-
createdAt:
|
|
149
|
-
updatedAt:
|
|
135
|
+
id: o.id,
|
|
136
|
+
name: o.name,
|
|
137
|
+
type: o.type,
|
|
138
|
+
url: this.appendUpdatedAtToUrl(o.url, o.updatedAt),
|
|
139
|
+
size: o.size,
|
|
140
|
+
thumbnailUrl: this.appendUpdatedAtToUrl(o.thumbnailUrl || "", o.updatedAt),
|
|
141
|
+
width: o.width,
|
|
142
|
+
height: o.height,
|
|
143
|
+
format: o.format,
|
|
144
|
+
folderId: o.folderId,
|
|
145
|
+
createdBy: o.createdBy || "",
|
|
146
|
+
createdAt: o.createdAt,
|
|
147
|
+
updatedAt: o.updatedAt
|
|
150
148
|
};
|
|
151
|
-
} catch (
|
|
152
|
-
return { error:
|
|
149
|
+
} catch (i) {
|
|
150
|
+
return { error: i instanceof Error ? i.message : "Unknown error occurred" };
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
153
|
async getAsset({ id: t }) {
|
|
@@ -168,20 +166,20 @@ class A {
|
|
|
168
166
|
limit: r = 20
|
|
169
167
|
} = {}) {
|
|
170
168
|
try {
|
|
171
|
-
const
|
|
169
|
+
const a = (e - 1) * r;
|
|
172
170
|
let s = this.supabase.from("app_assets").select("*", { count: "exact" }).eq("app", this.appId).order("updatedAt", { ascending: !1 });
|
|
173
171
|
t && (s = s.or(`name.ilike.%${t}%,description.ilike.%${t}%`));
|
|
174
|
-
const { data:
|
|
172
|
+
const { data: i, error: c, count: u } = await s.range(a, a + r - 1);
|
|
175
173
|
if (c)
|
|
176
174
|
throw new Error(c.message);
|
|
177
175
|
return {
|
|
178
|
-
assets:
|
|
179
|
-
total:
|
|
176
|
+
assets: i.map((l) => (b(l, "url", this.appendUpdatedAtToUrl(l.url, l.updatedAt)), b(l, "thsupabaseumbnailUrl", this.appendUpdatedAtToUrl(l.thumbnailUrl || "", l.updatedAt)), l)),
|
|
177
|
+
total: u || 0,
|
|
180
178
|
page: e,
|
|
181
179
|
pageSize: r
|
|
182
180
|
};
|
|
183
|
-
} catch (
|
|
184
|
-
throw console.error("Error fetching assets:",
|
|
181
|
+
} catch (a) {
|
|
182
|
+
throw console.error("Error fetching assets:", a), a;
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
async deleteAsset({ id: t }) {
|
|
@@ -191,23 +189,23 @@ class A {
|
|
|
191
189
|
throw new Error(`Failed to fetch asset: ${r.message}`);
|
|
192
190
|
if (e.url)
|
|
193
191
|
try {
|
|
194
|
-
const
|
|
192
|
+
const i = new URL(e.url).pathname.split("/"), c = i.indexOf("dam-assets");
|
|
195
193
|
if (c !== -1) {
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
194
|
+
const u = i.slice(c + 1).join("/"), o = U("DELETE_FROM_STORAGE");
|
|
195
|
+
if (o && (o.setContext({ appId: this.appId, userId: this.userId }), await o.execute({ key: u })), e.thumbnailUrl && e.thumbnailUrl !== e.url) {
|
|
198
196
|
const m = new URL(e.thumbnailUrl).pathname.split("/"), p = m.indexOf("dam-assets");
|
|
199
197
|
if (p !== -1) {
|
|
200
198
|
const h = m.slice(p + 1).join("/");
|
|
201
|
-
|
|
199
|
+
o && await o.execute({ key: h });
|
|
202
200
|
}
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
} catch (s) {
|
|
206
204
|
console.warn("Failed to delete from storage, continuing with database deletion:", s);
|
|
207
205
|
}
|
|
208
|
-
const { error:
|
|
209
|
-
if (
|
|
210
|
-
throw new Error(`Failed to delete asset: ${
|
|
206
|
+
const { error: a } = await this.supabase.from("app_assets").delete().eq("id", t);
|
|
207
|
+
if (a)
|
|
208
|
+
throw new Error(`Failed to delete asset: ${a.message}`);
|
|
211
209
|
return { success: !0 };
|
|
212
210
|
} catch (e) {
|
|
213
211
|
return { error: e instanceof Error ? e.message : "Unknown error occurred" };
|
|
@@ -218,43 +216,43 @@ class A {
|
|
|
218
216
|
file: e,
|
|
219
217
|
description: r
|
|
220
218
|
}) {
|
|
221
|
-
var
|
|
219
|
+
var a, s;
|
|
222
220
|
try {
|
|
223
|
-
const { data:
|
|
221
|
+
const { data: i, error: c } = await this.supabase.from("app_assets").select("*").eq("id", t).single();
|
|
224
222
|
if (c)
|
|
225
223
|
throw new Error(`Failed to fetch asset: ${c.message}`);
|
|
226
|
-
const
|
|
227
|
-
if (r !== void 0 && (
|
|
228
|
-
const p = ((
|
|
224
|
+
const u = {};
|
|
225
|
+
if (r !== void 0 && (u.description = r, u.updatedAt = (/* @__PURE__ */ new Date()).toISOString()), e) {
|
|
226
|
+
const p = ((a = i.format) == null ? void 0 : a.toLowerCase()) === "svg" || e.includes("data:image/svg+xml") ? await this.uploadSvgFile(e, i.folderId, i.name) : await this.uploadImageFile(e, i.folderId, i.name, !0);
|
|
229
227
|
if ("error" in p)
|
|
230
228
|
return p;
|
|
231
|
-
|
|
229
|
+
u.url = p.url, u.thumbnailUrl = p.thumbnailUrl, u.size = (s = p.size) == null ? void 0 : s.toString(), u.width = p.width, u.height = p.height, u.format = p.mimeType.split("/")[1], u.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
232
230
|
}
|
|
233
|
-
const { data:
|
|
231
|
+
const { data: o, error: l } = await this.supabase.from("app_assets").update(u).eq("id", t).select().single();
|
|
234
232
|
if (l)
|
|
235
233
|
throw new Error(`Failed to update asset: ${l.message}`);
|
|
236
|
-
return b(
|
|
237
|
-
|
|
234
|
+
return b(o, "url", this.appendUpdatedAtToUrl(o.url, o.updatedAt)), b(
|
|
235
|
+
o,
|
|
238
236
|
"thumbnailUrl",
|
|
239
|
-
this.appendUpdatedAtToUrl(
|
|
240
|
-
),
|
|
241
|
-
} catch (
|
|
242
|
-
return { error:
|
|
237
|
+
this.appendUpdatedAtToUrl(o.thumbnailUrl || "", o.updatedAt)
|
|
238
|
+
), o;
|
|
239
|
+
} catch (i) {
|
|
240
|
+
return { error: i instanceof Error ? i.message : "Unknown error occurred" };
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
|
-
const
|
|
247
|
-
name:
|
|
248
|
-
file:
|
|
249
|
-
folderId:
|
|
250
|
-
optimize:
|
|
244
|
+
const _ = n.object({
|
|
245
|
+
name: n.string(),
|
|
246
|
+
file: n.string(),
|
|
247
|
+
folderId: n.string().optional().nullable(),
|
|
248
|
+
optimize: n.boolean().optional()
|
|
251
249
|
});
|
|
252
|
-
class
|
|
250
|
+
class D extends g {
|
|
253
251
|
constructor(t) {
|
|
254
252
|
super(), this.supabase = t;
|
|
255
253
|
}
|
|
256
254
|
getValidationSchema() {
|
|
257
|
-
return
|
|
255
|
+
return _;
|
|
258
256
|
}
|
|
259
257
|
async execute(t) {
|
|
260
258
|
try {
|
|
@@ -270,15 +268,15 @@ class v extends g {
|
|
|
270
268
|
}
|
|
271
269
|
}
|
|
272
270
|
}
|
|
273
|
-
const
|
|
274
|
-
id:
|
|
271
|
+
const O = n.object({
|
|
272
|
+
id: n.string()
|
|
275
273
|
});
|
|
276
|
-
class
|
|
274
|
+
class P extends g {
|
|
277
275
|
constructor(t) {
|
|
278
276
|
super(), this.supabase = t;
|
|
279
277
|
}
|
|
280
278
|
getValidationSchema() {
|
|
281
|
-
return
|
|
279
|
+
return O;
|
|
282
280
|
}
|
|
283
281
|
async execute(t) {
|
|
284
282
|
try {
|
|
@@ -294,17 +292,17 @@ class L extends g {
|
|
|
294
292
|
}
|
|
295
293
|
}
|
|
296
294
|
}
|
|
297
|
-
const
|
|
298
|
-
search:
|
|
299
|
-
page:
|
|
300
|
-
limit:
|
|
295
|
+
const F = n.object({
|
|
296
|
+
search: n.string().optional(),
|
|
297
|
+
page: n.number().optional(),
|
|
298
|
+
limit: n.number().optional()
|
|
301
299
|
});
|
|
302
|
-
class
|
|
300
|
+
class v extends g {
|
|
303
301
|
constructor(t) {
|
|
304
302
|
super(), this.supabase = t;
|
|
305
303
|
}
|
|
306
304
|
getValidationSchema() {
|
|
307
|
-
return
|
|
305
|
+
return F;
|
|
308
306
|
}
|
|
309
307
|
async execute(t) {
|
|
310
308
|
try {
|
|
@@ -320,15 +318,15 @@ class j extends g {
|
|
|
320
318
|
}
|
|
321
319
|
}
|
|
322
320
|
}
|
|
323
|
-
const
|
|
324
|
-
id:
|
|
321
|
+
const C = n.object({
|
|
322
|
+
id: n.string()
|
|
325
323
|
});
|
|
326
|
-
class
|
|
324
|
+
class $ extends g {
|
|
327
325
|
constructor(t) {
|
|
328
326
|
super(), this.supabase = t;
|
|
329
327
|
}
|
|
330
328
|
getValidationSchema() {
|
|
331
|
-
return
|
|
329
|
+
return C;
|
|
332
330
|
}
|
|
333
331
|
async execute(t) {
|
|
334
332
|
try {
|
|
@@ -344,17 +342,17 @@ class q extends g {
|
|
|
344
342
|
}
|
|
345
343
|
}
|
|
346
344
|
}
|
|
347
|
-
const
|
|
348
|
-
id:
|
|
349
|
-
file:
|
|
350
|
-
description:
|
|
345
|
+
const j = n.object({
|
|
346
|
+
id: n.string(),
|
|
347
|
+
file: n.string().optional(),
|
|
348
|
+
description: n.string().optional()
|
|
351
349
|
});
|
|
352
|
-
class
|
|
350
|
+
class G extends g {
|
|
353
351
|
constructor(t) {
|
|
354
352
|
super(), this.supabase = t;
|
|
355
353
|
}
|
|
356
354
|
getValidationSchema() {
|
|
357
|
-
return
|
|
355
|
+
return j;
|
|
358
356
|
}
|
|
359
357
|
async execute(t) {
|
|
360
358
|
try {
|
|
@@ -370,20 +368,20 @@ class N extends g {
|
|
|
370
368
|
}
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
|
-
const
|
|
374
|
-
userId:
|
|
371
|
+
const L = n.object({
|
|
372
|
+
userId: n.string()
|
|
375
373
|
});
|
|
376
|
-
class
|
|
374
|
+
class R extends g {
|
|
377
375
|
constructor(t) {
|
|
378
376
|
super(), this.supabase = t;
|
|
379
377
|
}
|
|
380
378
|
getValidationSchema() {
|
|
381
|
-
return
|
|
379
|
+
return L;
|
|
382
380
|
}
|
|
383
381
|
async execute(t) {
|
|
384
|
-
var e, r,
|
|
382
|
+
var e, r, a, s, i, c;
|
|
385
383
|
try {
|
|
386
|
-
const { userId:
|
|
384
|
+
const { userId: u } = t, { data: o, error: l } = await this.supabase.auth.admin.getUserById(u);
|
|
387
385
|
return l ? {
|
|
388
386
|
data: {
|
|
389
387
|
id: "unknown",
|
|
@@ -394,10 +392,10 @@ class V extends g {
|
|
|
394
392
|
status: 200
|
|
395
393
|
} : {
|
|
396
394
|
data: {
|
|
397
|
-
id: ((e =
|
|
398
|
-
email: ((r =
|
|
399
|
-
name: ((s = (
|
|
400
|
-
avatar: ((c = (
|
|
395
|
+
id: ((e = o.user) == null ? void 0 : e.id) || "unknown",
|
|
396
|
+
email: ((r = o.user) == null ? void 0 : r.email) || "unknown@chaibuilder.com",
|
|
397
|
+
name: ((s = (a = o.user) == null ? void 0 : a.user_metadata) == null ? void 0 : s.name) || "Unknown",
|
|
398
|
+
avatar: ((c = (i = o.user) == null ? void 0 : i.user_metadata) == null ? void 0 : c.avatar_url) || ""
|
|
401
399
|
},
|
|
402
400
|
status: 200
|
|
403
401
|
};
|
|
@@ -414,35 +412,35 @@ class V extends g {
|
|
|
414
412
|
}
|
|
415
413
|
}
|
|
416
414
|
}
|
|
417
|
-
const
|
|
418
|
-
email:
|
|
419
|
-
oldPassword:
|
|
420
|
-
newPassword:
|
|
421
|
-
confirmPassword:
|
|
422
|
-
}).refine((
|
|
415
|
+
const M = n.object({
|
|
416
|
+
email: n.string().email(),
|
|
417
|
+
oldPassword: n.string().min(1, "Old password is required"),
|
|
418
|
+
newPassword: n.string().min(8, "New password must be at least 8 characters"),
|
|
419
|
+
confirmPassword: n.string().min(1, "Confirm password is required")
|
|
420
|
+
}).refine((d) => d.newPassword === d.confirmPassword, {
|
|
423
421
|
message: "Confirm password does not match",
|
|
424
422
|
path: ["confirmPassword"]
|
|
425
423
|
});
|
|
426
|
-
class
|
|
424
|
+
class q extends g {
|
|
427
425
|
constructor(t) {
|
|
428
426
|
super(), this.supabase = t;
|
|
429
427
|
}
|
|
430
428
|
getValidationSchema() {
|
|
431
|
-
return
|
|
429
|
+
return M;
|
|
432
430
|
}
|
|
433
431
|
async execute(t) {
|
|
434
432
|
try {
|
|
435
|
-
const { email: e, oldPassword: r, newPassword:
|
|
433
|
+
const { email: e, oldPassword: r, newPassword: a } = t, { error: s } = await this.supabase.auth.signInWithPassword({
|
|
436
434
|
email: e,
|
|
437
435
|
password: r
|
|
438
436
|
});
|
|
439
437
|
if (s)
|
|
440
|
-
throw new
|
|
441
|
-
const { error:
|
|
442
|
-
password:
|
|
438
|
+
throw new y("Current password is incorrect", "INVALID_PASSWORD", 400);
|
|
439
|
+
const { error: i } = await this.supabase.auth.updateUser({
|
|
440
|
+
password: a
|
|
443
441
|
});
|
|
444
|
-
if (
|
|
445
|
-
throw new
|
|
442
|
+
if (i)
|
|
443
|
+
throw new y(i.message || "Failed to update password", "UPDATE_FAILED", 400);
|
|
446
444
|
return {
|
|
447
445
|
data: { message: "Password changed successfully" },
|
|
448
446
|
status: 200
|
|
@@ -452,24 +450,24 @@ class H extends g {
|
|
|
452
450
|
}
|
|
453
451
|
}
|
|
454
452
|
}
|
|
455
|
-
const
|
|
456
|
-
key:
|
|
453
|
+
const B = n.object({
|
|
454
|
+
key: n.string()
|
|
457
455
|
// Storage key/path to delete
|
|
458
456
|
});
|
|
459
|
-
class
|
|
457
|
+
class N extends g {
|
|
460
458
|
constructor(e) {
|
|
461
459
|
super();
|
|
462
|
-
|
|
460
|
+
S(this, "bucketName", "dam-assets");
|
|
463
461
|
this.supabase = e;
|
|
464
462
|
}
|
|
465
463
|
getValidationSchema() {
|
|
466
|
-
return
|
|
464
|
+
return B;
|
|
467
465
|
}
|
|
468
466
|
async execute(e) {
|
|
469
467
|
try {
|
|
470
|
-
const { key: r } = e, { error:
|
|
471
|
-
return
|
|
472
|
-
error: `Failed to delete from Supabase Storage: ${
|
|
468
|
+
const { key: r } = e, { error: a } = await this.supabase.storage.from(this.bucketName).remove([r]);
|
|
469
|
+
return a ? {
|
|
470
|
+
error: `Failed to delete from Supabase Storage: ${a.message}`,
|
|
473
471
|
status: 500
|
|
474
472
|
} : {
|
|
475
473
|
data: { success: !0 },
|
|
@@ -483,38 +481,38 @@ class Q extends g {
|
|
|
483
481
|
}
|
|
484
482
|
}
|
|
485
483
|
}
|
|
486
|
-
const
|
|
487
|
-
file:
|
|
484
|
+
const z = n.object({
|
|
485
|
+
file: n.string(),
|
|
488
486
|
// Base64 string
|
|
489
|
-
fileName:
|
|
490
|
-
contentType:
|
|
491
|
-
folder:
|
|
492
|
-
metadata:
|
|
487
|
+
fileName: n.string(),
|
|
488
|
+
contentType: n.string().optional(),
|
|
489
|
+
folder: n.string().optional(),
|
|
490
|
+
metadata: n.record(n.string(), n.any()).optional()
|
|
493
491
|
});
|
|
494
|
-
class
|
|
492
|
+
class V extends g {
|
|
495
493
|
constructor(e) {
|
|
496
494
|
super();
|
|
497
|
-
|
|
495
|
+
S(this, "bucketName", "dam-assets");
|
|
498
496
|
this.supabase = e;
|
|
499
497
|
}
|
|
500
498
|
getValidationSchema() {
|
|
501
|
-
return
|
|
499
|
+
return z;
|
|
502
500
|
}
|
|
503
501
|
async execute(e) {
|
|
504
502
|
try {
|
|
505
503
|
if (!this.context)
|
|
506
504
|
return { error: "Context not set", status: 400 };
|
|
507
|
-
const { appId: r } = this.context, { file:
|
|
508
|
-
let
|
|
509
|
-
if (typeof
|
|
510
|
-
const
|
|
511
|
-
|
|
505
|
+
const { appId: r } = this.context, { file: a, fileName: s, contentType: i, folder: c, metadata: u } = e;
|
|
506
|
+
let o;
|
|
507
|
+
if (typeof a == "string") {
|
|
508
|
+
const f = a.split(",")[1] || a;
|
|
509
|
+
o = Buffer.from(f, "base64");
|
|
512
510
|
} else
|
|
513
|
-
|
|
514
|
-
const l = c ? `${c}/${s}` : `${r}/${s}`, { data: m, error: p } = await this.supabase.storage.from(this.bucketName).upload(l,
|
|
515
|
-
contentType:
|
|
511
|
+
o = a;
|
|
512
|
+
const l = c ? `${c}/${s}` : `${r}/${s}`, { data: m, error: p } = await this.supabase.storage.from(this.bucketName).upload(l, o, {
|
|
513
|
+
contentType: i || "application/octet-stream",
|
|
516
514
|
upsert: !0,
|
|
517
|
-
...
|
|
515
|
+
...u && { metadata: u }
|
|
518
516
|
});
|
|
519
517
|
if (p)
|
|
520
518
|
return {
|
|
@@ -528,8 +526,8 @@ class X extends g {
|
|
|
528
526
|
data: {
|
|
529
527
|
url: h,
|
|
530
528
|
key: m.path,
|
|
531
|
-
size:
|
|
532
|
-
metadata:
|
|
529
|
+
size: o.length,
|
|
530
|
+
metadata: u
|
|
533
531
|
},
|
|
534
532
|
status: 200
|
|
535
533
|
};
|
|
@@ -541,23 +539,23 @@ class X extends g {
|
|
|
541
539
|
}
|
|
542
540
|
}
|
|
543
541
|
}
|
|
544
|
-
const
|
|
545
|
-
GET_CHAI_USER: new
|
|
546
|
-
CHANGE_PASSWORD: new
|
|
547
|
-
}),
|
|
542
|
+
const J = (d) => ({
|
|
543
|
+
GET_CHAI_USER: new R(d),
|
|
544
|
+
CHANGE_PASSWORD: new q(d)
|
|
545
|
+
}), X = (d) => ({
|
|
548
546
|
// Asset management actions
|
|
549
|
-
UPLOAD_ASSET: new
|
|
550
|
-
GET_ASSET: new
|
|
551
|
-
GET_ASSETS: new
|
|
552
|
-
DELETE_ASSET: new
|
|
553
|
-
UPDATE_ASSET: new
|
|
547
|
+
UPLOAD_ASSET: new D(d),
|
|
548
|
+
GET_ASSET: new P(d),
|
|
549
|
+
GET_ASSETS: new v(d),
|
|
550
|
+
DELETE_ASSET: new $(d),
|
|
551
|
+
UPDATE_ASSET: new G(d),
|
|
554
552
|
// Generic storage actions
|
|
555
|
-
UPLOAD_TO_STORAGE: new
|
|
556
|
-
DELETE_FROM_STORAGE: new
|
|
553
|
+
UPLOAD_TO_STORAGE: new V(d),
|
|
554
|
+
DELETE_FROM_STORAGE: new N(d)
|
|
557
555
|
});
|
|
558
556
|
export {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
557
|
+
N as DeleteFromStorageAction,
|
|
558
|
+
J as SupabaseAuthActions,
|
|
559
|
+
X as SupabaseStorageActions,
|
|
560
|
+
V as UploadToStorageAction
|
|
563
561
|
};
|