prompt.js 949 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const gql = require('graphql-tag')
  2. // Connectors
  3. const prompts = require('../connectors/prompts')
  4. exports.types = gql`
  5. extend type Mutation {
  6. promptAnswer (input: PromptInput!): [Prompt]
  7. }
  8. type Prompt implements DescribedEntity {
  9. id: ID!
  10. type: PromptType!
  11. visible: Boolean!
  12. enabled: Boolean
  13. name: String
  14. message: String
  15. group: String
  16. description: String
  17. link: String
  18. choices: [PromptChoice]
  19. value: String
  20. valueChanged: Boolean
  21. error: PromptError
  22. tabId: String
  23. }
  24. input PromptInput {
  25. id: ID!
  26. value: String!
  27. }
  28. type PromptChoice {
  29. value: String!
  30. name: String
  31. checked: Boolean
  32. disabled: Boolean
  33. isDefault: Boolean
  34. }
  35. type PromptError {
  36. message: String!
  37. link: String
  38. }
  39. enum PromptType {
  40. input
  41. confirm
  42. list
  43. rawlist
  44. expand
  45. checkbox
  46. password
  47. editor
  48. color
  49. }
  50. `
  51. exports.resolvers = {
  52. Mutation: {
  53. promptAnswer: (root, { input }, context) => prompts.answerPrompt(input, context)
  54. }
  55. }