UNPKG

10.3 kBTypeScriptView Raw
1import * as reflect from 'jsii-reflect';
2export declare const CURRENT_SCHEMA_VERSION = "0.1";
3/**
4 * Describes any kind of type. This could be a primitive, a user-defined type
5 * (like `Bucket`), or a composition of types (like `Map<string, Bucket>[]`).
6 */
7export interface TypeSchema {
8 /**
9 * The language-specific name of the type. May contain "%" placeholder
10 * values to indicate references to types defined in the "types" field.
11 *
12 * @example "string"
13 * @example "%"
14 * @example "typing.List[%]"
15 * @example "Map<%, %>"
16 */
17 readonly formattingPattern: string;
18 /**
19 * Types referenced within the "name" field. The order of these corresponds
20 * to the order of the %'s in `formattingPattern`.
21 */
22 readonly types?: (TypeSchema | JsiiEntity)[];
23}
24/**
25 * Describes a single "entity" in the jsii type system. This may be a type,
26 * but it could also be a property, method, parameter, enum member, etc.
27 */
28export interface JsiiEntity extends AssemblyMetadataSchema {
29 /**
30 * An id that uniquely identifies this type among all entities in the
31 * document and is same across languages.
32 */
33 readonly id: string;
34 /**
35 * The friendly language-specific name for the entity.
36 */
37 readonly displayName: string;
38 /**
39 * The language-specific type FQN.
40 */
41 readonly fqn: string;
42}
43/**
44 * Describes a property.
45 */
46export interface PropertySchema extends Usage, Optional, Documentable {
47 /**
48 * An id that uniquely identifies this property among all entities in
49 * the document and is same across languages.
50 */
51 readonly id: string;
52 /**
53 * The friendly language-specific name for the property.
54 */
55 readonly displayName: string;
56 /**
57 * The language-specific fqn.
58 */
59 readonly fqn: string;
60 /**
61 * The type of the property.
62 */
63 readonly type: TypeSchema;
64 /**
65 * Whether the property is a constant.
66 * @default false
67 */
68 readonly const?: boolean;
69}
70/**
71 * Describes a parameter.
72 */
73export interface ParameterSchema extends Optional, Documentable {
74 /**
75 * An id that uniquely identifies this parameter among all entities in
76 * the document and is same across languages.
77 */
78 readonly id: string;
79 /**
80 * The friendly language-specific name for the parameter.
81 */
82 readonly displayName: string;
83 /**
84 * The language-specific fqn.
85 */
86 readonly fqn: string;
87 /**
88 * The type of the parameter.
89 */
90 readonly type: TypeSchema;
91 /**
92 * Whether the parameter is variadic.
93 */
94 readonly variadic: boolean;
95}
96/**
97 * Common properties of a callable.
98 */
99export interface CallableSchema extends Usage {
100 /**
101 * An id that uniquely identifies this callable among all entities in
102 * the document and is same across languages.
103 */
104 readonly id: string;
105 /**
106 * The friendly language-specific name for the callable.
107 */
108 readonly displayName: string;
109 /**
110 * The language-specific fqn.
111 */
112 readonly fqn: string;
113 /**
114 * Parameters of the callable.
115 */
116 readonly parameters: ParameterSchema[];
117}
118/**
119 * Describes a constructor.
120 */
121export interface InitializerSchema extends CallableSchema {
122}
123/**
124 * Describes a method.
125 */
126export interface MethodSchema extends CallableSchema, Documentable {
127}
128/**
129 * Describes a class.
130 */
131export interface ClassSchema extends Documentable {
132 /**
133 * An id that uniquely identifies this class among all entities in
134 * the document and is same across languages.
135 */
136 readonly id: string;
137 /**
138 * The friendly language-specific name for the class.
139 */
140 readonly displayName: string;
141 /**
142 * The language-specific fqn.
143 */
144 readonly fqn: string;
145 /**
146 * Interfaces this class implements.
147 */
148 readonly interfaces: JsiiEntity[];
149 /**
150 * Class initializer.
151 */
152 readonly initializer?: InitializerSchema;
153 /**
154 * Instance methods.
155 */
156 readonly instanceMethods: MethodSchema[];
157 /**
158 * Static methods.
159 */
160 readonly staticMethods: MethodSchema[];
161 /**
162 * Properties.
163 */
164 readonly properties: PropertySchema[];
165 /**
166 * Constants.
167 */
168 readonly constants: PropertySchema[];
169}
170/**
171 * Describes a construct.
172 */
173export interface ConstructSchema extends ClassSchema {
174}
175/**
176 * Describes a struct.
177 */
178export interface StructSchema extends Usage, Documentable {
179 /**
180 * An id that uniquely identifies this struct among all entities in
181 * the document and is same across languages.
182 */
183 readonly id: string;
184 /**
185 * The friendly language-specific name for the struct.
186 */
187 readonly displayName: string;
188 /**
189 * The language-specific fqn.
190 */
191 readonly fqn: string;
192 /**
193 * Properties.
194 */
195 readonly properties: PropertySchema[];
196}
197/**
198 * Describes a behavioral interface, also sometimes known as a protocol.
199 */
200export interface InterfaceSchema extends Documentable {
201 /**
202 * An id that uniquely identifies this interface among all entities in
203 * the document and is same across languages.
204 */
205 readonly id: string;
206 /**
207 * The friendly language-specific name for the interface.
208 */
209 readonly displayName: string;
210 /**
211 * The language-specific fqn.
212 */
213 readonly fqn: string;
214 /**
215 * Interfaces that this interface extends.
216 */
217 readonly interfaces: JsiiEntity[];
218 /**
219 * Types implementing this interface.
220 */
221 readonly implementations: JsiiEntity[];
222 /**
223 * Methods.
224 */
225 readonly instanceMethods: MethodSchema[];
226 /**
227 * Properties.
228 */
229 readonly properties: PropertySchema[];
230}
231/**
232 * Describes an enum member.
233 */
234export interface EnumMemberSchema extends Documentable {
235 /**
236 * An id that uniquely identifies this enum member among all entities in
237 * the document and is same across languages.
238 */
239 readonly id: string;
240 /**
241 * The friendly language-specific name for the enum member.
242 */
243 readonly displayName: string;
244 /**
245 * The language-specific fqn.
246 */
247 readonly fqn: string;
248}
249/**
250 * Describes an enum.
251 */
252export interface EnumSchema extends Documentable {
253 /**
254 * An id that uniquely identifies this enum among all entities in
255 * the document and is same across languages.
256 */
257 readonly id: string;
258 /**
259 * The friendly language-specific name for the enum.
260 */
261 readonly displayName: string;
262 /**
263 * The language-specific fqn.
264 */
265 readonly fqn: string;
266 /**
267 * Enum members.
268 */
269 readonly members: EnumMemberSchema[];
270}
271/**
272 * Describes the API Reference.
273 */
274export interface ApiReferenceSchema {
275 /**
276 * Constructs.
277 */
278 readonly constructs: ConstructSchema[];
279 /**
280 * Classes.
281 */
282 readonly classes: ClassSchema[];
283 /**
284 * Structs.
285 */
286 readonly structs: StructSchema[];
287 /**
288 * Interfaces.
289 */
290 readonly interfaces: InterfaceSchema[];
291 /**
292 * Enums.
293 */
294 readonly enums: EnumSchema[];
295}
296/**
297 * Metadata about a particular jsii assembly.
298 */
299export interface AssemblyMetadataSchema {
300 /**
301 * Name of the jsii assembly/package.
302 */
303 readonly packageName: string;
304 /**
305 * Version of the jsii assembly/package.
306 */
307 readonly packageVersion: string;
308 /**
309 * Language-independent name of the jsii submodule.
310 * if undefined, it is implicitly the root module.
311 *
312 * @example `aws_sqs`
313 */
314 readonly submodule?: string;
315}
316/**
317 * Describes the top-level schema.
318 */
319export interface Schema {
320 /**
321 * Schema version number.
322 */
323 readonly version: string;
324 /**
325 * Language that the documentation has been transliterated to.
326 */
327 readonly language: string;
328 /**
329 * Whether this document represents documentation for all submodules
330 * (including the root).
331 *
332 * @default false
333 */
334 readonly allSubmodules?: boolean;
335 /**
336 * Assembly metadata.
337 */
338 readonly metadata: AssemblyMetadataSchema;
339 /**
340 * Readme.
341 */
342 readonly readme?: string;
343 /**
344 * API Reference.
345 */
346 readonly apiReference?: ApiReferenceSchema;
347}
348/**
349 * An entity that can have a doc string.
350 */
351export interface Documentable {
352 /**
353 * Doc string.
354 */
355 readonly docs: DocsSchema;
356}
357/**
358 * Docstring information.
359 *
360 * @see jsii.Docs
361 */
362export interface DocsSchema {
363 /**
364 * Summary documentation for an API item.
365 *
366 * The first part of the documentation before hitting a `@remarks` tags, or
367 * the first line of the doc comment block if there is no `@remarks` tag.
368 */
369 readonly summary?: string;
370 /**
371 * Detailed information about an API item.
372 *
373 * Either the explicitly tagged `@remarks` section, otherwise everything
374 * past the first paragraph if there is no `@remarks` tag.
375 */
376 readonly remarks?: string;
377 /**
378 * `@see` and `@link` links with more information.
379 */
380 readonly links?: string[];
381 /**
382 * Code snippet showing example usage of an API item, that has been provided
383 * by the construct library authors.
384 */
385 readonly example?: string;
386 /**
387 * Whether or not it is deprecated.
388 */
389 readonly deprecated?: boolean;
390 /**
391 * Deprecation reason (if applicable).
392 */
393 readonly deprecationReason?: string;
394}
395/**
396 * An entity that may include a code snippet showing how to use it.
397 */
398export interface Usage {
399 /**
400 * Code snippet.
401 * @default - none
402 */
403 readonly usage?: string;
404}
405/**
406 * An entity that may be optional.
407 */
408export interface Optional {
409 /**
410 * Whether or not it is optional.
411 * @default false
412 */
413 readonly optional?: boolean;
414 /**
415 * The default value, if applicable.
416 * @default - none
417 */
418 readonly default?: string;
419}
420export declare function extractDocs(docs: reflect.Docs): DocsSchema;
421/**
422 * Generates the name of the submodule.
423 */
424export declare function submodulePath(module?: reflect.Submodule): string | undefined;
425export declare function filterUndefined<T extends object>(obj: T): T;