@@ -11,23 +11,28 @@ function write(filename, data) {
1111const header = '\n---\n\n## Convenience functions for Node.js servers'
1212let data = read ( '../README.md' ) . replace ( new RegExp ( header + '[^]+' ) , '' ) + header
1313
14- function redoLinks ( data ) {
15- return (
16- data
17- // Remove links that aren't links to source
18- . replace ( / \[ ( [ ^ : ] + ) \] \( .* ?\) / g, '$1' )
19- . replace ( / \b P i p e l i n e P r o f i l e ( [ ^ . ] ) / g, '[PipelineProfile](#PipelineProfile)$1' )
20- . replace ( / \b S t a g e ( [ ^ . ] ) / g, '[Stage](#Stage)$1' )
21- . replace ( / \b R e c o r d C o n f i g ( [ ^ . ] ) / g, '[RecordConfig](#RecordConfig)$1' )
22- )
14+ // Remove links that aren't links to source
15+ function removeLinks ( data ) {
16+ return data . replace ( / \[ ( [ ^ : ] + ) \] \( .* ?\) / g, '$1' )
17+ }
18+
19+ function addLinks ( data ) {
20+ return data
21+ . replace ( / \b P i p e l i n e P r o f i l e ( [ ^ . ] ) / g, '[PipelineProfile](#PipelineProfile)$1' )
22+ . replace ( / \b S t a g e ( [ ^ . ] ) / g, '[Stage](#Stage)$1' )
23+ . replace ( / \b R e c o r d C o n f i g ( [ ^ . ] ) / g, '[RecordConfig](#RecordConfig)$1' )
24+ . replace ( / \b S p o k e s t a c k A S R C o n f i g ( [ ^ . ] ) / g, '[SpokestackASRConfig](#SpokestackASRConfig)$1' )
25+ . replace ( / \b S p o k e s t a c k R e s p o n s e ( [ ^ . ] ) / g, '[SpokestackResponse](#SpokestackResponse)$1' )
26+ . replace ( / \b A S R H y p o t h e s i s ( [ ^ . ] ) / g, '[ASRHypothesis](#ASRHypothesis)$1' )
27+ . replace ( / \b S p e e c h P i p e l i n e C o n f i g ( [ ^ . ] ) / g, '[SpeechPipelineConfig](#SpeechPipelineConfig)$1' )
2328}
2429
2530/**
2631 * @param {string } filename
2732 * @param {Array<string> } functions List of functions to extract from docs
2833 */
2934function getModuleFunctions ( filename , functions ) {
30- const available = redoLinks ( read ( `../docs/modules/${ filename } ` ) )
35+ const available = addLinks ( removeLinks ( read ( `../docs/modules/${ filename } ` ) ) )
3136 // Remove everything up to functions
3237 . replace ( / [ ^ ] + # { 2 } \s * F u n c t i o n s / , '' )
3338 . split ( / _ _ _ / )
@@ -41,8 +46,8 @@ function getModuleFunctions(filename, functions) {
4146}
4247
4348function getInterfaceContent ( filename ) {
44- return (
45- redoLinks ( read ( `../docs/interfaces/${ filename } ` ) )
49+ return removeLinks (
50+ read ( `../docs/interfaces/${ filename } ` )
4651 . replace ( / # I n t e r f a c e : \s * ( .+ ) [ ^ ] + # # \s * P r o p e r t i e s / , '#### $1' )
4752 . replace ( / _ _ _ / g, '' )
4853 . replace ( / \n # # # / g, '\n##### ' )
@@ -53,14 +58,42 @@ function getInterfaceContent(filename) {
5358 )
5459}
5560
61+ function getClassContent ( filename ) {
62+ return removeLinks (
63+ read ( `../docs/classes/${ filename } ` )
64+ . replace ( / # C l a s s : \s * ( .+ ) / , '#### $1' )
65+ . replace ( / \[ .+ \] \( [ \. \/ a - z ] + \) \. .+ / , '' )
66+ . replace ( / \n # # # .+ / g, '' )
67+ . replace ( / # # T a b l e o f c o n t e n t s [ ^ ] + # # C o n s t r u c t o r s / , '' )
68+ . replace ( / _ _ _ / g, '' )
69+ )
70+ }
71+
72+ function getEnumContent ( filename ) {
73+ return removeLinks (
74+ read ( `../docs/enums/${ filename } ` )
75+ . replace ( / # E n u m e r a t i o n : \s * ( .+ ) / , '#### $1' )
76+ . replace ( / \[ .+ \] \( [ \. \/ a - z ] + \) \. .+ / , '' )
77+ . replace ( / \n # # # .+ / g, '' )
78+ . replace ( / # # T a b l e o f c o n t e n t s [ ^ ] + # # E n u m e r a t i o n m e m b e r s / , '' )
79+ . replace ( / _ _ _ / g, '' )
80+ )
81+ }
82+
83+ data += getModuleFunctions ( 'index.md' , [ 'spokestackMiddleware' , 'asrSocketServer' ] )
84+
85+ data += getInterfaceContent ( 'index.spokestackasrconfig.md' )
86+
5687data += getModuleFunctions ( 'index.md' , [
57- 'spokestackMiddleware' ,
58- 'asrSocketServer' ,
5988 'asr' ,
6089 'googleASRSocketServer' ,
6190 'googleASR' ,
62- 'encryptSecret '
91+ 'spokestackASRService '
6392] )
93+ data += getInterfaceContent ( 'index.spokestackresponse.md' )
94+ data += getInterfaceContent ( 'index.asrhypothesis.md' )
95+ data += getEnumContent ( 'index.asrformat.md' )
96+ data += getModuleFunctions ( 'index.md' , [ 'encryptSecret' ] )
6497
6598data += '\n---\n\n## Convenience functions for the client'
6699data += '\n\nThese functions are available exports from `spokestack/client`.'
@@ -71,10 +104,15 @@ data += getModuleFunctions('client.md', [
71104 'startStream' ,
72105 'stopStream' ,
73106 'convertFloat32ToInt16' ,
74- 'startPipeline' ,
75- 'stopPipeline' ,
76- 'countdown'
107+ 'startPipeline'
77108] )
109+ data += getClassContent ( 'client.speechpipeline.md' )
110+ data += getInterfaceContent ( 'client.speechpipelineconfig.md' )
111+
112+ data += getEnumContent ( 'client.pipelineprofile.md' )
113+ data += getEnumContent ( 'client.speecheventtype.md' )
114+ data += getEnumContent ( 'client.stage.md' )
115+ data += getModuleFunctions ( 'client.md' , [ 'stopPipeline' , 'countdown' ] )
78116
79117data += '\n---\n\n## Low-level processor functions'
80118data +=
0 commit comments