@vyr/cli 0.0.25 → 0.0.26

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.
Files changed (203) hide show
  1. package/.bin/default/index.js +4 -0
  2. package/.bin/install/index.js +2 -0
  3. package/.entry/app.js +362 -362
  4. package/build/css/{9786.6bfee4ca.css → 2357.20584c43.css} +1 -1
  5. package/build/css/{6151.e4de2b69.css → 4011.fc069ae3.css} +1 -1
  6. package/build/css/{6881.972ad8f8.css → 6881.c7cb44c0.css} +1 -1
  7. package/build/css/768.6c925006.css +1 -0
  8. package/build/css/{3745.5e7a01f4.css → 9160.6a744205.css} +1 -1
  9. package/build/css/{4537.9b4ae552.css → 918.1da69a00.css} +2 -2
  10. package/build/css/login.c49ecb09.css +1 -0
  11. package/build/fonts/iconfont.0d8d5af4.woff +0 -0
  12. package/build/fonts/{iconfont.10345b2b.ttf → iconfont.49814d77.ttf} +0 -0
  13. package/build/index.html +1 -1
  14. package/build/js/1015.6b930e6b.js +1 -0
  15. package/build/js/1018.feb3213b.js +1 -0
  16. package/build/js/150.2368d63c.js +1 -0
  17. package/build/js/1508.ad60597c.js +1 -0
  18. package/build/js/{4582.71b3bbe1.js → 1541.ab4dcc45.js} +100 -100
  19. package/build/js/2132.d99fd402.js +1 -0
  20. package/build/js/215.0003a521.js +1 -0
  21. package/build/js/2357.990ebfbc.js +1 -0
  22. package/build/js/{2546.9fd3dc42.js → 2546.3383e2b7.js} +1 -1
  23. package/build/js/2596.6b885678.js +1 -0
  24. package/build/js/288.deb7db30.js +1 -0
  25. package/build/js/3312.be721fac.js +1 -0
  26. package/build/js/344.f9b8faec.js +1 -0
  27. package/build/js/3553.5a3a5f4c.js +1 -0
  28. package/build/js/4011.4f960789.js +1 -0
  29. package/build/js/4939.c2476b74.js +1 -0
  30. package/build/js/5547.b25a8b2e.js +1 -0
  31. package/build/js/677.fbdce394.js +1 -0
  32. package/build/js/6881.52ca7073.js +1 -0
  33. package/build/js/7320.9345566b.js +1 -0
  34. package/build/js/768.cf51599f.js +1 -0
  35. package/build/js/7769.95421d48.js +1 -0
  36. package/build/js/7907.8ff46377.js +1 -0
  37. package/build/js/7928.6c142786.js +1 -0
  38. package/build/js/7963.33f8605d.js +1 -0
  39. package/build/js/8637.348bcf40.js +1 -0
  40. package/build/js/9127.9dbc1ccb.js +1 -0
  41. package/build/js/9160.294ecd13.js +1 -0
  42. package/build/js/918.164497d1.js +3 -0
  43. package/build/js/931.f5b2dd0e.js +1 -0
  44. package/build/js/9751.1c059f35.js +1 -0
  45. package/build/js/chunk-vendors.94bb9e3c.js +300 -0
  46. package/build/js/index.49e6e2f0.js +1 -0
  47. package/build/js/login.0e6f1e5f.js +1 -0
  48. package/build/js/preview.c1d85328.js +1 -0
  49. package/build/login.html +1 -1
  50. package/build/preview.html +1 -1
  51. package/output/auto-provider-plugin/loader.js +2 -1
  52. package/output/auto-provider-plugin/package.json +1 -1
  53. package/output/builtin/build/component/CodeEditor.vue.d.ts +1 -0
  54. package/output/builtin/build/component/DatasetItem.vue.d.ts +2 -1
  55. package/output/builtin/build/component/HeaderSearch.vue.d.ts +13 -0
  56. package/output/builtin/build/component/index.d.ts +2 -1
  57. package/output/builtin/build/locale/LanguageProvider.d.ts +34 -32
  58. package/output/builtin/build/option/index.d.ts +9 -1
  59. package/output/builtin/build/service/footer/action/AddDirAction.d.ts +0 -1
  60. package/output/builtin/package.json +1 -1
  61. package/output/class-wrapper-plugin/package.json +1 -1
  62. package/output/declare/package.json +2 -2
  63. package/output/design/package.json +5 -3
  64. package/output/design/src/components/Dialog.vue +2 -2
  65. package/output/design/src/components/DynamicDialog.vue +35 -29
  66. package/output/design/src/components/Scroll.vue +1 -1
  67. package/output/design/src/components/Select.vue +9 -1
  68. package/output/design/src/components/composables/useSearch.ts +1 -0
  69. package/output/design/src/components/utils/Confirm.ts +1 -1
  70. package/output/design/src/components/utils/DynamicDialog.ts +12 -2
  71. package/output/design/src/font/demo_index.html +26 -3
  72. package/output/design/src/font/iconfont.css +7 -3
  73. package/output/design/src/font/iconfont.js +1 -1
  74. package/output/design/src/font/iconfont.json +7 -0
  75. package/output/design/src/font/iconfont.ttf +0 -0
  76. package/output/design/src/font/iconfont.woff +0 -0
  77. package/output/design/src/font/iconfont.woff2 +0 -0
  78. package/output/design/src/index.ts +6 -0
  79. package/output/design/src/theme/global.less +6 -0
  80. package/output/engine/package.json +2 -2
  81. package/output/engine/src/Engine.ts +2 -2
  82. package/output/engine/src/asset/Asset.ts +2 -2
  83. package/output/engine/src/descriptor/Descriptor.ts +1 -1
  84. package/output/engine/src/graphics/Graphics.ts +1 -1
  85. package/output/engine/src/interpreter/Interpreter.ts +1 -1
  86. package/output/engine/src/utils/http.ts +8 -1
  87. package/output/locale/package.json +1 -1
  88. package/output/remote/package.json +1 -1
  89. package/output/rollup-config-plugin/package.json +1 -1
  90. package/output/runtime/build/data/global.d.ts +6 -0
  91. package/output/runtime/build/data/header.d.ts +4 -0
  92. package/output/runtime/package.json +1 -1
  93. package/output/service/package.json +1 -1
  94. package/output/service-asset/package.json +1 -1
  95. package/output/service-asset/src/AssetService.ts +2 -3
  96. package/output/service-example/package.json +1 -1
  97. package/output/service-example/src/ExampleService.ts +3 -4
  98. package/output/service-graph/package.json +1 -1
  99. package/output/service-rpc/package.json +5 -3
  100. package/output/service-rpc/src/RpcService.ts +9 -9
  101. package/output/service-rpc/src/asset/add.ts +1 -1
  102. package/output/service-rpc/src/asset/close.ts +1 -1
  103. package/output/service-rpc/src/asset/copy.ts +1 -1
  104. package/output/service-rpc/src/asset/create.ts +1 -1
  105. package/output/service-rpc/src/asset/cut.ts +1 -1
  106. package/output/service-rpc/src/asset/delete.ts +1 -1
  107. package/output/service-rpc/src/asset/dragdrap.ts +1 -1
  108. package/output/service-rpc/src/asset/initialize.ts +1 -1
  109. package/output/service-rpc/src/asset/open.ts +1 -1
  110. package/output/service-rpc/src/asset/remove.ts +1 -1
  111. package/output/service-rpc/src/asset/rename.ts +1 -1
  112. package/output/service-rpc/src/asset/select.ts +1 -1
  113. package/output/service-rpc/src/asset/update.ts +1 -1
  114. package/output/service-rpc/src/dep/add.ts +1 -1
  115. package/output/service-rpc/src/dep/create.ts +1 -1
  116. package/output/service-rpc/src/dep/delete.ts +1 -1
  117. package/output/service-rpc/src/dep/remove.ts +1 -1
  118. package/output/service-rpc/src/dep/update.ts +1 -1
  119. package/output/service-rpc/src/domain/Entity.ts +7 -0
  120. package/output/service-rpc/src/example/apply.ts +1 -1
  121. package/output/service-rpc/src/example/create.ts +1 -1
  122. package/output/service-rpc/src/example/delete.ts +1 -1
  123. package/output/service-rpc/src/example/initialize.ts +1 -1
  124. package/output/service-rpc/src/example/list.ts +1 -1
  125. package/output/service-rpc/src/index.ts +1 -1
  126. package/output/service-rpc/src/locale/LanguageProvider.ts +5 -1
  127. package/output/service-rpc/src/request/index.ts +50 -0
  128. package/output/service-rpc/src/rpc/confirm.ts +1 -1
  129. package/output/service-rpc/src/rpc/connection.ts +1 -1
  130. package/output/service-rpc/src/rpc/disconnect.ts +1 -1
  131. package/output/service-rpc/src/rpc/getUser.ts +1 -1
  132. package/output/service-rpc/src/rpc/login.ts +1 -1
  133. package/output/service-rpc/src/rpc/logout.ts +1 -1
  134. package/output/service-rpc/src/rpc/redo.ts +1 -1
  135. package/output/service-rpc/src/rpc/undo.ts +1 -1
  136. package/output/service-rpc/src/scene/add.ts +1 -1
  137. package/output/service-rpc/src/scene/create.ts +1 -1
  138. package/output/service-rpc/src/scene/delete.ts +1 -1
  139. package/output/service-rpc/src/scene/download.ts +1 -1
  140. package/output/service-rpc/src/scene/dragdrap.ts +1 -1
  141. package/output/service-rpc/src/scene/initialize.ts +1 -1
  142. package/output/service-rpc/src/scene/record.ts +1 -1
  143. package/output/service-rpc/src/scene/remove.ts +1 -1
  144. package/output/service-rpc/src/scene/switch.ts +1 -1
  145. package/output/service-rpc/src/scene/update.ts +1 -1
  146. package/output/service-rpc/src/sidebar/switch.ts +1 -1
  147. package/output/service-scene/package.json +1 -1
  148. package/output/service-scene/src/SceneService.ts +2 -3
  149. package/output/var-rename-plugin/package.json +1 -1
  150. package/package.json +80 -1
  151. package/patches/knex+2.5.1.patch +26 -0
  152. package/build/css/1111.e408e6d4.css +0 -1
  153. package/build/css/login.b74658d1.css +0 -1
  154. package/build/fonts/iconfont.4a13a979.woff +0 -0
  155. package/build/js/1018.41064c0f.js +0 -1
  156. package/build/js/1111.be6e2c40.js +0 -1
  157. package/build/js/1124.74dc01cf.js +0 -1
  158. package/build/js/150.e7f9045d.js +0 -1
  159. package/build/js/1780.599a4f56.js +0 -1
  160. package/build/js/2132.0f13c789.js +0 -1
  161. package/build/js/2328.91f4fab2.js +0 -1
  162. package/build/js/3553.c58039ca.js +0 -1
  163. package/build/js/3745.4b658c7d.js +0 -1
  164. package/build/js/3785.0e5bac50.js +0 -1
  165. package/build/js/4537.0c0b1621.js +0 -3
  166. package/build/js/5547.e7e03105.js +0 -1
  167. package/build/js/6151.73bf0dca.js +0 -1
  168. package/build/js/6166.a11b6605.js +0 -1
  169. package/build/js/677.1be417ae.js +0 -1
  170. package/build/js/6881.110a38eb.js +0 -1
  171. package/build/js/7713.7dac62b2.js +0 -1
  172. package/build/js/7769.da192016.js +0 -1
  173. package/build/js/7928.00d662e4.js +0 -1
  174. package/build/js/8637.8a669454.js +0 -1
  175. package/build/js/8743.ae6b01fb.js +0 -1
  176. package/build/js/931.b906c8b3.js +0 -1
  177. package/build/js/9399.6f01e6fb.js +0 -1
  178. package/build/js/94.043c5ab1.js +0 -1
  179. package/build/js/9751.062a0ec7.js +0 -1
  180. package/build/js/9786.e8445259.js +0 -1
  181. package/build/js/9947.e172d61d.js +0 -1
  182. package/build/js/chunk-vendors.3148df9e.js +0 -300
  183. package/build/js/index.ab116b9c.js +0 -1
  184. package/build/js/login.2480f0b4.js +0 -1
  185. package/build/js/preview.191ab535.js +0 -1
  186. /package/build/css/{1124.b91daf98.css → 215.b91daf98.css} +0 -0
  187. /package/build/css/{8743.b91daf98.css → 2596.b91daf98.css} +0 -0
  188. /package/build/js/{110.e2819667.js → 110.132cb06d.js} +0 -0
  189. /package/build/js/{1349.5011b482.js → 1349.581acd13.js} +0 -0
  190. /package/build/js/{1402.e4936bfb.js → 1402.41e93cca.js} +0 -0
  191. /package/build/js/{1877.f14acfa1.js → 1877.f7dfcbbb.js} +0 -0
  192. /package/build/js/{2318.441a2db7.js → 2318.aa9ea4c9.js} +0 -0
  193. /package/build/js/{250.4513f7c1.js → 250.ee102b58.js} +0 -0
  194. /package/build/js/{3085.42a6da4f.js → 3085.89eae237.js} +0 -0
  195. /package/build/js/{4263.f1987228.js → 4263.33a52188.js} +0 -0
  196. /package/build/js/{4530.2a2c0560.js → 4530.46216301.js} +0 -0
  197. /package/build/js/{5639.a09657c9.js → 5639.fd7fc4f3.js} +0 -0
  198. /package/build/js/{6357.fc8796e2.js → 6357.92e3bda6.js} +0 -0
  199. /package/build/js/{7195.e082572c.js → 7195.20386308.js} +0 -0
  200. /package/build/js/{8657.f0bd7f1f.js → 8657.0480062d.js} +0 -0
  201. /package/build/js/{9044.f58e5368.js → 9044.a0d33e3e.js} +0 -0
  202. /package/build/js/{9170.4182d4a8.js → 9170.00c77288.js} +0 -0
  203. /package/build/js/{9620.ce105b9b.js → 9620.edd4c694.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/remote",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/pack-rollup-config-plugin",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "author": "",
@@ -12,11 +12,17 @@ interface ScriptOption {
12
12
  getDefaultInput(): any;
13
13
  getPropertyOptions?: () => ScriptPropertyOptionsGetters;
14
14
  }
15
+ interface interfaceOption {
16
+ label: string;
17
+ value: string;
18
+ }
15
19
  declare class Template {
16
20
  visible: boolean;
17
21
  }
18
22
  declare class Global {
19
23
  readonly scripts: ScriptOption[];
20
24
  readonly template: Template;
25
+ readonly interfaces: interfaceOption[];
26
+ setInterfaces(interfaces: interfaceOption[]): void;
21
27
  }
22
28
  export { ScriptPropertyOptions, ScriptPropertyOptionsGetters, ScriptOption, Global, };
@@ -7,5 +7,9 @@ declare class Status {
7
7
  }
8
8
  declare class Header {
9
9
  status: Status;
10
+ menus: {
11
+ label: string;
12
+ value: string;
13
+ }[];
10
14
  }
11
15
  export { Header };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/runtime",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": " - Type Declarations",
5
5
  "main": "",
6
6
  "author": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/service",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/service-asset",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -1,9 +1,8 @@
1
- import axios from 'axios'
2
1
  import { Service } from '@vyr/service'
3
2
  import { DraggableData, DraggableEndType, } from '@vyr/declare'
4
3
  import { runtime } from '@vyr/runtime'
5
4
  import { Descriptor, DeserializationObject } from '@vyr/engine'
6
- import { RpcService, Message, VirtualNode } from '@vyr/service-rpc'
5
+ import { RpcService, Message, VirtualNode, request } from '@vyr/service-rpc'
7
6
  import { AssetMethodProvider } from "./AssetMethodProvider"
8
7
 
9
8
  class AssetService extends Service {
@@ -109,7 +108,7 @@ class AssetService extends Service {
109
108
  }
110
109
 
111
110
  async read(url: string) {
112
- const res = await axios.get<string>(url, { responseType: 'text' })
111
+ const res = await request.get<string>(url, { responseType: 'text' })
113
112
  return res.data
114
113
  }
115
114
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/service-example",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -1,6 +1,5 @@
1
- import axios from 'axios'
2
1
  import { runtime } from '@vyr/runtime'
3
- import { Message, RpcService } from '@vyr/service-rpc'
2
+ import { Message, RpcService, request } from '@vyr/service-rpc'
4
3
  import { Service } from '@vyr/service'
5
4
  import { AssetService } from '@vyr/service-asset'
6
5
  import { ExampleMethodProvider } from './ExampleMethodProvider'
@@ -41,12 +40,12 @@ class ExampleService extends Service {
41
40
  }
42
41
 
43
42
  async download(example: string, name: string) {
44
- const res = await axios.get<string>('/download/example', { params: { example }, responseType: 'blob' })
43
+ const res = await request.get('/download/example', { params: { example }, responseType: 'blob' })
45
44
  AssetService.save(name, res.data)
46
45
  }
47
46
 
48
47
  async upload(formData: FormData) {
49
- await axios.post<string>('/upload/example', formData)
48
+ await request.post<string>('/upload/example', formData)
50
49
  }
51
50
  }
52
51
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyr/service-graph",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@vyr/service-rpc-universal",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "moment": "^2.30.1",
10
- "@vyr/engine": "0.0.25"
9
+ "@vyr/engine": "0.0.26",
10
+ "camelcase-keys": "^10.0.1",
11
+ "decamelize-keys": "^2.0.1",
12
+ "moment": "^2.30.1"
11
13
  },
12
14
  "files": [
13
15
  "package.json",
@@ -1,12 +1,10 @@
1
- import axios from 'axios'
2
1
  import { Serialization, Listener } from '@vyr/engine'
3
2
  import { Service } from '@vyr/service'
4
3
  import { path, tokenKey, topic, Confirm, Message } from '@vyr/service-rpc-universal'
4
+ import { request } from './request'
5
5
 
6
6
  interface RpcServiceConfig {
7
7
  token: string
8
- notify: (msg: string) => void
9
- confirm: (options: Partial<Confirm>, value?: string) => Promise<Confirm>
10
8
  }
11
9
 
12
10
  const _logout = () => {
@@ -17,10 +15,14 @@ const _logout = () => {
17
15
  }
18
16
 
19
17
  class RpcService extends Service {
18
+ static notify = (msg: string) => { }
19
+ static confirm = async (options: Partial<Confirm>, value?: string) => {
20
+ return options as Confirm
21
+ }
20
22
 
21
23
  static async login(name: string, password: string) {
22
24
  const data = new Message.rpc.login.RequestMessage(name, password)
23
- const res = await axios.post<InstanceType<typeof Message['rpc']['login']['NoticeMessage']>>(Message.rpc.login.Method, data)
25
+ const res = await request.post<InstanceType<typeof Message['rpc']['login']['NoticeMessage']>>(Message.rpc.login.Method, data)
24
26
  window.localStorage.setItem(tokenKey, res.data.params.token)
25
27
 
26
28
  const location = new URL(window.location.href)
@@ -30,7 +32,7 @@ class RpcService extends Service {
30
32
 
31
33
  static async getUser() {
32
34
  const data = new Message.rpc.getUser.RequestMessage()
33
- const res = await axios.get<InstanceType<typeof Message['rpc']['getUser']['NoticeMessage']>>(Message.rpc.getUser.Method, data)
35
+ const res = await request.get<InstanceType<typeof Message['rpc']['getUser']['NoticeMessage']>>(Message.rpc.getUser.Method, data)
34
36
  return res.data.params.user
35
37
  }
36
38
 
@@ -42,21 +44,19 @@ class RpcService extends Service {
42
44
  }
43
45
 
44
46
  private _listener = new Listener<{ [k: string]: (msg: Message) => void }>()
45
- private confirm
46
47
  private socket: any
47
48
  private needTrigger = false
48
49
  private msgQueue: Message[] = []
49
50
 
50
51
  constructor(name: string, config: RpcServiceConfig) {
51
52
  super(name)
52
- this.confirm = config.confirm
53
53
  const params = { path, extraHeaders: { authorization: 'Bearer ' + config.token }, autoConnect: false }
54
54
  //@ts-ignore
55
55
  this.socket = new window.io(location.href, params)
56
56
 
57
57
  this.socket.on(topic, (content: string) => {
58
58
  const msg = Serialization.parse(content) as Message
59
- if (msg.message !== undefined) return config.notify(msg.message)
59
+ if (msg.message !== undefined) return RpcService.notify(msg.message)
60
60
  this._delayTrigger(msg)
61
61
  })
62
62
  this.socket.on('disconnect', () => {
@@ -67,7 +67,7 @@ class RpcService extends Service {
67
67
  }
68
68
 
69
69
  private _onConfirm = async (msg: InstanceType<typeof Message['rpc']['confirm']['NoticeMessage']>) => {
70
- const result = await this.confirm(msg.params.config)
70
+ const result = await RpcService.confirm(msg.params.config)
71
71
  msg.params.config.value = result.value
72
72
  msg.params.config.success = result.success
73
73
  this.send(msg)
@@ -1,7 +1,7 @@
1
1
  import { Descriptor, DeserializationObject } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/asset.add'
4
+ const Method = '/vyr/asset.add'
5
5
 
6
6
  interface Params {
7
7
  url: string
@@ -4,7 +4,7 @@ interface RequestParams {
4
4
  url: string
5
5
  }
6
6
 
7
- const Method = '/cli/asset.close'
7
+ const Method = '/vyr/asset.close'
8
8
 
9
9
  class RequestMessage extends IMessage {
10
10
  method = Method
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.copy'
3
+ const Method = '/vyr/asset.copy'
4
4
 
5
5
  interface RequestParams {
6
6
  /**需要复制的文件路径 */
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.create'
3
+ const Method = '/vyr/asset.create'
4
4
 
5
5
  interface RequestParams {
6
6
  fileType: boolean
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.cut'
3
+ const Method = '/vyr/asset.cut'
4
4
 
5
5
  interface RequestParams {
6
6
  /**需要剪切的文件路径 */
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.delete'
3
+ const Method = '/vyr/asset.delete'
4
4
 
5
5
  interface Params {
6
6
  urls: string[]
@@ -1,7 +1,7 @@
1
1
  import { DraggableEndType, DraggableData } from '@vyr/declare'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/asset.dragdrap'
4
+ const Method = '/vyr/asset.dragdrap'
5
5
 
6
6
  interface Params {
7
7
  url: string
@@ -2,7 +2,7 @@ import { DeserializationObject } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
  import { VirtualNode } from '../VirtualNode'
4
4
 
5
- const Method = '/cli/asset.initialize'
5
+ const Method = '/vyr/asset.initialize'
6
6
 
7
7
  class RequestMessage extends IMessage {
8
8
  method = Method
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.open'
3
+ const Method = '/vyr/asset.open'
4
4
 
5
5
  interface RequestParams {
6
6
  url: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.remove'
3
+ const Method = '/vyr/asset.remove'
4
4
 
5
5
  interface Params {
6
6
  url: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.rename'
3
+ const Method = '/vyr/asset.rename'
4
4
 
5
5
  interface RequestParams {
6
6
  url: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/asset.select'
3
+ const Method = '/vyr/asset.select'
4
4
 
5
5
  interface RequestParams {
6
6
  url: string
@@ -1,7 +1,7 @@
1
1
  import { Descriptor, DeserializationObject } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/asset.update'
4
+ const Method = '/vyr/asset.update'
5
5
 
6
6
  interface RequestParams {
7
7
  url: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/dep.add'
3
+ const Method = '/vyr/dep.add'
4
4
 
5
5
 
6
6
  interface NoticeParams {
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/dep.create'
3
+ const Method = '/vyr/dep.create'
4
4
 
5
5
 
6
6
  interface NoticeParams {
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/dep.delete'
3
+ const Method = '/vyr/dep.delete'
4
4
 
5
5
 
6
6
  interface NoticeParams {
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/dep.remove'
3
+ const Method = '/vyr/dep.remove'
4
4
 
5
5
 
6
6
  interface NoticeParams {
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/dep.update'
3
+ const Method = '/vyr/dep.update'
4
4
 
5
5
 
6
6
  interface NoticeParams {
@@ -1,6 +1,13 @@
1
+ import camelcaseKeys from 'camelcase-keys'
2
+ import decamelizeKeys from 'decamelize-keys'
3
+
1
4
  abstract class Entity {
2
5
  static primaryKey: string
3
6
  static dateFormat = 'YYYY-MM-DD HH:mm:ss'
7
+ /**下划线转驼峰 */
8
+ static camelcaseKeys = (data: any) => camelcaseKeys(data, { deep: true })
9
+ /**驼峰转下划线 */
10
+ static decamelizeKeys = (data: any) => decamelizeKeys(data, { deep: true })
4
11
 
5
12
  abstract toVO(): Entity
6
13
 
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/example.apply'
3
+ const Method = '/vyr/example.apply'
4
4
 
5
5
  interface RequestParams {
6
6
  example: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/example.create'
3
+ const Method = '/vyr/example.create'
4
4
 
5
5
  interface RequestParams {
6
6
  name: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/example.delete'
3
+ const Method = '/vyr/example.delete'
4
4
 
5
5
  interface RequestParams {
6
6
  example: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/example.initialize'
3
+ const Method = '/vyr/example.initialize'
4
4
 
5
5
  class RequestMessage extends IMessage {
6
6
  method = Method
@@ -1,7 +1,7 @@
1
1
  import { ExampleVO } from '../domain'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/example.list'
4
+ const Method = '/vyr/example.list'
5
5
 
6
6
  interface RequestParams {
7
7
  name: string
@@ -7,7 +7,7 @@ export * from './UseRecord'
7
7
  export * from './domain'
8
8
  export * from './rpc/confirm'
9
9
 
10
- const path = '/rpc.io'
10
+ const path = '/vyr.io'
11
11
  const topic = '/service'
12
12
  const tokenKey = '@vyr/key'
13
13
 
@@ -1,12 +1,16 @@
1
1
  import { LanguageProvider } from '@vyr/locale'
2
2
 
3
3
  interface ZhCNLanguageProvider extends LanguageProvider {
4
-
4
+ 'request.error.general': string
5
+ 'request.error.401': string
5
6
  }
6
7
 
7
8
  const zhCnLanguageProvider: ZhCNLanguageProvider = {
8
9
  id: 'zh_CN',
9
10
  name: '@vyr/service-rpc',
11
+
12
+ 'request.error.general': '服务错误,请稍后重试!',
13
+ 'request.error.401': '无效的会话,或者会话已过期,请重新登录。'
10
14
  }
11
15
 
12
16
  export {
@@ -0,0 +1,50 @@
1
+ import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios'
2
+ import { language } from '../locale';
3
+ import { RpcService } from '../RpcService';
4
+
5
+ const request = axios.create({
6
+ baseURL: '',
7
+ })
8
+
9
+ // 请求拦截器
10
+ request.interceptors.request.use(
11
+ (config: InternalAxiosRequestConfig) => {
12
+ const token = RpcService.getToken()
13
+
14
+ if (token) {
15
+ config.headers['Authorization'] = 'Bearer ' + token;
16
+ }
17
+
18
+ // FormData数据去请求头Content-Type
19
+ if (config.data instanceof FormData) {
20
+ delete config.headers['Content-Type'];
21
+ }
22
+ return config;
23
+ },
24
+ (error: any) => {
25
+ return Promise.reject(error);
26
+ }
27
+ );
28
+
29
+ // 响应拦截器
30
+ request.interceptors.response.use(
31
+ (response: AxiosResponse) => {
32
+ return response
33
+ },
34
+ (error: any) => {
35
+ let message = language.get('request.error.general')
36
+ const { response, status } = error;
37
+
38
+ if (status === 401) {
39
+ message = language.get('request.error.401')
40
+ } else if (response.data !== null && typeof response.data === 'object') {
41
+ if (response.data.message) message = response.data.message
42
+ }
43
+ RpcService.notify(message)
44
+ return Promise.reject(error);
45
+ }
46
+ )
47
+
48
+ export {
49
+ request
50
+ }
@@ -1,7 +1,7 @@
1
1
  import { Generate } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/rpc.confirm'
4
+ const Method = '/vyr/rpc.confirm'
5
5
 
6
6
  interface Confirm {
7
7
  type?: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.connection'
3
+ const Method = '/vyr/rpc.connection'
4
4
 
5
5
  interface NoticeParams {
6
6
  client: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.disconnect'
3
+ const Method = '/vyr/rpc.disconnect'
4
4
 
5
5
  interface NoticeParams {
6
6
  client: string
@@ -2,7 +2,7 @@ import { DeserializationObject } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
  import { UserVO } from '../domain'
4
4
 
5
- const Method = '/cli/rpc.getUser'
5
+ const Method = '/vyr/rpc.getUser'
6
6
 
7
7
  interface RequestParams {
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.login'
3
+ const Method = '/vyr/rpc.login'
4
4
 
5
5
  interface RequestParams {
6
6
  name: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.logout'
3
+ const Method = '/vyr/rpc.logout'
4
4
 
5
5
  interface Params {
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.redo'
3
+ const Method = '/vyr/rpc.redo'
4
4
 
5
5
  interface NoticeParams { }
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/rpc.undo'
3
+ const Method = '/vyr/rpc.undo'
4
4
 
5
5
  interface NoticeParams { }
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { Descriptor, DeserializationObject } from '@vyr/engine'
2
2
  import { IMessage } from '../IMessage'
3
3
 
4
- const Method = '/cli/scene.add'
4
+ const Method = '/vyr/scene.add'
5
5
 
6
6
  interface Params {
7
7
  parent: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/scene.create'
3
+ const Method = '/vyr/scene.create'
4
4
 
5
5
  interface Params {
6
6
  url: string
@@ -1,6 +1,6 @@
1
1
  import { IMessage } from '../IMessage'
2
2
 
3
- const Method = '/cli/scene.delete'
3
+ const Method = '/vyr/scene.delete'
4
4
 
5
5
  interface Params {
6
6
  url: string