@sdk-it/spec 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2629 -2
- package/dist/index.js.map +4 -4
- package/dist/lib/find-polymorphic-varients.d.ts +15 -0
- package/dist/lib/find-polymorphic-varients.d.ts.map +1 -0
- package/dist/lib/find-polymorphic-varients.test.d.ts +2 -0
- package/dist/lib/find-polymorphic-varients.test.d.ts.map +1 -0
- package/dist/lib/find-unique-schema-name.d.ts +3 -0
- package/dist/lib/find-unique-schema-name.d.ts.map +1 -0
- package/dist/lib/format-name.d.ts +2 -0
- package/dist/lib/format-name.d.ts.map +1 -0
- package/dist/lib/get-ref-usage.d.ts +3 -0
- package/dist/lib/get-ref-usage.d.ts.map +1 -0
- package/dist/lib/is-primitive-schema.d.ts +3 -0
- package/dist/lib/is-primitive-schema.d.ts.map +1 -0
- package/dist/lib/loaders/postman/postman-converter.d.ts.map +1 -1
- package/dist/lib/loaders/remote-loader.d.ts.map +1 -1
- package/dist/lib/metadata.d.ts +22 -0
- package/dist/lib/metadata.d.ts.map +1 -0
- package/dist/lib/operation.d.ts +66 -4
- package/dist/lib/operation.d.ts.map +1 -1
- package/dist/lib/pagination/pagination-result.d.ts +20 -0
- package/dist/lib/pagination/pagination-result.d.ts.map +1 -0
- package/dist/lib/pagination/pagination-result.test.d.ts +2 -0
- package/dist/lib/pagination/pagination-result.test.d.ts.map +1 -0
- package/dist/lib/pagination/pagination.d.ts +50 -0
- package/dist/lib/pagination/pagination.d.ts.map +1 -0
- package/dist/lib/pagination/pagination.test.d.ts +2 -0
- package/dist/lib/pagination/pagination.test.d.ts.map +1 -0
- package/dist/lib/security.d.ts +10 -0
- package/dist/lib/security.d.ts.map +1 -0
- package/dist/lib/sidebar.d.ts +4 -7
- package/dist/lib/sidebar.d.ts.map +1 -1
- package/dist/lib/tune.d.ts +11 -0
- package/dist/lib/tune.d.ts.map +1 -0
- package/dist/lib/tune.test.d.ts +2 -0
- package/dist/lib/tune.test.d.ts.map +1 -0
- package/package.json +8 -3
- package/dist/lib/loaders/load-spec.js +0 -25
- package/dist/lib/loaders/load-spec.js.map +0 -7
- package/dist/lib/loaders/local-loader.js +0 -20
- package/dist/lib/loaders/local-loader.js.map +0 -7
- package/dist/lib/loaders/postman/postman-converter.js +0 -486
- package/dist/lib/loaders/postman/postman-converter.js.map +0 -7
- package/dist/lib/loaders/postman/spec-types.js +0 -1
- package/dist/lib/loaders/postman/spec-types.js.map +0 -7
- package/dist/lib/loaders/remote-loader.js +0 -26
- package/dist/lib/loaders/remote-loader.js.map +0 -7
- package/dist/lib/operation.js +0 -286
- package/dist/lib/operation.js.map +0 -7
- package/dist/lib/operation.test.js +0 -261
- package/dist/lib/operation.test.js.map +0 -7
- package/dist/lib/sidebar.js +0 -33
- package/dist/lib/sidebar.js.map +0 -7
package/dist/lib/operation.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type { OpenAPIObject, OperationObject, ParameterObject, ReferenceObject, ResponseObject } from 'openapi3-ts/oas31';
|
|
1
|
+
import type { ComponentsObject, MediaTypeObject, OpenAPIObject, OperationObject, ParameterObject, PathsObject, ReferenceObject, RequestBodyObject, ResponseObject, SchemaObject, SecurityRequirementObject, SecuritySchemeObject } from 'openapi3-ts/oas31';
|
|
2
|
+
import { type PaginationGuess } from './pagination/pagination.ts';
|
|
3
|
+
export declare function augmentSpec(config: GenerateSdkConfig, verbose?: boolean): OurOpenAPIObject;
|
|
4
|
+
export type OperationPagination = PaginationGuess & {
|
|
5
|
+
items: string;
|
|
6
|
+
};
|
|
2
7
|
export declare const defaults: Partial<GenerateSdkConfig> & Required<Pick<GenerateSdkConfig, 'operationId' | 'tag'>>;
|
|
3
|
-
export type TunedOperationObject = Omit<OperationObject, 'operationId' | 'parameters' | 'responses'> & {
|
|
8
|
+
export type TunedOperationObject = Omit<OperationObject, 'operationId' | 'tags' | 'parameters' | 'responses' | 'requestBody'> & {
|
|
9
|
+
tags: string[];
|
|
4
10
|
operationId: string;
|
|
5
|
-
parameters:
|
|
11
|
+
parameters: ParameterObject[];
|
|
6
12
|
responses: Record<string, ResponseObject>;
|
|
13
|
+
requestBody: OurRequestBodyObject;
|
|
7
14
|
};
|
|
8
15
|
export interface OperationEntry {
|
|
9
16
|
name?: string;
|
|
@@ -16,12 +23,25 @@ export type Operation = {
|
|
|
16
23
|
entry: OperationEntry;
|
|
17
24
|
operation: TunedOperationObject;
|
|
18
25
|
};
|
|
19
|
-
export declare function forEachOperation<T>(
|
|
26
|
+
export declare function forEachOperation<T>(spec: OurOpenAPIObject, callback: (entry: OperationEntry, operation: TunedOperationObject) => T): T[];
|
|
27
|
+
interface ResponsesConfig {
|
|
28
|
+
flattenErrorResponses?: boolean;
|
|
29
|
+
}
|
|
20
30
|
export interface GenerateSdkConfig {
|
|
21
31
|
spec: OpenAPIObject;
|
|
32
|
+
responses?: ResponsesConfig;
|
|
22
33
|
operationId?: (operation: OperationObject, path: string, method: string) => string;
|
|
23
34
|
tag?: (operation: OperationObject, path: string) => string;
|
|
24
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Sanitizes a potential tag name (assumed to be already camelCased)
|
|
38
|
+
* to avoid conflicts with reserved keywords or invalid starting characters (numbers).
|
|
39
|
+
* Appends an underscore if the tag matches a reserved keyword.
|
|
40
|
+
* Prepends an underscore if the tag starts with a number.
|
|
41
|
+
* @param tag The potential tag name, already camelCased.
|
|
42
|
+
* @returns The sanitized tag name.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sanitizeTag(tag: string): string;
|
|
25
45
|
/**
|
|
26
46
|
* Attempts to determine a generic tag for an OpenAPI operation based on path and operationId.
|
|
27
47
|
* Rules and fallbacks are documented within the code.
|
|
@@ -31,6 +51,7 @@ export interface GenerateSdkConfig {
|
|
|
31
51
|
*/
|
|
32
52
|
export declare function determineGenericTag(pathString: string, operation: OperationObject): string;
|
|
33
53
|
export declare function parseJsonContentType(contentType: string | null | undefined): string | null;
|
|
54
|
+
export declare function isTextContentType(contentType: string | null | undefined): boolean;
|
|
34
55
|
/**
|
|
35
56
|
* Checks if a given content type string represents Server-Sent Events (SSE).
|
|
36
57
|
* Handles case-insensitivity, parameters (like charset), and leading/trailing whitespace.
|
|
@@ -41,4 +62,45 @@ export declare function parseJsonContentType(contentType: string | null | undefi
|
|
|
41
62
|
export declare function isSseContentType(contentType: string | null | undefined): boolean;
|
|
42
63
|
export declare function isStreamingContentType(contentType: string | null | undefined): boolean;
|
|
43
64
|
export declare function isSuccessStatusCode(statusCode: number | string): boolean;
|
|
65
|
+
export declare function isErrorStatusCode(statusCode: number | string): boolean;
|
|
66
|
+
export declare function patchParameters(spec: OurOpenAPIObject, schema: SchemaObject, parameters: ParameterObject[], security: SecurityRequirementObject[]): void;
|
|
67
|
+
export declare function createOperation(options: {
|
|
68
|
+
name: string;
|
|
69
|
+
group: string;
|
|
70
|
+
security?: string[];
|
|
71
|
+
parameters?: {
|
|
72
|
+
query?: Record<string, {
|
|
73
|
+
schema: SchemaObject;
|
|
74
|
+
required?: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
path?: Record<string, {
|
|
77
|
+
schema: SchemaObject;
|
|
78
|
+
required?: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
header?: Record<string, {
|
|
81
|
+
schema: SchemaObject;
|
|
82
|
+
required?: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
cookie?: Record<string, {
|
|
85
|
+
schema: SchemaObject;
|
|
86
|
+
required?: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
};
|
|
89
|
+
response: Record<string, SchemaObject | Record<string, SchemaObject>>;
|
|
90
|
+
request?: Record<string, ReferenceObject>;
|
|
91
|
+
}): TunedOperationObject;
|
|
92
|
+
export interface OurOpenAPIObject extends OpenAPIObject {
|
|
93
|
+
'x-sdk-augmented'?: boolean;
|
|
94
|
+
components: Omit<ComponentsObject, 'schemas'> & {
|
|
95
|
+
schemas: Record<string, SchemaObject | ReferenceObject>;
|
|
96
|
+
securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>;
|
|
97
|
+
};
|
|
98
|
+
paths: PathsObject;
|
|
99
|
+
}
|
|
100
|
+
export interface OurRequestBodyObject extends RequestBodyObject {
|
|
101
|
+
content: Record<string, Omit<MediaTypeObject, 'schema'> & {
|
|
102
|
+
schema: ReferenceObject;
|
|
103
|
+
}>;
|
|
104
|
+
}
|
|
105
|
+
export {};
|
|
44
106
|
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/lib/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/lib/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,eAAe,EACf,eAAe,EACf,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,cAAc,EAEd,YAAY,EACZ,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,4BAA4B,CAAC;AAkCpC,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,OAAO,UAAQ,GACd,gBAAgB,CA8FlB;AAED,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG;IAClD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwEF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAC/C,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,KAAK,CAAC,CA0BxD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,eAAe,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OAAO,CAAA;SAAE,CAAC,CAAC;QACtE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,YAAY,CAAC;YAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;KACvE,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC3C,GAAG,oBAAoB,CA4DvB;AAyED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;QAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,CAAC;QACxD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAAC,CAAC;KACzE,CAAC;IACF,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,OAAO,EAAE,MAAM,CACb,MAAM,EACN,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GAAG;QAAE,MAAM,EAAE,eAAe,CAAA;KAAE,CAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SchemaObject, SchemasObject } from 'openapi3-ts/oas31';
|
|
2
|
+
/**
|
|
3
|
+
* Tries to guess the name of the property that holds the main list of items
|
|
4
|
+
* within an object schema using a series of heuristics.
|
|
5
|
+
*
|
|
6
|
+
* @param schema The OpenAPI SchemaObject, expected to be of type 'object'.
|
|
7
|
+
* @returns The name of the most likely property containing the items array,
|
|
8
|
+
* or null if no array properties are found in the schema.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getItemsName(properties: Record<string, SchemaObject>): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Tries to guess the name of a boolean property that indicates if there are more items
|
|
13
|
+
* to fetch (e.g., for pagination).
|
|
14
|
+
*
|
|
15
|
+
* @param schema The OpenAPI SchemaObject, expected to be of type 'object'.
|
|
16
|
+
* @returns The name of the most likely boolean property indicating "has more",
|
|
17
|
+
* or null if no suitable boolean property is found.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getHasMoreName(properties: SchemasObject): string | null;
|
|
20
|
+
//# sourceMappingURL=pagination-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-result.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAoHrE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GACvC,MAAM,GAAG,IAAI,CAmFf;AAmFD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAevE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-result.test.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination-result.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
+
import type { TunedOperationObject } from '../operation.ts';
|
|
3
|
+
interface PaginationResultBase {
|
|
4
|
+
type: 'offset' | 'page' | 'cursor' | 'none';
|
|
5
|
+
}
|
|
6
|
+
export interface OffsetPaginationResult extends PaginationResultBase {
|
|
7
|
+
type: 'offset';
|
|
8
|
+
offsetParamName: string;
|
|
9
|
+
offsetKeyword: string;
|
|
10
|
+
limitParamName: string;
|
|
11
|
+
limitKeyword: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PagePaginationResult extends PaginationResultBase {
|
|
14
|
+
type: 'page';
|
|
15
|
+
pageNumberParamName: string;
|
|
16
|
+
pageNumberKeyword: string;
|
|
17
|
+
pageSizeParamName: string;
|
|
18
|
+
pageSizeKeyword: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CursorPaginationResult extends PaginationResultBase {
|
|
21
|
+
type: 'cursor';
|
|
22
|
+
cursorParamName: string;
|
|
23
|
+
cursorKeyword: string;
|
|
24
|
+
limitParamName: string;
|
|
25
|
+
limitKeyword: string;
|
|
26
|
+
}
|
|
27
|
+
export interface NoPaginationResult extends PaginationResultBase {
|
|
28
|
+
type: 'none';
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
export type PaginationGuess = ((OffsetPaginationResult | PagePaginationResult | CursorPaginationResult) & {
|
|
32
|
+
items: string;
|
|
33
|
+
hasMore: string;
|
|
34
|
+
}) | NoPaginationResult;
|
|
35
|
+
export declare const OFFSET_PARAM_REGEXES: RegExp[];
|
|
36
|
+
export declare const GENERIC_LIMIT_PARAM_REGEXES: RegExp[];
|
|
37
|
+
export declare const PAGE_NUMBER_REGEXES: RegExp[];
|
|
38
|
+
export declare const PAGE_SIZE_REGEXES: RegExp[];
|
|
39
|
+
export declare const CURSOR_REGEXES: RegExp[];
|
|
40
|
+
export declare const CURSOR_LIMIT_REGEXES: RegExp[];
|
|
41
|
+
/**
|
|
42
|
+
* Guesses the pagination strategy of an OpenAPI operation based on its query parameters.
|
|
43
|
+
* It checks for offset, page-based, and cursor-based pagination in that order.
|
|
44
|
+
*
|
|
45
|
+
* @param operation The OpenAPI operation object.
|
|
46
|
+
* @returns A PaginationGuess object indicating the detected type and relevant parameters.
|
|
47
|
+
*/
|
|
48
|
+
export declare function guessPagination(operation: TunedOperationObject, body?: SchemaObject, response?: SchemaObject): PaginationGuess;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +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AE,MAAM,EAKxC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAU/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAMvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAUrC,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,MAAM,EAWlC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAUxC,CAAC;AA4IF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,oBAAoB,EAC/B,IAAI,CAAC,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,YAAY,GACtB,eAAe,CAqCjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.test.d.ts","sourceRoot":"","sources":["../../../src/lib/pagination/pagination.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OpenAPIObject, ParameterLocation, ParameterObject, ReferenceObject, SecurityRequirementObject, SecuritySchemeObject } from 'openapi3-ts/oas31';
|
|
2
|
+
import type { OurOpenAPIObject } from './operation.ts';
|
|
3
|
+
type OIn = ParameterLocation | 'input';
|
|
4
|
+
type OurParameter = Omit<ParameterObject, 'in'> & {
|
|
5
|
+
in: OIn;
|
|
6
|
+
};
|
|
7
|
+
export declare function securityToOptions(spec: OpenAPIObject, security: SecurityRequirementObject[], securitySchemes: Record<string, SecuritySchemeObject | ReferenceObject>, staticIn?: OIn): OurParameter[];
|
|
8
|
+
export declare function security(spec: OurOpenAPIObject): OurParameter[];
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/lib/security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,KAAK,GAAG,GAAG,iBAAiB,GAAG,OAAO,CAAC;AACvC,KAAK,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,GAAG;IAChD,EAAE,EAAE,GAAG,CAAC;CACT,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,yBAAyB,EAAE,EACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAAC,EACvE,QAAQ,CAAC,EAAE,GAAG,kBA2Cf;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,kBA4B9C"}
|
package/dist/lib/sidebar.d.ts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type OurOpenAPIObject } from './operation.js';
|
|
2
2
|
export type ChildNavItem = {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
url: string;
|
|
6
|
-
isActive?: boolean;
|
|
7
6
|
};
|
|
8
7
|
export type NavItem = {
|
|
9
8
|
id: string;
|
|
10
9
|
title: string;
|
|
11
10
|
description?: string;
|
|
12
11
|
url: string;
|
|
13
|
-
isActive?: boolean;
|
|
14
12
|
items?: ChildNavItem[];
|
|
15
13
|
};
|
|
16
14
|
export type CategoryItem = {
|
|
17
15
|
category: string;
|
|
18
16
|
description?: string;
|
|
19
17
|
items: NavItem[];
|
|
20
|
-
isActive?: boolean;
|
|
21
18
|
};
|
|
22
19
|
export type SidebarData = CategoryItem[];
|
|
23
|
-
export declare function toSidebar(spec:
|
|
20
|
+
export declare function toSidebar(spec: OurOpenAPIObject): SidebarData;
|
|
24
21
|
export interface XOaiMeta {
|
|
25
22
|
navigationGroups: NavigationGroup[];
|
|
26
23
|
groups: Group[];
|
|
@@ -28,9 +25,9 @@ export interface XOaiMeta {
|
|
|
28
25
|
export interface Group {
|
|
29
26
|
id: string;
|
|
30
27
|
title: string;
|
|
31
|
-
description
|
|
28
|
+
description?: string;
|
|
32
29
|
navigationGroup: string;
|
|
33
|
-
sections
|
|
30
|
+
sections: Section[];
|
|
34
31
|
beta?: boolean;
|
|
35
32
|
legacy?: boolean;
|
|
36
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/lib/sidebar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/lib/sidebar.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;AAyCzC,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,eAuC/C;AAED,MAAM,WAAW,QAAQ;IACvB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReferenceObject, SchemaObject, SchemaObjectType } from 'openapi3-ts/oas31';
|
|
2
|
+
import type { OurOpenAPIObject } from './operation.ts';
|
|
3
|
+
export declare function fixSpec(spec: OurOpenAPIObject, schemas: (SchemaObject | ReferenceObject)[], visited?: Set<string>): void;
|
|
4
|
+
type Refs = {
|
|
5
|
+
name: string;
|
|
6
|
+
value: SchemaObject;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function expandSpec(spec: OurOpenAPIObject, schemas: Record<string, SchemaObject | ReferenceObject>, refs: Refs): void;
|
|
9
|
+
export declare function coerceTypes(schema: SchemaObject, excludeNull?: boolean): SchemaObjectType[];
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tune.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tune.d.ts","sourceRoot":"","sources":["../../src/lib/tune.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAe3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,wBAAgB,OAAO,CACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,CAAC,YAAY,GAAG,eAAe,CAAC,EAAE,EAC3C,OAAO,cAAoB,QA6J5B;AAED,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,EAAE,CAAC;AAEpD,wBAAgB,UAAU,CACxB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC,EACvD,IAAI,EAAE,IAAI,QAoJX;AA0CD,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY,EACpB,WAAW,UAAO,GACjB,gBAAgB,EAAE,CAUpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tune.test.d.ts","sourceRoot":"","sources":["../../src/lib/tune.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,9 +26,14 @@
|
|
|
26
26
|
"!**/*.tsbuildinfo"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@sdk-it/core": "0.22.0",
|
|
29
30
|
"openapi3-ts": "4.4.0",
|
|
30
|
-
"
|
|
31
|
+
"pluralize": "^8.0.0",
|
|
31
32
|
"stringcase": "^4.3.1",
|
|
32
|
-
"
|
|
33
|
+
"yaml": "^2.7.0",
|
|
34
|
+
"fast-content-type-parse": "^3.0.0",
|
|
35
|
+
"lodash-es": "^4.17.21",
|
|
36
|
+
"debug": "^4.4.1",
|
|
37
|
+
"micromatch": "4.0.8"
|
|
33
38
|
}
|
|
34
39
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { loadLocal } from "./local-loader.js";
|
|
2
|
-
import { convertPostmanToOpenAPI } from "./postman/postman-converter.js";
|
|
3
|
-
import { loadRemote } from "./remote-loader.js";
|
|
4
|
-
function isPostman(content) {
|
|
5
|
-
return typeof content === "object" && content !== null && "info" in content && typeof content.info === "object" && content.info !== null && "item" in content && Array.isArray(content.item) && "schema" in content.info && typeof content.info.schema === "string" && content.info.schema.includes("//schema.getpostman.com/");
|
|
6
|
-
}
|
|
7
|
-
async function loadSpec(location) {
|
|
8
|
-
const content = await loadFile(location);
|
|
9
|
-
if (isPostman(content)) {
|
|
10
|
-
return convertPostmanToOpenAPI(content);
|
|
11
|
-
}
|
|
12
|
-
return content;
|
|
13
|
-
}
|
|
14
|
-
function loadFile(location) {
|
|
15
|
-
const [protocol] = location.split(":");
|
|
16
|
-
if (protocol === "http" || protocol === "https") {
|
|
17
|
-
return loadRemote(location);
|
|
18
|
-
}
|
|
19
|
-
return loadLocal(location);
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
loadFile,
|
|
23
|
-
loadSpec
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=load-spec.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/loaders/load-spec.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPIObject } from 'openapi3-ts/oas31';\n\nimport { loadLocal } from './local-loader.js';\nimport { convertPostmanToOpenAPI } from './postman/postman-converter.js';\nimport type { PostmanCollection } from './postman/spec-types.js';\nimport { loadRemote } from './remote-loader.js';\n\nfunction isPostman(content: unknown): content is PostmanCollection {\n return (\n typeof content === 'object' &&\n content !== null &&\n 'info' in content &&\n typeof content.info === 'object' &&\n content.info !== null &&\n 'item' in content &&\n Array.isArray(content.item) &&\n 'schema' in content.info &&\n typeof content.info.schema === 'string' &&\n content.info.schema.includes('//schema.getpostman.com/')\n );\n}\nexport async function loadSpec(location: string): Promise<OpenAPIObject> {\n const content = await loadFile(location);\n if (isPostman(content)) {\n return convertPostmanToOpenAPI(content);\n }\n return content as OpenAPIObject;\n}\n\nexport function loadFile<T>(location: string): Promise<T> {\n const [protocol] = location.split(':');\n if (protocol === 'http' || protocol === 'https') {\n return loadRemote(location);\n }\n return loadLocal(location);\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,iBAAiB;AAC1B,SAAS,+BAA+B;AAExC,SAAS,kBAAkB;AAE3B,SAAS,UAAU,SAAgD;AACjE,SACE,OAAO,YAAY,YACnB,YAAY,QACZ,UAAU,WACV,OAAO,QAAQ,SAAS,YACxB,QAAQ,SAAS,QACjB,UAAU,WACV,MAAM,QAAQ,QAAQ,IAAI,KAC1B,YAAY,QAAQ,QACpB,OAAO,QAAQ,KAAK,WAAW,YAC/B,QAAQ,KAAK,OAAO,SAAS,0BAA0B;AAE3D;AACA,eAAsB,SAAS,UAA0C;AACvE,QAAM,UAAU,MAAM,SAAS,QAAQ;AACvC,MAAI,UAAU,OAAO,GAAG;AACtB,WAAO,wBAAwB,OAAO;AAAA,EACxC;AACA,SAAO;AACT;AAEO,SAAS,SAAY,UAA8B;AACxD,QAAM,CAAC,QAAQ,IAAI,SAAS,MAAM,GAAG;AACrC,MAAI,aAAa,UAAU,aAAa,SAAS;AAC/C,WAAO,WAAW,QAAQ;AAAA,EAC5B;AACA,SAAO,UAAU,QAAQ;AAC3B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { extname } from "node:path";
|
|
3
|
-
import { parse } from "yaml";
|
|
4
|
-
async function loadLocal(location) {
|
|
5
|
-
const extName = extname(location);
|
|
6
|
-
const text = await readFile(location, "utf-8");
|
|
7
|
-
switch (extName) {
|
|
8
|
-
case ".json":
|
|
9
|
-
return JSON.parse(text);
|
|
10
|
-
case ".yaml":
|
|
11
|
-
case ".yml":
|
|
12
|
-
return parse(text);
|
|
13
|
-
default:
|
|
14
|
-
throw new Error(`Unsupported file extension: ${extName}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
loadLocal
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=local-loader.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/loaders/local-loader.ts"],
|
|
4
|
-
"sourcesContent": ["import { readFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport { parse } from 'yaml';\n\nexport async function loadLocal(location: string) {\n const extName = extname(location);\n const text = await readFile(location, 'utf-8');\n switch (extName) {\n case '.json':\n return JSON.parse(text);\n case '.yaml':\n case '.yml':\n return parse(text);\n default:\n throw new Error(`Unsupported file extension: ${extName}`);\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,aAAa;AAEtB,eAAsB,UAAU,UAAkB;AAChD,QAAM,UAAU,QAAQ,QAAQ;AAChC,QAAM,OAAO,MAAM,SAAS,UAAU,OAAO;AAC7C,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO,KAAK,MAAM,IAAI;AAAA,IACxB,KAAK;AAAA,IACL,KAAK;AACH,aAAO,MAAM,IAAI;AAAA,IACnB;AACE,YAAM,IAAI,MAAM,+BAA+B,OAAO,EAAE;AAAA,EAC5D;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|