@@ -103,40 +103,148 @@ import guideTypography from './guides/typography'
103103import guideUnfound from './guides/unfound'
104104import guideWritecode from './guides/write-code'
105105
106- export default {
106+ type AllDocumentation = {
107+ help : HelpDocs
108+ cypher : CypherDocs
109+ bolt : BoltDocs
110+ play : GuideDocs
111+ }
112+ type GuideDocs = {
113+ title : 'Guides & Examples'
114+ chapters : Record < GuideChapter , DocItem >
115+ }
116+
117+ export type GuideChapter =
118+ | 'concepts'
119+ | 'cypher'
120+ | 'iconography'
121+ | 'intro'
122+ | 'learn'
123+ | 'movieGraph'
124+ | 'movies'
125+ | 'northwind'
126+ | 'northwindGraph'
127+ | 'start'
128+ | 'typography'
129+ | 'unfound'
130+ | 'writeCode'
131+
132+ type DocItem = {
133+ title : string
134+ subtitle ?: string
135+ category ?: string
136+ content ?: JSX . Element | null
137+ footer ?: JSX . Element
138+ slides ?: JSX . Element [ ]
139+ }
140+
141+ type BoltDocs = { title : 'Bolt' ; chapters : Record < BoltChapter , DocItem > }
142+ type BoltChapter = 'boltEncryption' | 'boltRouting'
143+ type CypherDocs = { title : 'Cypher' ; chapters : Record < CypherChapter , DocItem > }
144+ type CypherChapter =
145+ | 'alterUser'
146+ | 'contains'
147+ | 'create'
148+ | 'createConstraintOn'
149+ | 'createDatabase'
150+ | 'createIndexOn'
151+ | 'createRole'
152+ | 'createUser'
153+ | 'delete'
154+ | 'deny'
155+ | 'detachDelete'
156+ | 'dropConstraintOn'
157+ | 'dropDatabase'
158+ | 'dropIndexOn'
159+ | 'dropRole'
160+ | 'dropUser'
161+ | 'endsWith'
162+ | 'explain'
163+ | 'foreach'
164+ | 'grant'
165+ | 'grantRole'
166+ | 'loadCsv'
167+ | 'match'
168+ | 'merge'
169+ | 'param'
170+ | 'params'
171+ | 'profile'
172+ | 'queryPlan'
173+ | 'remove'
174+ | 'rest'
175+ | 'restDelete'
176+ | 'restGet'
177+ | 'restPost'
178+ | 'restPut'
179+ | 'return'
180+ | 'revoke'
181+ | 'revokeRole'
182+ | 'schema'
183+ | 'set'
184+ | 'showDatabases'
185+ | 'showPrivileges'
186+ | 'showRoles'
187+ | 'showUsers'
188+ | 'startsWith'
189+ | 'template'
190+ | 'unwind'
191+ | 'where'
192+ | 'with'
193+
194+ type HelpDocs = { title : 'Commands' ; chapters : Record < HelpChapter , DocItem > }
195+ type HelpChapter =
196+ | 'auto'
197+ | 'bolt'
198+ | 'clear'
199+ | 'commands'
200+ | 'cypher'
201+ | 'guides'
202+ | 'help'
203+ | 'history'
204+ | 'historyClear'
205+ | 'keys'
206+ | 'play'
207+ | 'queries'
208+ | 'server'
209+ | 'serverUser'
210+ | 'style'
211+ | 'unfound'
212+ | 'unknown'
213+
214+ const docs : AllDocumentation = {
107215 help : {
108216 title : 'Commands' ,
109217 chapters : {
110218 auto : helpAuto ,
111- clear : helpClear ,
112- cypher : helpCypher ,
113219 bolt : helpBolt ,
220+ clear : helpClear ,
114221 commands : helpCommands ,
222+ cypher : helpCypher ,
115223 guides : helpPlay ,
116224 help : helpHelp ,
117225 history : helpHistory ,
118226 historyClear : helpHistoryClear ,
119227 keys : helpKeys ,
120228 play : helpPlay ,
229+ queries : helpQueries ,
121230 server : helpServer ,
122231 serverUser : helpServerUser ,
123232 style : helpStyle ,
124233 unfound : helpUnfound ,
125- unknown : helpUnknown ,
126- queries : helpQueries
234+ unknown : helpUnknown
127235 }
128236 } ,
129237 cypher : {
130238 title : 'Cypher' ,
131239 chapters : {
132240 alterUser : helpAlterUser ,
133241 contains : helpContains ,
242+ create : helpCreate ,
134243 createConstraintOn : helpCreateConstraintOn ,
135244 createDatabase : helpCreateDatabase ,
136245 createIndexOn : helpCreateIndexOn ,
137246 createRole : helpCreateRole ,
138247 createUser : helpCreateUser ,
139- create : helpCreate ,
140248 delete : helpDelete ,
141249 deny : helpDeny ,
142250 detachDelete : helpDetachDelete ,
@@ -191,22 +299,24 @@ export default {
191299 chapters : {
192300 concepts : guideConcepts ,
193301 cypher : guideCypher ,
302+ iconography : guideIconography ,
194303 intro : guideIntro ,
195304 learn : guideLearn ,
196305 movieGraph : guideMovieGraph ,
197306 movies : guideMovieGraph ,
198- northwindGraph : guideNorthwindGraph ,
199307 northwind : guideNorthwindGraph ,
200- iconography : guideIconography ,
308+ northwindGraph : guideNorthwindGraph ,
201309 start : guideStart ,
202310 typography : guideTypography ,
203311 unfound : guideUnfound ,
204- writeCode : guideWritecode ,
205- // Commands only
206- 'query-template' : {
207- title : 'Query Templates' ,
208- category : 'guides'
209- }
210- } as any
312+ writeCode : guideWritecode
313+ }
211314 }
212315}
316+
317+ // TypeGuard function to ts to understand that a string is a valid key
318+ export function isGuideChapter ( name : string ) : name is GuideChapter {
319+ return name in docs . play . chapters
320+ }
321+
322+ export default docs
0 commit comments