@nocobase/plugin-action-custom-request 1.0.0-alpha.1
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/LICENSE +661 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/components/CustomRequestAction.d.ts +7 -0
- package/dist/client/components/CustomRequestActionDesigner.d.ts +12 -0
- package/dist/client/components/index.d.ts +1 -0
- package/dist/client/constants.d.ts +1 -0
- package/dist/client/hooks/index.d.ts +3 -0
- package/dist/client/hooks/useCustomRequestVariableOptions.d.ts +5 -0
- package/dist/client/hooks/useCustomRequestsResource.d.ts +1 -0
- package/dist/client/hooks/useCustomizeRequestActionProps.d.ts +3 -0
- package/dist/client/hooks/useGetCustomRequest.d.ts +7 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +1 -0
- package/dist/client/initializer/CustomRequestInitializer.d.ts +2 -0
- package/dist/client/initializer/index.d.ts +1 -0
- package/dist/client/locale.d.ts +4 -0
- package/dist/client/schemaSettings.d.ts +2 -0
- package/dist/client/schemas/CustomRequestACL.d.ts +27 -0
- package/dist/client/schemas/CustomRequestConfigurationFields.d.ts +187 -0
- package/dist/client/schemas/index.d.ts +2 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/ko_KR.json +26 -0
- package/dist/locale/zh-CN.json +26 -0
- package/dist/server/actions/listByCurrentRole.d.ts +2 -0
- package/dist/server/actions/listByCurrentRole.js +42 -0
- package/dist/server/actions/send.d.ts +3 -0
- package/dist/server/actions/send.js +199 -0
- package/dist/server/collections/customRequest.d.ts +2 -0
- package/dist/server/collections/customRequest.js +51 -0
- package/dist/server/collections/customRequestsRoles.d.ts +2 -0
- package/dist/server/collections/customRequestsRoles.js +27 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/migrations/20240425205017-change-locale-module.d.ts +6 -0
- package/dist/server/migrations/20240425205017-change-locale-module.js +42 -0
- package/dist/server/plugin.d.ts +14 -0
- package/dist/server/plugin.js +71 -0
- package/package.json +29 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SchemaSettings } from '@nocobase/client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function CustomRequestSettingsItem(): React.JSX.Element;
|
|
4
|
+
export declare function CustomRequestACL(): React.JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
|
+
export declare const customRequestActionSettings: SchemaSettings<{}>;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
12
|
+
export declare const CustomRequestActionDesigner: React.FC;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CustomRequestAction';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listByCurrentRoleUrl = "customRequests:listByCurrentRole";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCustomRequestsResource: () => import("@nocobase/sdk").IResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-router-dom"),require("react"),require("react-i18next"),require("@formily/antd-v5"),require("@formily/shared")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@formily/react","@nocobase/utils/client","antd","react-router-dom","react","react-i18next","@formily/antd-v5","@formily/shared"],n):(t=typeof globalThis!="undefined"?globalThis:t||self,n(t["@nocobase/plugin-action-custom-request"]={},t.jsxRuntime,t["@nocobase/client"],t["@formily/react"],t["@nocobase/utils"],t.antd,t["react-router-dom"],t.react,t["react-i18next"],t["@formily/antd-v5"],t["@formily/shared"]))})(this,function(t,n,e,c,I,O,D,A,R,E,ee){"use strict";var de=Object.defineProperty,fe=Object.defineProperties;var ye=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var Y=(t,n,e)=>n in t?de(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,q=(t,n)=>{for(var e in n||(n={}))$.call(n,e)&&Y(t,e,n[e]);if(M)for(var e of M(n))Q.call(n,e)&&Y(t,e,n[e]);return t},F=(t,n)=>fe(t,ye(n));var Z=(t,n)=>{var e={};for(var c in t)$.call(t,c)&&n.indexOf(c)<0&&(e[c]=t[c]);if(t!=null&&M)for(var c of M(t))n.indexOf(c)<0&&Q.call(t,c)&&(e[c]=t[c]);return e};var g=(t,n,e)=>new Promise((c,I)=>{var O=R=>{try{A(e.next(R))}catch(E){I(E)}},D=R=>{try{A(e.throw(R))}catch(E){I(E)}},A=R=>R.done?c(R.value):Promise.resolve(R.value).then(O,D);A((e=e.apply(t,n)).next())});const L="customRequests:listByCurrentRole";var P=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},z={exports:{}};(function(a,m){(function(l,i){i()})(P,function(){function l(o,r){return typeof r=="undefined"?r={autoBom:!1}:typeof r!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(o.type)?new Blob(["\uFEFF",o],{type:o.type}):o}function i(o,r,h){var u=new XMLHttpRequest;u.open("GET",o),u.responseType="blob",u.onload=function(){v(u.response,r,h)},u.onerror=function(){console.error("could not download file")},u.send()}function d(o){var r=new XMLHttpRequest;r.open("HEAD",o,!1);try{r.send()}catch(h){}return 200<=r.status&&299>=r.status}function y(o){try{o.dispatchEvent(new MouseEvent("click"))}catch(h){var r=document.createEvent("MouseEvents");r.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),o.dispatchEvent(r)}}var p=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof P=="object"&&P.global===P?P:void 0,x=p.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),v=p.saveAs||(typeof window!="object"||window!==p?function(){}:"download"in HTMLAnchorElement.prototype&&!x?function(o,r,h){var u=p.URL||p.webkitURL,C=document.createElement("a");r=r||o.name||"download",C.download=r,C.rel="noopener",typeof o=="string"?(C.href=o,C.origin===location.origin?y(C):d(C.href)?i(o,r,h):y(C,C.target="_blank")):(C.href=u.createObjectURL(o),setTimeout(function(){u.revokeObjectURL(C.href)},4e4),setTimeout(function(){y(C)},0))}:"msSaveOrOpenBlob"in navigator?function(o,r,h){if(r=r||o.name||"download",typeof o!="string")navigator.msSaveOrOpenBlob(l(o,h),r);else if(d(o))i(o,r,h);else{var u=document.createElement("a");u.href=o,u.target="_blank",setTimeout(function(){y(u)})}}:function(o,r,h,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof o=="string")return i(o,r,h);var C=o.type==="application/octet-stream",b=/constructor/i.test(p.HTMLElement)||p.safari,k=/CriOS\/[\d]+/.test(navigator.userAgent);if((k||C&&b||x)&&typeof FileReader!="undefined"){var s=new FileReader;s.onloadend=function(){var S=s.result;S=k?S:S.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=S:location=S,u=null},s.readAsDataURL(o)}else{var T=p.URL||p.webkitURL,w=T.createObjectURL(o);u?u.location=w:location.href=w,u=null,setTimeout(function(){T.revokeObjectURL(w)},4e4)}});p.saveAs=v.saveAs=v,a.exports=v})})(z);var te=z.exports;const oe=()=>{const a=e.useAPIClient(),m=D.useNavigate(),l=c.useFieldSchema(),i=e.useCompile(),d=c.useForm(),y=e.useRecord(),p=c.useFieldSchema(),x=c.useField(),{setVisible:v}=e.useActionContext(),{modal:o,message:r}=O.App.useApp(),h=e.useDataSourceKey();return{onClick(C,b){return g(this,null,function*(){var S,W;const{skipValidator:k,onSuccess:s}=(S=l==null?void 0:l["x-action-settings"])!=null?S:{},T=l==null?void 0:l["x-action"];k!==!0&&T==="customize:form:request"&&(yield d.submit());let w=q({},y);T==="customize:form:request"&&(w=d.values),(W=x.data)!=null||(x.data={}),x.data.loading=!0;try{const _=yield a.request({url:`/customRequests:send/${p["x-uid"]}`,method:"POST",data:{currentRecord:{dataSourceKey:h,data:w}},responseType:p["x-response-type"]==="stream"?"blob":"json"});if(_.headers["content-disposition"]){const pe=/attachment;\s*filename="([^"]+)"/,X=_.headers["content-disposition"].match(pe);X[1]&&te.saveAs(_.data,X[1])}if(x.data.loading=!1,b&&(b==null||b()),T==="customize:form:request"&&(v==null||v(!1)),!(s!=null&&s.successMessage))return;s!=null&&s.manualClose?o.success({title:i(s==null?void 0:s.successMessage),onOk:()=>g(this,null,function*(){s!=null&&s.redirecting&&(s!=null&&s.redirectTo)&&(I.isURL(s.redirectTo)?window.location.href=s.redirectTo:m(s.redirectTo))})}):(r.success(i(s==null?void 0:s.successMessage)),s!=null&&s.redirecting&&(s!=null&&s.redirectTo)&&(I.isURL(s.redirectTo)?window.location.href=s.redirectTo:m(s.redirectTo)))}finally{x.data.loading=!1}})}}},V=()=>{const m=`customRequests:get/${c.useFieldSchema()["x-uid"]}`;return e.useRequest({url:m,params:{appends:["roles"]}},{manual:!0,cacheKey:m})},B="action-custom-request";function f(a){return`{{t('${a}', { ns: '${B}', nsMode: 'fallback' })}}`}function U(){return R.useTranslation(B,{nsMode:"fallback"})}const se=()=>{const a=e.useCollection_deprecated(),{t:m}=U(),l=e.useCollectionFilterOptions(a),i=e.useCollectionFilterOptions("users",e.DEFAULT_DATA_SOURCE_KEY),d=e.useCompile(),[y,p]=A.useMemo(()=>[d(l),d(i)],[l,i]);return A.useMemo(()=>[{name:"currentRecord",title:m("Current record",{ns:"client"}),children:[...y]},{name:"currentUser",title:m("Current user",{ns:"client"}),children:p},{name:"currentTime",title:m("Current time",{ns:"client"}),children:null}],[y,p])},j=()=>e.useAPIClient().resource("customRequests"),K={type:"object",properties:{method:{type:"string",required:!0,title:f("HTTP method"),"x-decorator-props":{tooltip:f("When the HTTP method is Post, Put or Patch, and this custom request inside the form, the request body will be automatically filled in with the form data")},"x-decorator":"FormItem","x-component":"Select","x-component-props":{showSearch:!1,allowClear:!1,className:"auto-width"},enum:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"PUT",value:"PUT"},{label:"PATCH",value:"PATCH"},{label:"DELETE",value:"DELETE"}],default:"POST"},url:{type:"string",required:!0,title:f("URL"),"x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:"{{useCustomRequestVariableOptions}}",autoSize:!0,fieldNames:{value:"name",label:"title"},placeholder:"https://www.nocobase.com"}},headers:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:f("Headers"),description:f('"Content-Type" only support "application/json", and no need to specify'),items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:f("Name")}},value:{type:"string","x-decorator":"FormItem","x-component":"Variable.Input","x-component-props":{scope:"{{useCustomRequestVariableOptions}}",fieldNames:{value:"name",label:"title"},useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:f("Add request header"),"x-component":"ArrayItems.Addition"}}},params:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",title:f("Parameters"),items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:f("Name")}},value:{type:"string","x-decorator":"FormItem","x-component":"Variable.Input","x-component-props":{scope:"{{useCustomRequestVariableOptions}}",fieldNames:{value:"name",label:"title"},useTypedConstant:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:f("Add parameter"),"x-component":"ArrayItems.Addition"}}},data:{type:"string",title:f("Body"),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"Variable.JSON","x-component-props":{scope:"{{useCustomRequestVariableOptions}}",fieldNames:{value:"name",label:"title"},changeOnSelect:!0,autoSize:{minRows:10},placeholder:f("Input request data")},description:f("Only support standard JSON data")},timeout:{type:"number",title:f("Timeout config"),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"InputNumber","x-component-props":{addonAfter:f("ms"),min:1,step:1e3,defaultValue:5e3}},responseType:{type:"string",title:f("Response type"),"x-decorator":"FormItem","x-decorator-props":{},"x-component":"Select",default:"json",enum:[{value:"json",label:"JSON"},{value:"stream",label:"Stream"}]}}},ne={type:"object",properties:{roles:{type:"array",title:f("Roles"),"x-decorator":"FormItem","x-decorator-props":{tooltip:f("If not set, all roles can see this action")},"x-component":"RemoteSelect","x-component-props":{multiple:!0,objectValue:!0,dataSource:e.DEFAULT_DATA_SOURCE_KEY,service:{resource:"roles"},manual:!1,fieldNames:{label:"title",value:"name"}}}}};function H(){var o;const{t:a}=U(),{name:m}=e.useCollection_deprecated(),l=e.useDataSourceKey(),i=c.useFieldSchema(),d=j(),{message:y}=O.App.useApp(),{data:p,refresh:x}=V(),{dn:v}=e.useDesignable();return n.jsx(n.Fragment,{children:n.jsx(e.SchemaSettingsActionModalItem,{title:a("Request settings"),components:{ArrayItems:E.ArrayItems},beforeOpen:()=>!p&&x(),scope:{useCustomRequestVariableOptions:se},schema:K,initialValues:q({},(o=p==null?void 0:p.data)==null?void 0:o.options),onSubmit:r=>g(this,null,function*(){const h=Z(r,[]);return i["x-response-type"]=h.responseType,yield d.updateOrCreate({values:{key:i["x-uid"],options:F(q({},h),{collectionName:m,dataSourceKey:l})},filterKeys:["key"]}),v.emit("patch",{schema:{"x-response-type":h.responseType,"x-uid":i["x-uid"]}}),x(),y.success(a("Saved successfully"))})})})}function G(){var x;const{t:a}=U(),m=c.useFieldSchema(),l=j(),{message:i}=O.App.useApp(),{data:d,refresh:y}=V(),{refresh:p}=e.useRequest({url:L},{manual:!0,cacheKey:L});return n.jsx(n.Fragment,{children:n.jsx(e.SchemaSettingsActionModalItem,{title:a("Access control"),schema:ne,initialValues:{roles:(x=d==null?void 0:d.data)==null?void 0:x.roles},beforeOpen:()=>!d&&y(),onSubmit:o=>g(this,[o],function*({roles:v}){return yield l.updateOrCreate({values:{key:m["x-uid"],roles:v},filterKeys:["key"]}),y(),p(),i.success(a("Saved successfully"))})})})}const re=new e.SchemaSettings({name:"CustomRequestActionSettings",items:[F(q({},e.actionSettingsItems[0]),{children:[...e.actionSettingsItems[0].children,{name:"request settings",Component:H},{name:"accessControl",Component:G}]})]}),ae=()=>{const a=j(),m=c.useFieldSchema();return n.jsx(e.Action.Designer,{linkageAction:!0,schemaSettings:"CustomRequestActionSettings",buttonEditorProps:{isLink:m["x-action"]==="customize:table:request"},linkageRulesProps:{type:"button"},removeButtonProps:{onConfirmOk(){return a.destroy({filterByTk:m["x-uid"]})}}})},ie=a=>{var y;const l=e.useAPIClient().auth.role==="root",i=c.useFieldSchema(),{data:d}=e.useRequest({url:L},{manual:l,cacheKey:L});return!l&&!((y=d==null?void 0:d.data)!=null&&y.includes(i==null?void 0:i["x-uid"]))?null:a.children},ue={"customize:table:request":e.Action.Link},N=a=>{const l=c.useFieldSchema()["x-action"],i=ue[l]||e.Action;return n.jsx(i,F(q({},a),{useProps:oe}))};N.Designer=ae,N.Decorator=ie;const ce=a=>{const m=j(),l={title:'{{ t("Custom request") }}',"x-component":"CustomRequestAction","x-action":"customize:form:request","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:customRequest","x-decorator":"CustomRequestAction.Decorator","x-uid":ee.uid(),"x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Request success")}}'}}},i=e.useSchemaInitializerItem();return n.jsx(e.BlockInitializer,F(q({},i),{item:i,onClick:d=>g(this,null,function*(){yield m.create({values:{key:d["x-uid"]}})}),schema:l}))},me=new e.SchemaSettings({name:"actionSettings:customRequest",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps(){return{isLink:c.useFieldSchema()["x-action"]==="customize:table:request"}}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps(){const{name:a}=e.useCollection(),{linkageRulesProps:m}=e.useSchemaToolbar();return F(q({},m),{collectionName:a})}},{name:"secondConFirm",Component:e.SecondConFirm},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"request settings",Component:H},{name:"accessControl",Component:G},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps(){return{isPopupAction:!1}}},{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps(){const{removeButtonProps:a}=e.useSchemaToolbar();return a}}]}),le=a=>n.jsx(e.SchemaComponentOptions,{scope:{CustomRequestConfigurationFieldsSchema:K},components:{CustomRequestAction:N,CustomRequestInitializer:ce},children:a.children});class J extends e.Plugin{load(){return g(this,null,function*(){this.app.use(le),this.app.schemaSettingsManager.add(me),this.app.schemaSettingsManager.add(re)})}}t.PluginActionCustomRequestClient=J,t.default=J,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CustomRequestInitializer';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const NAMESPACE = "action-custom-request";
|
|
2
|
+
export declare function lang(key: string): string;
|
|
3
|
+
export declare function generateNTemplate(key: string): string;
|
|
4
|
+
export declare function useTranslation(): import("react-i18next").UseTranslationResponse<"action-custom-request", undefined>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const CustomRequestACLSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
roles: {
|
|
5
|
+
type: string;
|
|
6
|
+
title: string;
|
|
7
|
+
'x-decorator': string;
|
|
8
|
+
'x-decorator-props': {
|
|
9
|
+
tooltip: string;
|
|
10
|
+
};
|
|
11
|
+
'x-component': string;
|
|
12
|
+
'x-component-props': {
|
|
13
|
+
multiple: boolean;
|
|
14
|
+
objectValue: boolean;
|
|
15
|
+
dataSource: string;
|
|
16
|
+
service: {
|
|
17
|
+
resource: string;
|
|
18
|
+
};
|
|
19
|
+
manual: boolean;
|
|
20
|
+
fieldNames: {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export declare const CustomRequestConfigurationFieldsSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
method: {
|
|
5
|
+
type: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
title: string;
|
|
8
|
+
'x-decorator-props': {
|
|
9
|
+
tooltip: string;
|
|
10
|
+
};
|
|
11
|
+
'x-decorator': string;
|
|
12
|
+
'x-component': string;
|
|
13
|
+
'x-component-props': {
|
|
14
|
+
showSearch: boolean;
|
|
15
|
+
allowClear: boolean;
|
|
16
|
+
className: string;
|
|
17
|
+
};
|
|
18
|
+
enum: {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
url: {
|
|
25
|
+
type: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
title: string;
|
|
28
|
+
'x-decorator': string;
|
|
29
|
+
'x-component': string;
|
|
30
|
+
'x-component-props': {
|
|
31
|
+
scope: string;
|
|
32
|
+
autoSize: boolean;
|
|
33
|
+
fieldNames: {
|
|
34
|
+
value: string;
|
|
35
|
+
label: string;
|
|
36
|
+
};
|
|
37
|
+
placeholder: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
headers: {
|
|
41
|
+
type: string;
|
|
42
|
+
'x-component': string;
|
|
43
|
+
'x-decorator': string;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
items: {
|
|
47
|
+
type: string;
|
|
48
|
+
properties: {
|
|
49
|
+
space: {
|
|
50
|
+
type: string;
|
|
51
|
+
'x-component': string;
|
|
52
|
+
properties: {
|
|
53
|
+
name: {
|
|
54
|
+
type: string;
|
|
55
|
+
'x-decorator': string;
|
|
56
|
+
'x-component': string;
|
|
57
|
+
'x-component-props': {
|
|
58
|
+
placeholder: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
value: {
|
|
62
|
+
type: string;
|
|
63
|
+
'x-decorator': string;
|
|
64
|
+
'x-component': string;
|
|
65
|
+
'x-component-props': {
|
|
66
|
+
scope: string;
|
|
67
|
+
fieldNames: {
|
|
68
|
+
value: string;
|
|
69
|
+
label: string;
|
|
70
|
+
};
|
|
71
|
+
useTypedConstant: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
remove: {
|
|
75
|
+
type: string;
|
|
76
|
+
'x-decorator': string;
|
|
77
|
+
'x-component': string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
properties: {
|
|
84
|
+
add: {
|
|
85
|
+
type: string;
|
|
86
|
+
title: string;
|
|
87
|
+
'x-component': string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
params: {
|
|
92
|
+
type: string;
|
|
93
|
+
'x-component': string;
|
|
94
|
+
'x-decorator': string;
|
|
95
|
+
title: string;
|
|
96
|
+
items: {
|
|
97
|
+
type: string;
|
|
98
|
+
properties: {
|
|
99
|
+
space: {
|
|
100
|
+
type: string;
|
|
101
|
+
'x-component': string;
|
|
102
|
+
properties: {
|
|
103
|
+
name: {
|
|
104
|
+
type: string;
|
|
105
|
+
'x-decorator': string;
|
|
106
|
+
'x-component': string;
|
|
107
|
+
'x-component-props': {
|
|
108
|
+
placeholder: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
value: {
|
|
112
|
+
type: string;
|
|
113
|
+
'x-decorator': string;
|
|
114
|
+
'x-component': string;
|
|
115
|
+
'x-component-props': {
|
|
116
|
+
scope: string;
|
|
117
|
+
fieldNames: {
|
|
118
|
+
value: string;
|
|
119
|
+
label: string;
|
|
120
|
+
};
|
|
121
|
+
useTypedConstant: boolean;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
remove: {
|
|
125
|
+
type: string;
|
|
126
|
+
'x-decorator': string;
|
|
127
|
+
'x-component': string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
properties: {
|
|
134
|
+
add: {
|
|
135
|
+
type: string;
|
|
136
|
+
title: string;
|
|
137
|
+
'x-component': string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
data: {
|
|
142
|
+
type: string;
|
|
143
|
+
title: string;
|
|
144
|
+
'x-decorator': string;
|
|
145
|
+
'x-decorator-props': {};
|
|
146
|
+
'x-component': string;
|
|
147
|
+
'x-component-props': {
|
|
148
|
+
scope: string;
|
|
149
|
+
fieldNames: {
|
|
150
|
+
value: string;
|
|
151
|
+
label: string;
|
|
152
|
+
};
|
|
153
|
+
changeOnSelect: boolean;
|
|
154
|
+
autoSize: {
|
|
155
|
+
minRows: number;
|
|
156
|
+
};
|
|
157
|
+
placeholder: string;
|
|
158
|
+
};
|
|
159
|
+
description: string;
|
|
160
|
+
};
|
|
161
|
+
timeout: {
|
|
162
|
+
type: string;
|
|
163
|
+
title: string;
|
|
164
|
+
'x-decorator': string;
|
|
165
|
+
'x-decorator-props': {};
|
|
166
|
+
'x-component': string;
|
|
167
|
+
'x-component-props': {
|
|
168
|
+
addonAfter: string;
|
|
169
|
+
min: number;
|
|
170
|
+
step: number;
|
|
171
|
+
defaultValue: number;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
responseType: {
|
|
175
|
+
type: string;
|
|
176
|
+
title: string;
|
|
177
|
+
'x-decorator': string;
|
|
178
|
+
'x-decorator-props': {};
|
|
179
|
+
'x-component': string;
|
|
180
|
+
default: string;
|
|
181
|
+
enum: {
|
|
182
|
+
value: string;
|
|
183
|
+
label: string;
|
|
184
|
+
}[];
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"@nocobase/client": "1.0.0-alpha.1",
|
|
3
|
+
"react": "18.2.0",
|
|
4
|
+
"react-i18next": "11.18.6",
|
|
5
|
+
"@formily/react": "2.3.0",
|
|
6
|
+
"@nocobase/logger": "1.0.0-alpha.1",
|
|
7
|
+
"@nocobase/server": "1.0.0-alpha.1",
|
|
8
|
+
"@nocobase/test": "1.0.0-alpha.1",
|
|
9
|
+
"@formily/antd-v5": "1.1.9",
|
|
10
|
+
"antd": "5.12.8",
|
|
11
|
+
"@nocobase/utils": "1.0.0-alpha.1",
|
|
12
|
+
"react-router-dom": "6.21.0",
|
|
13
|
+
"@formily/shared": "2.3.0",
|
|
14
|
+
"@nocobase/actions": "1.0.0-alpha.1",
|
|
15
|
+
"@nocobase/evaluators": "1.0.0-alpha.1",
|
|
16
|
+
"axios": "0.26.1",
|
|
17
|
+
"@nocobase/database": "1.0.0-alpha.1"
|
|
18
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Access control": "접근 제어",
|
|
3
|
+
"Custom Request": "사용자 정의 요청",
|
|
4
|
+
"Request settings": "요청 설정",
|
|
5
|
+
"Roles": "역할",
|
|
6
|
+
"If not set, all roles can see this action": "설정되지 않은 경우 모든 역할이이 작업을 볼 수 있습니다",
|
|
7
|
+
"Title": "제목",
|
|
8
|
+
"HTTP method": "HTTP 메소드",
|
|
9
|
+
"URL": "URL",
|
|
10
|
+
"Headers": "헤더",
|
|
11
|
+
"Parameters": "파라미터",
|
|
12
|
+
"Add request header": "요청 헤더 추가",
|
|
13
|
+
"Add parameter": "파라미터 추가",
|
|
14
|
+
"Enter description info": "설명 정보 입력",
|
|
15
|
+
"Body": "바디",
|
|
16
|
+
"Use variable": "변수 사용",
|
|
17
|
+
"Format": "형식",
|
|
18
|
+
"Insert": "삽입",
|
|
19
|
+
"Timeout config": "타임아웃 설정",
|
|
20
|
+
"ms": "밀리초",
|
|
21
|
+
"Input request data": "요청 데이터 입력",
|
|
22
|
+
"Only support standard JSON data": "표준 JSON 데이터만 지원됩니다",
|
|
23
|
+
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\"은 \"application/json\"만 지원하며 지정할 필요가 없습니다",
|
|
24
|
+
"When the HTTP method is Post, Put or Patch, and this custom request inside the form, the request body will be automatically filled in with the form data": "HTTP 메소드가 Post, Put 또는 Patch이고이 사용자 정의 요청이 양식 내에있는 경우 요청 본문은 자동으로 양식 데이터로 채워집니다",
|
|
25
|
+
"Please configure the request settings first": "먼저 요청 설정을 구성하십시오"
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Access control": "权限控制",
|
|
3
|
+
"Custom Request": "自定义请求",
|
|
4
|
+
"Request settings": "请求设置",
|
|
5
|
+
"Roles": "角色",
|
|
6
|
+
"If not set, all roles can see this action": "如果不设置,所有角色都可以看到这个自定义请求",
|
|
7
|
+
"Title": "标题",
|
|
8
|
+
"HTTP method": "HTTP 方法",
|
|
9
|
+
"URL": "URL",
|
|
10
|
+
"Headers": "请求头",
|
|
11
|
+
"Parameters": "参数",
|
|
12
|
+
"Add request header": "添加请求头",
|
|
13
|
+
"Add parameter": "添加参数",
|
|
14
|
+
"Enter description info": "输入描述信息",
|
|
15
|
+
"Body": "请求体",
|
|
16
|
+
"Use variable": "使用变量",
|
|
17
|
+
"Format": "格式化",
|
|
18
|
+
"Insert": "插入",
|
|
19
|
+
"Timeout config": "超时设置",
|
|
20
|
+
"ms": "毫秒",
|
|
21
|
+
"Input request data": "输入请求数据",
|
|
22
|
+
"Only support standard JSON data": "仅支持标准 JSON 数据",
|
|
23
|
+
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" 请求头仅支持 \"application/json\",无需填写",
|
|
24
|
+
"When the HTTP method is Post, Put or Patch, and this custom request inside the form, the request body will be automatically filled in with the form data": "当请求方法为 Post、Put 或 Patch 时,且此自定义请求在表单内,请求体将自动填充表单数据",
|
|
25
|
+
"Please configure the request settings first": "请先配置请求设置"
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var listByCurrentRole_exports = {};
|
|
19
|
+
__export(listByCurrentRole_exports, {
|
|
20
|
+
listByCurrentRole: () => listByCurrentRole
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(listByCurrentRole_exports);
|
|
23
|
+
async function listByCurrentRole(ctx) {
|
|
24
|
+
const repo = ctx.db.getRepository("customRequests");
|
|
25
|
+
const data = await repo.find({
|
|
26
|
+
appends: ["roles"]
|
|
27
|
+
});
|
|
28
|
+
const crRepo = ctx.db.getRepository("customRequestsRoles");
|
|
29
|
+
ctx.body = data.filter((item) => {
|
|
30
|
+
return !item.roles.length;
|
|
31
|
+
}).map((item) => item.key).concat(
|
|
32
|
+
(await crRepo.find({
|
|
33
|
+
filter: {
|
|
34
|
+
roleName: ctx.state.currentRole
|
|
35
|
+
}
|
|
36
|
+
})).map((item) => item.customRequestKey)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
listByCurrentRole
|
|
42
|
+
});
|