MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / setSchema

Method setSchema

src/storage/dgraph/index.ts:83–119  ·  view source on GitHub ↗
(schemas: string[])

Source from the content-addressed store, hash-verified

81 }
82
83 async setSchema(schemas: string[]): Promise<void> {
84 const data = {
85 query: UPDATE_SCHEMA_QUERY,
86 variables: {
87 schema: schemas.join(),
88 },
89 }
90 try {
91 await this.generateAxiosRequest({
92 path: '/admin',
93 data,
94 })
95 .then((res: ExecutionResult) => {
96 const { data: resData, errors } = res
97 processGQLExecutionResult({
98 reqData: data,
99 resData,
100 errors,
101 })
102 })
103 .catch(error => Promise.reject(error))
104 } catch (error: any) {
105 const {
106 response: { data: resData, errors },
107 message,
108 } = error
109 this.logger.error(
110 'There was an issue pushing the schema into the Dgraph db'
111 )
112 this.logger.debug(message)
113 processGQLExecutionResult({
114 reqData: data,
115 resData,
116 errors,
117 })
118 }
119 }
120
121 async getSchema(): Promise<string> {
122 try {

Callers 2

runMethod · 0.80
runMethod · 0.80

Calls 2

generateAxiosRequestMethod · 0.80

Tested by

no test coverage detected