@@ -3,8 +3,8 @@ import { Logger } from './cli/logger';
3
3
import { PackageJson } from 'type-fest' ;
4
4
5
5
export interface Author {
6
- name ?: string ;
7
6
email ?: string ;
7
+ name ?: string ;
8
8
url ?: string ;
9
9
}
10
10
@@ -21,40 +21,40 @@ interface ComponentHistory {
21
21
}
22
22
23
23
export interface TemplateInfo {
24
- type : string ;
25
- version : string ;
26
24
externals : Array < {
27
25
name : string ;
28
26
global : string | string [ ] ;
29
27
url : string ;
30
28
} > ;
29
+ type : string ;
30
+ version : string ;
31
31
}
32
32
33
33
export interface ComponentsDetails {
34
- lastEdit : number ;
35
34
components : {
36
35
[ componentName : string ] : {
37
36
[ componentVersion : string ] : { publishDate : number } ;
38
37
} ;
39
38
} ;
39
+ lastEdit : number ;
40
40
}
41
41
42
42
export interface ComponentsList {
43
- lastEdit : number ;
44
43
components : Dictionary < string [ ] > ;
44
+ lastEdit : number ;
45
45
}
46
46
47
47
export interface OcParameter {
48
+ default ?: string | boolean | number ;
48
49
description ?: string ;
49
50
example ?: string ;
50
51
mandatory ?: boolean ;
51
52
type : 'string' | 'boolean' | 'number' ;
52
- default ?: string | boolean | number ;
53
53
}
54
54
55
55
interface OcConfiguration {
56
+ container ?: boolean ;
56
57
date : number ;
57
- state ?: 'deprecated' | 'experimental' ;
58
58
files : {
59
59
dataProvider : {
60
60
hashKey : string ;
@@ -71,32 +71,32 @@ interface OcConfiguration {
71
71
} ;
72
72
packaged : boolean ;
73
73
parameters : Record < string , OcParameter > ;
74
- stringifiedDate : string ;
75
- version : string ;
76
74
plugins ?: string [ ] ;
77
- container ?: boolean ;
78
75
renderInfo ?: boolean ;
76
+ state ?: 'deprecated' | 'experimental' ;
77
+ stringifiedDate : string ;
78
+ version : string ;
79
79
}
80
80
81
81
export interface Component extends PackageJson {
82
- name : string ;
83
- version : string ;
84
82
allVersions : string [ ] ;
83
+ name : string ;
85
84
oc : OcConfiguration ;
85
+ version : string ;
86
86
}
87
87
88
88
export interface ParsedComponent extends Omit < Component , 'author' > {
89
89
author : Author ;
90
90
}
91
91
92
92
export interface VM {
93
- availablePlugins : Record < string , ( ...args : unknown [ ] ) => void > ;
94
93
availableDependencies : Array < {
95
94
core : boolean ;
96
95
name : string ;
97
96
version : string ;
98
97
link : string ;
99
98
} > ;
99
+ availablePlugins : Record < string , ( ...args : unknown [ ] ) => void > ;
100
100
components : ParsedComponent [ ] ;
101
101
componentsHistory ?: ComponentHistory [ ] ;
102
102
componentsList : ComponentList [ ] ;
@@ -114,77 +114,77 @@ export interface VM {
114
114
}
115
115
116
116
export interface Config {
117
- beforePublish : ( req : Request , res : Response , next : NextFunction ) => void ;
118
117
baseUrl : string ;
119
- baseUrlFunc : ( opts : { host ?: string ; secure : boolean } ) => string ;
118
+ baseUrlFunc ?: ( opts : { host ?: string ; secure : boolean } ) => string ;
119
+ beforePublish : ( req : Request , res : Response , next : NextFunction ) => void ;
120
+ customHeadersToSkipOnWeakVersion : string [ ] ;
121
+ dependencies : string [ ] ;
120
122
discovery : boolean ;
121
- discoveryFunc : ( opts : { host ?: string ; secure : boolean } ) => boolean ;
122
- plugins : Record < string , ( ...args : unknown [ ] ) => void > ;
123
+ discoveryFunc ?: ( opts : { host ?: string ; secure : boolean } ) => boolean ;
124
+ env : Dictionary < string > ;
125
+ executionTimeout ?: number ;
126
+ fallbackRegistryUrl : string ;
127
+ hotReloading : boolean ;
128
+ keepAliveTimeout ?: number ;
129
+ liveReloadPort : number ;
123
130
local : boolean ;
124
- tempDir : string ;
131
+ path : string ;
132
+ plugins : Record < string , ( ...args : unknown [ ] ) => void > ;
133
+ pollingInterval : number ;
125
134
port : number ;
126
135
postRequestPayloadSize ?: number ;
127
- verbosity : number ;
128
136
prefix : string ;
129
- path : string ;
130
137
publishAuth ?: {
131
138
type : string ;
132
139
username : string ;
133
140
password : string ;
134
141
} ;
135
- dependencies : string [ ] ;
142
+ publishValidation : ( data : unknown ) =>
143
+ | {
144
+ isValid : boolean ;
145
+ error ?: string ;
146
+ }
147
+ | boolean ;
148
+ refreshInterval ?: number ;
136
149
routes ?: Array < {
137
150
route : string ;
138
151
method : string ;
139
152
handler : ( req : Request , res : Response ) => void ;
140
153
} > ;
141
- storage : {
142
- adapter : any ;
143
- options : Dictionary < any > & { componentsDir : string } ;
144
- } ;
145
154
s3 ?: {
146
155
bucket : string ;
147
156
region : string ;
148
157
key ?: string ;
149
158
secret ?: string ;
150
159
componentsDir : string ;
151
160
} ;
152
- customHeadersToSkipOnWeakVersion : string [ ] ;
153
- fallbackRegistryUrl : string ;
154
- pollingInterval : number ;
155
- publishValidation : ( data : unknown ) =>
156
- | {
157
- isValid : boolean ;
158
- error ?: string ;
159
- }
160
- | boolean ;
161
- refreshInterval ?: number ;
162
- keepAliveTimeout ?: number ;
161
+ storage : {
162
+ adapter : any ;
163
+ options : Dictionary < any > & { componentsDir : string } ;
164
+ } ;
165
+ tempDir : string ;
163
166
templates : any [ ] ;
164
- env : Dictionary < string > ;
165
- hotReloading : boolean ;
166
167
timeout : number ;
167
- liveReloadPort : number ;
168
- executionTimeout ?: number ;
168
+ verbosity : number ;
169
169
}
170
170
171
171
export interface Cdn {
172
+ adapterType : string ;
173
+ getFile : ( filePath : string , cb : Callback < string > ) => void ;
172
174
getJson < T > ( filePath : string , force : boolean , cb : Callback < T , string > ) : void ;
173
175
getJson < T > ( filePath : string , cb : Callback < T , string > ) : void ;
174
- getFile : ( filePath : string , cb : Callback < string > ) => void ;
175
- putDir : ( folderPath : string , filePath : string , cb : Callback ) => void ;
176
176
listSubDirectories : (
177
177
dir : string ,
178
178
cb : Callback < string [ ] , Error & { code ?: string } >
179
179
) => void ;
180
+ maxConcurrentRequests : number ;
181
+ putDir : ( folderPath : string , filePath : string , cb : Callback ) => void ;
180
182
putFileContent : (
181
183
data : unknown ,
182
184
path : string ,
183
185
isPrivate : boolean ,
184
186
callback : Callback < unknown , string >
185
187
) => void ;
186
- maxConcurrentRequests : number ;
187
- adapterType : string ;
188
188
}
189
189
190
190
type CompiledTemplate = ( model : unknown ) => string ;
@@ -203,21 +203,24 @@ interface CompilerOptions {
203
203
}
204
204
205
205
export interface Template {
206
- getInfo : ( ) => TemplateInfo ;
206
+ compile ? : ( options : CompilerOptions , cb : Callback ) => void ;
207
207
getCompiledTemplate : (
208
208
templateString : string ,
209
209
key : string ,
210
210
context : Record < string , unknown >
211
211
) => CompiledTemplate ;
212
+ getInfo : ( ) => TemplateInfo ;
212
213
render : (
213
214
options : { model : unknown ; template : CompiledTemplate } ,
214
215
cb : Callback < string >
215
216
) => void ;
216
- compile ?: ( options : CompilerOptions , cb : Callback ) => void ;
217
217
}
218
218
219
219
export interface Plugin {
220
+ callback ?: ( ...args : unknown [ ] ) => void ;
221
+ description ?: string ;
220
222
name : string ;
223
+ options ?: any ;
221
224
register : {
222
225
register : (
223
226
options : unknown ,
@@ -227,9 +230,6 @@ export interface Plugin {
227
230
execute : ( ...args : unknown [ ] ) => unknown ;
228
231
dependencies ?: string [ ] ;
229
232
} ;
230
- description ?: string ;
231
- options ?: any ;
232
- callback ?: ( ...args : unknown [ ] ) => void ;
233
233
}
234
234
235
235
export interface RegistryCli {
@@ -332,15 +332,15 @@ export interface Repository {
332
332
filePath : string ;
333
333
} >
334
334
) : void ;
335
- getStaticClientPath : ( ) => string ;
336
335
getStaticClientMapPath : ( ) => string ;
336
+ getStaticClientPath : ( ) => string ;
337
337
getStaticFilePath : (
338
338
componentName : string ,
339
339
componentVersion : string ,
340
340
filePath : string
341
341
) => string ;
342
- getTemplatesInfo : ( ) => TemplateInfo [ ] ;
343
342
getTemplate : ( type : string ) => Template ;
343
+ getTemplatesInfo : ( ) => TemplateInfo [ ] ;
344
344
init ( callback : Callback < ComponentsList | string > ) : void ;
345
345
publishComponent (
346
346
pkgDetails : any ,
@@ -355,8 +355,8 @@ declare global {
355
355
namespace Express {
356
356
interface Response {
357
357
conf : Config ;
358
- errorDetails ?: string ;
359
358
errorCode ?: string ;
359
+ errorDetails ?: string ;
360
360
}
361
361
}
362
362
}
0 commit comments