@tachybase/plugin-data-source-common 1.0.6 → 1.0.25

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.
@@ -58,7 +58,7 @@
58
58
  .ant-formily-item-feedback-layout-loose {
59
59
  margin-bottom: 10px;
60
60
  }
61
- `},properties:{requestAction:{type:"string","x-component":Q,"x-component-props":{actionForm:!0}},requestTab:{type:"void","x-decorator":"FormItem","x-component":Z},responseTab:{type:"string","x-component":Ke}}}}},tachyBaseResponse:{type:"void","x-decorator":"Col","x-decorator-props":{span:8},"x-component":"Card","x-component-props":{bordered:!1,title:e("TachyBase response"),style:{height:"80vh",overflowY:"auto",borderTopLeftRadius:0,borderBottomLeftRadius:0}},properties:{responseContainer:{type:"void","x-decorator":"Form",properties:{alertError:{type:"string","x-component":ke},responseTransformer:{type:"string","x-decorator":"FormItem","x-component":ee},debugResponse:{type:"string","x-component":Be}}}}}}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{debug:{title:'{{t("Debug")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDebugAction }}"}},extractFieldMetadata:{"x-component":Oe}}}}}}}},Re=()=>{const e=x.useForm(),{setVisible:t}=v.useContext(r.ActionContext),{setRawResponse:s,setDebugResponse:o}=j();return{run(){t(!1),e.reset(),e.setValuesIn("responseTab",null),s(null),o(null)}}},_e=()=>{const e=x.useField(),t=r.useAPIClient(),s=x.useForm(),{form:o,actionKey:n,requestActionForm:a}=O(),{name:i}=$.useParams(),{setRawResponse:p,setDebugResponse:l,setResponseValidationErrorMessage:d}=j();return{run(){return D(this,null,function*(){var T,w;const h=(w=(T=o==null?void 0:o.values)==null?void 0:T.actions)==null?void 0:w[n];try{e.data=(e==null?void 0:e.data)||{},e.data.loading=!0,yield a.submit();const b=t.resource("dataSources.httpCollections",i),I=V.omit(s.values,"responseTab"),{data:{data:S}}=yield b.runAction({values:{debug:!0,inferFields:!1,actionOptions:A(f({},h),{type:n,responseTransformer:h==null?void 0:h.responseTransformer}),debugVars:I}});e.data.loading=!1;const{rawResponse:m,debugBody:M,responseValidationErrorMessage:B}=S;p(m),l(M),d(B)}catch(b){e.data.loading=!1,console.log(b)}})}}},Je=()=>{const{t:e}=q(),t=Xe();return c.jsx(r.SchemaComponent,{schema:t,components:{Form:k.Form,Input:r.Input,Action:r.Action,FormItem:r.FormItem,InputNumber:r.InputNumber,Card:g.Card,Variable:r.Variable,Space:r.Space,Select:g.Select,FormLayout:k.FormLayout,Row:g.Row,Col:g.Col},scope:{t:e,useDebugAction:_e,useCancelAction:Re,useVariableOptions:L}})},Ge=()=>{const{t:e}=q(),{requestActionForm:t}=O(),[s,o]=v.useState(!1),n=()=>D(this,null,function*(){yield t.submit(),o(!0)});return c.jsxs(c.Fragment,{children:[c.jsx(g.Button,{type:"primary",onClick:n,children:e("Try it out")}),c.jsx(ye,{visible:s,setVisible:o,children:c.jsx(Je,{})})]})},Ye=e=>{const t=x.useForm(),{actionKey:s}=e,o=v.useMemo(()=>x.createForm({}),[]),[n,a]=v.useState(null);return c.jsx(ue,{value:{form:A(f({},t),{[s]:o}),actionKey:s,requestActionForm:o,responseTransformer:n,setResponseTransformer:a},children:e.children})},W=(e,t)=>{const s=v.useRef();return{type:"void","x-decorator":Ye,"x-decorator-props":{actionKey:e},"x-component":"FormCollapse.CollapsePanel","x-component-props":{header:t,key:e},properties:{form:{"x-decorator":"Form","x-decorator-props":{className:r.css`
61
+ `},properties:{requestAction:{type:"string","x-component":Q,"x-component-props":{actionForm:!0}},requestTab:{type:"void","x-decorator":"FormItem","x-component":Z},responseTab:{type:"string","x-component":Ke}}}}},tachyBaseResponse:{type:"void","x-decorator":"Col","x-decorator-props":{span:8},"x-component":"Card","x-component-props":{bordered:!1,title:e("TachyBase response"),style:{height:"80vh",overflowY:"auto",borderTopLeftRadius:0,borderBottomLeftRadius:0}},properties:{responseContainer:{type:"void","x-decorator":"Form",properties:{alertError:{type:"string","x-component":ke},responseTransformer:{type:"string","x-decorator":"FormItem","x-component":ee},debugResponse:{type:"string","x-component":Be}}}}}}},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{debug:{title:'{{t("Debug")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDebugAction }}"}},extractFieldMetadata:{"x-component":Oe}}}}}}}},Re=()=>{const e=x.useForm(),{setVisible:t}=v.useContext(r.ActionContext),{setRawResponse:s,setDebugResponse:o}=j();return{run(){t(!1),e.reset(),e.setValuesIn("responseTab",null),s(null),o(null)}}},_e=()=>{const e=x.useField(),t=r.useAPIClient(),s=x.useForm(),{form:o,actionKey:n,requestActionForm:a}=O(),{name:i}=$.useParams(),{setRawResponse:p,setDebugResponse:l,setResponseValidationErrorMessage:d}=j();return{run(){return D(this,null,function*(){var T,w;const h=(w=(T=o==null?void 0:o.values)==null?void 0:T.actions)==null?void 0:w[n];try{e.data=(e==null?void 0:e.data)||{},e.data.loading=!0,yield a.submit();const b=t.resource("dataSources.httpCollections",i),I=V.omit(s.values,"responseTab"),{data:{data:S}}=yield b.runAction({values:{debug:!0,inferFields:!1,actionOptions:A(f({},h),{type:n,responseTransformer:h==null?void 0:h.responseTransformer}),debugVars:I}});e.data.loading=!1;const{rawResponse:m,debugBody:M,responseValidationErrorMessage:B}=S;p(m),l(M),d(B)}catch(b){e.data.loading=!1,console.error(b)}})}}},Je=()=>{const{t:e}=q(),t=Xe();return c.jsx(r.SchemaComponent,{schema:t,components:{Form:k.Form,Input:r.Input,Action:r.Action,FormItem:r.FormItem,InputNumber:r.InputNumber,Card:g.Card,Variable:r.Variable,Space:r.Space,Select:g.Select,FormLayout:k.FormLayout,Row:g.Row,Col:g.Col},scope:{t:e,useDebugAction:_e,useCancelAction:Re,useVariableOptions:L}})},Ge=()=>{const{t:e}=q(),{requestActionForm:t}=O(),[s,o]=v.useState(!1),n=()=>D(this,null,function*(){yield t.submit(),o(!0)});return c.jsxs(c.Fragment,{children:[c.jsx(g.Button,{type:"primary",onClick:n,children:e("Try it out")}),c.jsx(ye,{visible:s,setVisible:o,children:c.jsx(Je,{})})]})},Ye=e=>{const t=x.useForm(),{actionKey:s}=e,o=v.useMemo(()=>x.createForm({}),[]),[n,a]=v.useState(null);return c.jsx(ue,{value:{form:A(f({},t),{[s]:o}),actionKey:s,requestActionForm:o,responseTransformer:n,setResponseTransformer:a},children:e.children})},W=(e,t)=>{const s=v.useRef();return{type:"void","x-decorator":Ye,"x-decorator-props":{actionKey:e},"x-component":"FormCollapse.CollapsePanel","x-component-props":{header:t,key:e},properties:{form:{"x-decorator":"Form","x-decorator-props":{className:r.css`
62
62
  .ant-formily-item-feedback-layout-loose {
63
63
  margin-bottom: 10px;
64
64
  }
@@ -1,16 +1,16 @@
1
1
  module.exports = {
2
- "@tachybase/client": "1.0.6",
3
- "@tachybase/module-data-source": "1.0.6",
4
- "@tachybase/server": "1.0.6",
2
+ "@tachybase/client": "1.0.25",
3
+ "@tachybase/module-data-source": "1.0.25",
4
+ "@tachybase/server": "1.0.25",
5
5
  "react": "18.3.1",
6
6
  "antd": "5.22.5",
7
7
  "lodash": "4.17.21",
8
- "@tachybase/database": "1.0.6",
9
- "@tachybase/data-source": "1.0.6",
10
- "@tachybase/utils": "1.0.6",
11
- "axios": "1.7.7",
8
+ "@tachybase/database": "1.0.25",
9
+ "@tachybase/data-source": "1.0.25",
10
+ "@tachybase/utils": "1.0.25",
11
+ "axios": "0.27.2",
12
12
  "@ant-design/icons": "5.5.2",
13
- "@tachybase/schema": "1.0.6",
14
- "@tachybase/components": "1.0.6",
13
+ "@tachybase/schema": "1.0.25",
14
+ "@tachybase/components": "1.0.25",
15
15
  "react-router-dom": "6.28.1"
16
16
  };
@@ -116,10 +116,7 @@ function rawTypeToFieldType(rawType, exampleValue) {
116
116
  },
117
117
  number: () => {
118
118
  if (Number.isInteger(exampleValue)) {
119
- if ((0, import_utils.dayjs)(exampleValue).isValid()) {
120
- return ["integer", "bigInt"];
121
- }
122
- return "integer";
119
+ return ["integer", "float", "date", "bigInt"];
123
120
  }
124
121
  return "float";
125
122
  },
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-data-source-common",
3
- "version": "1.0.6",
3
+ "displayName": "External DataSource Support",
4
+ "version": "1.0.25",
5
+ "description": "Supports more data sources",
6
+ "keywords": [
7
+ "Data sources"
8
+ ],
4
9
  "main": "dist/server/index.js",
5
10
  "dependencies": {},
6
11
  "devDependencies": {
@@ -14,15 +19,15 @@
14
19
  "react-router-dom": "6.28.1"
15
20
  },
16
21
  "peerDependencies": {
17
- "@tachybase/client": "1.0.6",
18
- "@tachybase/components": "1.0.6",
19
- "@tachybase/data-source": "1.0.6",
20
- "@tachybase/database": "1.0.6",
21
- "@tachybase/module-data-source": "1.0.6",
22
- "@tachybase/schema": "1.0.6",
23
- "@tachybase/test": "1.0.6",
24
- "@tachybase/server": "1.0.6",
25
- "@tachybase/utils": "1.0.6"
22
+ "@tachybase/client": "1.0.25",
23
+ "@tachybase/components": "1.0.25",
24
+ "@tachybase/database": "1.0.25",
25
+ "@tachybase/data-source": "1.0.25",
26
+ "@tachybase/module-data-source": "1.0.25",
27
+ "@tachybase/schema": "1.0.25",
28
+ "@tachybase/server": "1.0.25",
29
+ "@tachybase/test": "1.0.25",
30
+ "@tachybase/utils": "1.0.25"
26
31
  },
27
32
  "description.zh-CN": "支持更多的数据源",
28
33
  "displayName.zh-CN": "外部数据源支持",