@duxweb/dvha-core 1.0.34 → 1.0.36

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("vue"),O=require("@tanstack/vue-query"),M=require("@vueuse/core"),C=require("axios"),q=require("crypto-js"),W=require("dayjs"),T=require("lodash-es"),k=require("mathjs"),l=require("mime"),E=require("mitt"),L=require("pinia"),D=require("vue3-sfc-loader"),J=require("vue-router"),N=require("../../../hooks/manage.cjs"),V=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const B=require("../../../hooks/i18n.cjs"),F=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const Q=require("../../../index.cjs");function i(n){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(c,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}return c.default=n,Object.freeze(c)}const U=i(y),z=i(O),A=i(M),H=i(T),I=i(k),G=i(L),K=i(J),f=new Map;function X(n){return q.MD5(n).toString().substring(0,10)}function Y(n){const c=V.useClient(),{mergeLocale:o}=B.useI18n(),{config:a}=N.useManage(),v={moduleCache:{vue:U,"@duxweb/dvha-core":Q,"@vueuse/core":A,"@tanstack/vue-query":z,axios:C,crypto:q,mime:l,math:I,mitt:E,"lodash-es":H,pinia:G,dayjs:W,"vue-router":K,...a?.remote?.packages,"static!":function(e,r,t){const s=l.getType(t);if(s?.startsWith("image"))return`data:${s};charset=utf-8;base64,${btoa(e)}`;if(t===".json")return JSON.parse(e);throw new Error(`${t} unable to parse`)}},async handleModule(e,r){if(e!==".vue"){if(e===".json"){const t=await r(),{render:s}=F.useJsonSchema({data:t?.nodes||{},context:t?.data||{}});return()=>y.createVNode(s,null,null)}if(e!==".mjs")return r()}},customBlockHandler(e){if(e.type==="i18n"){const r=JSON.parse(e.content);for(const t in r)o(t,r[t])}},getFile:async e=>{e=g(e,".vue"),e=g(e,".json");const r=await c.request({path:typeof a?.remote?.apiRoutePath=="function"?a?.remote?.apiRoutePath(e):a?.remote?.apiRoutePath||"static",payload:{path:e},method:a?.remote?.apiMethod||"POST"}).then(s=>s?.data).catch(s=>{throw new Error(`${s?.message} ${e}`)});let t=r?.type||".vue";return(r?.type?.endsWith("js")||r?.type?.endsWith("ts")||r?.type?.endsWith("jsx")||r?.type?.endsWith("tsx"))&&(t=".mjs"),{content:r?.content,type:t}},getResource({refPath:e,relPath:r},t){const{moduleCache:s,pathResolve:_,getFile:j}=t,[b,...m]=r.match(/([^!]+!)|[^!]+$/g).reverse(),w=(u,h,p,x)=>m.reduce((R,$)=>s[$](R,h,p,x),u),d=_({refPath:e,relPath:b},t),S=m.join("")+d,P=u=>u.startsWith("@")?!0:!u.includes("/")&&!u.startsWith(".");return{id:S,path:d,async getContent(){if(P(d))throw new Error(`Package ${d} not imported`);const{content:u,type:h}=await j(d);return{getContentData:async p=>w(u,d,h,t),type:h}}}},addStyle(e){const r=X(e);if(f.has(r))return;f.set(r,!0);const t=document.createElement("style");t.textContent=e,t.setAttribute("data-hash",r),document.head.appendChild(t)}};return()=>D.loadModule(`${n}`,{...v})}function g(n,c){const o=new RegExp(`${c}$`);return n.replace(o,"")}exports.sfcLoader=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("vue"),O=require("@tanstack/vue-query"),M=require("@vueuse/core"),C=require("axios"),q=require("crypto-js"),W=require("dayjs"),T=require("lodash-es"),k=require("mathjs"),l=require("mime"),E=require("mitt"),L=require("pinia"),D=require("vue3-sfc-loader"),J=require("vue-router"),N=require("../../../hooks/manage.cjs"),V=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const B=require("../../../hooks/i18n.cjs"),F=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const Q=require("../../../index.cjs");function i(n){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(c,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}return c.default=n,Object.freeze(c)}const U=i(y),z=i(O),A=i(M),H=i(T),I=i(k),G=i(L),K=i(J),f=new Map;function X(n){return q.MD5(n).toString().substring(0,10)}function Y(n){const c=V.useClient(),{mergeLocale:o}=B.useI18n(),{config:a}=N.useManage(),v={moduleCache:{vue:U,"@duxweb/dvha-core":Q,"@vueuse/core":A,"@tanstack/vue-query":z,axios:C,"crypto-js":q,mime:l,math:I,mitt:E,"lodash-es":H,pinia:G,dayjs:W,"vue-router":K,...a?.remote?.packages,"static!":function(e,r,t){const s=l.getType(t);if(s?.startsWith("image"))return`data:${s};charset=utf-8;base64,${btoa(e)}`;if(t===".json")return JSON.parse(e);throw new Error(`${t} unable to parse`)}},async handleModule(e,r){if(e!==".vue"){if(e===".json"){const t=await r(),{render:s}=F.useJsonSchema({data:t?.nodes||{},context:t?.data||{}});return()=>y.createVNode(s,null,null)}if(e!==".mjs")return r()}},customBlockHandler(e){if(e.type==="i18n"){const r=JSON.parse(e.content);for(const t in r)o(t,r[t])}},getFile:async e=>{e=g(e,".vue"),e=g(e,".json");const r=await c.request({path:typeof a?.remote?.apiRoutePath=="function"?a?.remote?.apiRoutePath(e):a?.remote?.apiRoutePath||"static",payload:{path:e},method:a?.remote?.apiMethod||"POST"}).then(s=>s?.data).catch(s=>{throw new Error(`${s?.message} ${e}`)});let t=r?.type||".vue";return(r?.type?.endsWith("js")||r?.type?.endsWith("ts")||r?.type?.endsWith("jsx")||r?.type?.endsWith("tsx"))&&(t=".mjs"),{content:r?.content,type:t}},getResource({refPath:e,relPath:r},t){const{moduleCache:s,pathResolve:_,getFile:j}=t,[b,...m]=r.match(/([^!]+!)|[^!]+$/g).reverse(),w=(u,h,p,x)=>m.reduce((R,$)=>s[$](R,h,p,x),u),d=_({refPath:e,relPath:b},t),S=m.join("")+d,P=u=>u.startsWith("@")?!0:!u.includes("/")&&!u.startsWith(".");return{id:S,path:d,async getContent(){if(P(d))throw new Error(`Package ${d} not imported`);const{content:u,type:h}=await j(d);return{getContentData:async p=>w(u,d,h,t),type:h}}}},addStyle(e){const r=X(e);if(f.has(r))return;f.set(r,!0);const t=document.createElement("style");t.textContent=e,t.setAttribute("data-hash",r),document.head.appendChild(t)}};return()=>D.loadModule(`${n}`,{...v})}function g(n,c){const o=new RegExp(`${c}$`);return n.replace(o,"")}exports.sfcLoader=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../data.cjs"),U=require("axios");function g(n){const i=m.useClient();return{async upload(a,t){const o=await i.request({method:"GET",path:n.signPath,query:{name:a.name,size:a.size,mime:a.type,...t.params},signal:t.signal,onUploadProgress:t.onUploadProgress}),r=n.signCallback?.(o)||{uploadUrl:o.data?.uploadUrl,url:o.data?.url,params:o.data?.params};if(!r.uploadUrl)throw new Error("Upload URL is required");if(!r.url)throw new Error("File URL is required");const u=t.method||"POST";let s=null;const p=t.headers||{};if(u==="PUT")s=a,p["Content-Type"]=a.type||"application/octet-stream";else{const e=new FormData;e.append("Content-Type",a.type||"application/octet-stream"),e.append("file",a),r.params&&Object.entries(r.params).forEach(([d,c])=>{e.append(d,String(c))}),s=e}const l=await U.request({method:u,url:r.uploadUrl,data:s,signal:t.signal,headers:p,onUploadProgress:e=>{if(t.onUploadProgress&&e.total){const d=Math.round(e.loaded*100/e.total);t.onUploadProgress({loaded:e.loaded,total:e.total,percent:d})}}});if(l.status<200||l.status>=300)throw new Error(`S3 upload failed: ${l.statusText}`);return{data:{url:r.url,filename:a.name,size:a.size,mime:a.type},message:"upload successful"}}}}exports.createS3UploadDriver=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("axios"),U=require("../data.cjs");function g(n){const p=U.useClient();return{async upload(a,r){const s=await p.request({method:"GET",path:n.signPath,query:{name:a.name,size:a.size,mime:a.type,...r.params},signal:r.signal,onUploadProgress:r.onUploadProgress}),t=n.signCallback?.(s)||{uploadUrl:s.data?.uploadUrl,url:s.data?.url,params:s.data?.params};if(!t.uploadUrl)throw new Error("Upload URL is required");if(!t.url)throw new Error("File URL is required");const u=r.method||"POST";let o=null;const i=r.headers||{};if(u==="PUT")o=a,i["Content-Type"]=a.type||"application/octet-stream";else{const e=new FormData;t.params&&Object.entries(t.params).forEach(([d,c])=>{e.append(d,String(c))}),e.append("file",a),o=e}const l=await m.request({method:u,url:t.uploadUrl,data:o,signal:r.signal,headers:i,onUploadProgress:e=>{if(r.onUploadProgress&&e.total){const d=Math.round(e.loaded*100/e.total);r.onUploadProgress({loaded:e.loaded,total:e.total,percent:d})}}});if(l.status<200||l.status>=300)throw new Error(`S3 upload failed: ${l.statusText}`);return{data:{url:t.url,filename:a.name,size:a.size,mime:a.type},message:"upload successful"}}}}exports.createS3UploadDriver=g;
@@ -41,7 +41,7 @@ function ut(s) {
41
41
  "@vueuse/core": E,
42
42
  "@tanstack/vue-query": b,
43
43
  axios: k,
44
- crypto: y,
44
+ "crypto-js": y,
45
45
  mime: h,
46
46
  math: L,
47
47
  mitt: N,
@@ -106,9 +106,9 @@ function ut(s) {
106
106
  moduleCache: o,
107
107
  pathResolve: v,
108
108
  getFile: w
109
- } = e, [x, ...p] = r.match(/([^!]+!)|[^!]+$/g).reverse(), j = (n, m, d, P) => p.reduce((S, C) => o[C](S, m, d, P), n), a = v({
109
+ } = e, [j, ...p] = r.match(/([^!]+!)|[^!]+$/g).reverse(), x = (n, m, d, P) => p.reduce((S, C) => o[C](S, m, d, P), n), a = v({
110
110
  refPath: t,
111
- relPath: x
111
+ relPath: j
112
112
  }, e), $ = p.join("") + a, R = (n) => n.startsWith("@") ? !0 : !n.includes("/") && !n.startsWith(".");
113
113
  return {
114
114
  id: $,
@@ -121,7 +121,7 @@ function ut(s) {
121
121
  type: m
122
122
  } = await w(a);
123
123
  return {
124
- getContentData: async (d) => j(n, a, m, e),
124
+ getContentData: async (d) => x(n, a, m, e),
125
125
  type: m
126
126
  };
127
127
  }
@@ -1,9 +1,9 @@
1
- import { useClient as c } from "../data.js";
2
- import U from "axios";
1
+ import c from "axios";
2
+ import { useClient as U } from "../data.js";
3
3
  function w(n) {
4
- const i = c();
4
+ const i = U();
5
5
  return {
6
- async upload(a, t) {
6
+ async upload(a, r) {
7
7
  const o = await i.request({
8
8
  method: "GET",
9
9
  path: n.signPath,
@@ -11,40 +11,40 @@ function w(n) {
11
11
  name: a.name,
12
12
  size: a.size,
13
13
  mime: a.type,
14
- ...t.params
14
+ ...r.params
15
15
  },
16
- signal: t.signal,
17
- onUploadProgress: t.onUploadProgress
18
- }), r = n.signCallback?.(o) || {
16
+ signal: r.signal,
17
+ onUploadProgress: r.onUploadProgress
18
+ }), t = n.signCallback?.(o) || {
19
19
  uploadUrl: o.data?.uploadUrl,
20
20
  url: o.data?.url,
21
21
  params: o.data?.params
22
22
  };
23
- if (!r.uploadUrl)
23
+ if (!t.uploadUrl)
24
24
  throw new Error("Upload URL is required");
25
- if (!r.url)
25
+ if (!t.url)
26
26
  throw new Error("File URL is required");
27
- const p = t.method || "POST";
27
+ const u = r.method || "POST";
28
28
  let s = null;
29
- const u = t.headers || {};
30
- if (p === "PUT")
31
- s = a, u["Content-Type"] = a.type || "application/octet-stream";
29
+ const p = r.headers || {};
30
+ if (u === "PUT")
31
+ s = a, p["Content-Type"] = a.type || "application/octet-stream";
32
32
  else {
33
33
  const e = new FormData();
34
- e.append("Content-Type", a.type || "application/octet-stream"), e.append("file", a), r.params && Object.entries(r.params).forEach(([d, m]) => {
34
+ t.params && Object.entries(t.params).forEach(([d, m]) => {
35
35
  e.append(d, String(m));
36
- }), s = e;
36
+ }), e.append("file", a), s = e;
37
37
  }
38
- const l = await U.request({
39
- method: p,
40
- url: r.uploadUrl,
38
+ const l = await c.request({
39
+ method: u,
40
+ url: t.uploadUrl,
41
41
  data: s,
42
- signal: t.signal,
43
- headers: u,
42
+ signal: r.signal,
43
+ headers: p,
44
44
  onUploadProgress: (e) => {
45
- if (t.onUploadProgress && e.total) {
45
+ if (r.onUploadProgress && e.total) {
46
46
  const d = Math.round(e.loaded * 100 / e.total);
47
- t.onUploadProgress({
47
+ r.onUploadProgress({
48
48
  loaded: e.loaded,
49
49
  total: e.total,
50
50
  percent: d
@@ -56,7 +56,7 @@ function w(n) {
56
56
  throw new Error(`S3 upload failed: ${l.statusText}`);
57
57
  return {
58
58
  data: {
59
- url: r.url,
59
+ url: t.url,
60
60
  filename: a.name,
61
61
  size: a.size,
62
62
  mime: a.type
@@ -1,3 +1,3 @@
1
- export * from './types';
2
1
  export * from './local';
3
2
  export * from './s3';
3
+ export * from './types';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "1.0.34",
4
+ "version": "1.0.36",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {