gql.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. // 注意是否使用 gql
  2. // apollo client 需要使用 gql
  3. // graphql-request 不需要使用 gql
  4. // import gql from "graphql-tag";
  5. const GET_USER = `
  6. query USER($id: ID!) {
  7. user_by_id(id: $id) {
  8. nickname
  9. avatar
  10. }
  11. }
  12. `;
  13. const SEARCH_USER = `
  14. query USER($username: String) {
  15. user_by_props(username: $username) {
  16. username
  17. }
  18. }
  19. `;
  20. const ADD_USER = `
  21. mutation USER($email: String, $updatedAt: String, $password: String, $telephone: String, $nickname: String, $username: String, $createdAt: String, $openid: String, $id: ID!, $avatar: String) {
  22. create_user(
  23. email: $email
  24. updatedAt: $updatedAt
  25. password: $password
  26. telephone: $telephone
  27. nickname: $nickname
  28. username: $username
  29. createdAt: $createdAt
  30. openid: $openid
  31. id: $id
  32. avatar: $avatar
  33. ) {
  34. email
  35. updatedAt
  36. password
  37. telephone
  38. nickname
  39. username
  40. createdAt
  41. openid
  42. id
  43. avatar
  44. }
  45. }
  46. `;
  47. const SHOW_SCHEMA = `
  48. query SCHEMA($user_id: ID) {
  49. schema_by_props(user_id: $user_id) {
  50. schemaData
  51. schemaName
  52. id
  53. reference
  54. }
  55. }
  56. `;
  57. const SHOW_ALL_SCHEMA = `
  58. query SCHEMA($user_id: ID) {
  59. userSchema:schema_by_props(user_id: $user_id) {
  60. schemaData
  61. schemaName
  62. id
  63. reference
  64. }
  65. caseSchema:schema_by_props(user_id: "ioobot") {
  66. schemaData
  67. schemaName
  68. id
  69. reference
  70. }
  71. }
  72. `;
  73. const SEARCH_SCHEMA = `
  74. query SCHEMA($id: ID!) {
  75. schema_by_id(id: $id) {
  76. schemaName
  77. schemaData
  78. id
  79. reference
  80. }
  81. }
  82. `;
  83. const ADD_SCHEMA = `
  84. mutation SCHEMA($id: ID!, $user_id: ID!, $schemaName: String!, $schemaData: String!, $createdAt: String, $updatedAt: String, $schemaState: String, $reference: String) {
  85. create_schema(
  86. id: $id,
  87. user_id: $user_id,
  88. schemaName: $schemaName,
  89. createdAt: $createdAt,
  90. updatedAt: $updatedAt,
  91. schemaData: $schemaData,
  92. schemaState: $schemaState
  93. reference: $reference
  94. ) {
  95. schemaName,
  96. schemaData
  97. id
  98. reference
  99. }
  100. }
  101. `;
  102. const DELETE_SCHEMA = `
  103. mutation SCHEMA($schemaName: String, $user_id: ID) {
  104. delete_schema(schemaName: $schemaName, user_id: $user_id)
  105. }
  106. `;
  107. const UPDATE_SCHEMA = `
  108. mutation SCHEMA($id: ID!, $schemaData: String!, $updatedAt: String, $schemaState: String) {
  109. update_schema(
  110. id: $id,
  111. updatedAt: $updatedAt,
  112. schemaData: $schemaData,
  113. schemaState: $schemaState
  114. ) {
  115. schemaName,
  116. schemaData
  117. id
  118. }
  119. }
  120. `;
  121. const UPDATE_SCHEMA_NAME = `
  122. mutation SCHEMA($id: ID!, $schemaName: String, $updatedAt: String) {
  123. update_schema(
  124. id: $id,
  125. updatedAt: $updatedAt,
  126. schemaName: $schemaName,
  127. ) {
  128. schemaName,
  129. id
  130. }
  131. }
  132. `;
  133. const SHOW_TABLE = `
  134. query TABLE($schema_id: ID!) {
  135. schema_by_id(id: $schema_id) {
  136. schemaData
  137. schemaName
  138. }
  139. }
  140. `;
  141. const ADD_CLOUD = `
  142. mutation CLOUD($id: ID!, $user_id: ID, $cloudName: String, $secretId: String, $secretKey: String, $updatedAt: String, $createdAt: String, $appId: String) {
  143. create_cloud(
  144. id: $id
  145. user_id: $user_id
  146. cloudName: $cloudName
  147. secretId: $secretId
  148. secretKey: $secretKey
  149. createdAt: $createdAt
  150. updatedAt: $updatedAt
  151. appId: $appId
  152. ) {
  153. id
  154. }
  155. }
  156. `;
  157. const SHOW_CLOUD = `
  158. query CLOUD($user_id: ID!) {
  159. cloud_by_props(user_id: $user_id) {
  160. id
  161. cloudName
  162. secretId
  163. secretKey
  164. }
  165. }
  166. `;
  167. const UPDATE_CLOUD = `
  168. mutation updatecloud($id: ID, $secretId: String, $secretKey: String $updatedAt: String) {
  169. update_cloud(
  170. id: $id
  171. secretId: $secretId
  172. secretKey: $secretKey
  173. updatedAt: $updatedAt
  174. ) {
  175. id
  176. }
  177. }
  178. `;
  179. const SHOW_DEPLOY = `
  180. query DEPLOY($cloud_id: ID!) {
  181. deploy_by_props(cloud_id: $cloud_id) {
  182. id
  183. functionName
  184. region
  185. description
  186. cosBucketName
  187. cosObjectName
  188. cosBucketRegion
  189. handler
  190. memorySize
  191. timeout
  192. vpcId
  193. subnetId
  194. }
  195. }
  196. `;
  197. const ADD_DEPLOY = `
  198. mutation DEPLOY($serviceName:String, $description: String, $updatedAt: String, $cosBucketName: String, $memorySize: Int, $fc_id: ID, $createdAt: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $id: ID!, $cloud_id: ID, $user_id: ID, $timeout: Int, $handler: String, $functionName: String) {
  199. create_deploy(
  200. id: $id
  201. description: $description
  202. cosBucketName: $cosBucketName
  203. memorySize: $memorySize
  204. fc_id: $fc_id
  205. subnetId: $subnetId
  206. cosObjectName: $cosObjectName
  207. region: $region
  208. vpcId: $vpcId
  209. cosBucketRegion: $cosBucketRegion
  210. cloud_id: $cloud_id
  211. user_id: $user_id
  212. timeout: $timeout
  213. handler: $handler
  214. functionName: $functionName
  215. serviceName: $serviceName
  216. createdAt: $createdAt
  217. updatedAt: $updatedAt
  218. ) {
  219. id
  220. }
  221. }
  222. `;
  223. const UPDATE_DEPLOY = `
  224. mutation DEPLOY($id: ID!, $description: String, $updatedAt: String, $cosBucketName: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $functionName: String) {
  225. update_deploy(
  226. id: $id
  227. description: $description
  228. cosBucketName: $cosBucketName
  229. subnetId: $subnetId
  230. cosObjectName: $cosObjectName
  231. region: $region
  232. vpcId: $vpcId
  233. cosBucketRegion: $cosBucketRegion
  234. functionName: $functionName
  235. updatedAt: $updatedAt
  236. ) {
  237. id
  238. }
  239. }
  240. `;
  241. const SHOW_APIGWGROUP = `
  242. query GROUP($cloud_id: ID!) {
  243. apiGWGroup_by_props(cloud_id: $cloud_id) {
  244. id
  245. groupName
  246. region
  247. frontType
  248. defaultDomain
  249. userStatus
  250. userDomain
  251. }
  252. }
  253. `;
  254. const ADD_APIGROUP = `
  255. mutation GROUP($serviceId: String, $environmentName: String, $userStatus: String, $defaultDomain: String, $updatedAt: String, $userDomain: String, $groupName: String, $createdAt: String, $frontType: String, $region: String, $status: String, $id: ID!, $cloud_id: ID, $user_id: ID) {
  256. create_apiGWGroup(
  257. id: $id
  258. userStatus: $userStatus
  259. defaultDomain: $defaultDomain
  260. updatedAt: $updatedAt
  261. userDomain: $userDomain
  262. groupName: $groupName
  263. createdAt: $createdAt
  264. frontType: $frontType
  265. region: $region
  266. status: $status
  267. cloud_id: $cloud_id
  268. user_id: $user_id
  269. environmentName: $environmentName
  270. serviceId: $serviceId
  271. ) {
  272. id
  273. }
  274. }
  275. `;
  276. const UPDATE_APIGROUP = `
  277. mutation GROUP($id:ID!, $environmentName: String, $userStatus: String, $updatedAt: String, $userDomain: String, $groupName: String, $frontType: String, $region: String) {
  278. update_apiGWGroup(
  279. id: $id
  280. userStatus: $userStatus
  281. userDomain: $userDomain
  282. groupName: $groupName
  283. frontType: $frontType
  284. region: $region
  285. environmentName: $environmentName
  286. updatedAt: $updatedAt
  287. ) {
  288. id
  289. }
  290. }
  291. `;
  292. const SHOW_APIGWPATH = `
  293. query PATH($apiGWGroup_id: ID!) {
  294. apiGWPath_by_props(apiGWGroup_id: $apiGWGroup_id) {
  295. id
  296. apiGWName
  297. apiGWDesc
  298. requestMethod
  299. }
  300. }
  301. `;
  302. const ADD_APIGWPATH = `
  303. mutation PATH($apiId: String, $apiGWName: String, $updatedAt: String, $apiGWGroup_id: ID, $createdAt: String, $deploy_id: ID, $serviceType: String, $id: ID!, $apiGWPath: String, $user_id: ID, $timeout: Int, $apiGWDesc: String, $requestMethod: String) {
  304. create_apiGWPath(
  305. apiGWName: $apiGWName
  306. updatedAt: $updatedAt
  307. apiGWGroup_id: $apiGWGroup_id
  308. createdAt: $createdAt
  309. deploy_id: $deploy_id
  310. serviceType: $serviceType
  311. id: $id
  312. apiGWPath: $apiGWPath
  313. user_id: $user_id
  314. timeout: $timeout
  315. apiGWDesc: $apiGWDesc
  316. requestMethod: $requestMethod
  317. apiId: $apiId
  318. ) {
  319. id
  320. }
  321. }
  322. `;
  323. const UPDATE_APIGWPATH = `
  324. mutation PATH($apiGWName: String, $updatedAt: String, $apiGWDesc: String, $requestMethod: String) {
  325. update_apiGWPath(
  326. apiGWName: $apiGWName
  327. apiGWDesc: $apiGWDesc
  328. requestMethod: $requestMethod
  329. updatedAt: $updatedAt
  330. ) {
  331. id
  332. }
  333. }
  334. `;
  335. const SHOW_FC = `
  336. query FC($schema_id: ID!) {
  337. fc_by_props(schema_id: $schema_id) {
  338. cloud_id {
  339. id
  340. cloudName
  341. }
  342. }
  343. }
  344. `;
  345. export {
  346. ADD_USER,
  347. GET_USER,
  348. SEARCH_USER,
  349. SEARCH_SCHEMA,
  350. ADD_SCHEMA,
  351. SHOW_ALL_SCHEMA,
  352. SHOW_SCHEMA,
  353. UPDATE_SCHEMA,
  354. UPDATE_SCHEMA_NAME,
  355. DELETE_SCHEMA,
  356. SHOW_TABLE,
  357. ADD_CLOUD,
  358. SHOW_CLOUD,
  359. UPDATE_CLOUD,
  360. SHOW_DEPLOY,
  361. ADD_DEPLOY,
  362. UPDATE_DEPLOY,
  363. SHOW_APIGWGROUP,
  364. ADD_APIGROUP,
  365. UPDATE_APIGROUP,
  366. SHOW_APIGWPATH,
  367. ADD_APIGWPATH,
  368. UPDATE_APIGWPATH,
  369. SHOW_FC
  370. }