@sdk-it/typescript 0.15.0 → 0.16.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.js +805 -718
- package/dist/index.js.map +4 -4
- package/dist/lib/client.d.ts +1 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/emitters/interface.d.ts.map +1 -1
- package/dist/lib/emitters/zod.d.ts +4 -4
- package/dist/lib/emitters/zod.d.ts.map +1 -1
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generator.d.ts +2 -0
- package/dist/lib/generator.d.ts.map +1 -1
- package/dist/lib/readme-generator.d.ts.map +1 -1
- package/dist/lib/sdk.d.ts +18 -13
- package/dist/lib/sdk.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +7 -14
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/lib/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/lib/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAuCvD,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE;IACR,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;KACvC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,iBA2JF"}
|
package/dist/lib/generator.d.ts
CHANGED
|
@@ -24,5 +24,7 @@ export declare function generateCode(config: GenerateSdkConfig & {
|
|
|
24
24
|
commonSchemas: Record<string, string>;
|
|
25
25
|
commonZod: Map<string, string>;
|
|
26
26
|
outputs: Record<string, string>;
|
|
27
|
+
clientFiles: {};
|
|
28
|
+
endpoints: any;
|
|
27
29
|
};
|
|
28
30
|
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/lib/generator.ts"],"names":[],"mappings":"AAYA,OAAO,
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/lib/generator.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,iBAAiB,EAAsC,MAAM,cAAc,CAAC;AAG1F,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,UAAU,CAAC;AAQlB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB;AACD,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,iBAAiB,GAAG;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;;;;;;;EAwRF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readme-generator.d.ts","sourceRoot":"","sources":["../../src/lib/readme-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EASd,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"readme-generator.d.ts","sourceRoot":"","sources":["../../src/lib/readme-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EASd,MAAM,mBAAmB,CAAC;AAK3B;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB,MAAM,CAoFR"}
|
package/dist/lib/sdk.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenAPIObject, OperationObject } from 'openapi3-ts/oas31';
|
|
2
|
+
import { type Import, type MakeImportFn } from './utils.ts';
|
|
2
3
|
export type Parser = 'chunked' | 'buffered';
|
|
3
4
|
export interface SdkConfig {
|
|
4
5
|
/**
|
|
@@ -17,10 +18,10 @@ export type Options = Record<string, {
|
|
|
17
18
|
optionName?: string;
|
|
18
19
|
}>;
|
|
19
20
|
export interface Spec {
|
|
20
|
-
operations: Record<string, Operation[]>;
|
|
21
21
|
name: string;
|
|
22
22
|
options: Options;
|
|
23
23
|
servers: string[];
|
|
24
|
+
operations: Record<string, Operation[]>;
|
|
24
25
|
makeImport: MakeImportFn;
|
|
25
26
|
}
|
|
26
27
|
export interface OperationInput {
|
|
@@ -29,22 +30,26 @@ export interface OperationInput {
|
|
|
29
30
|
}
|
|
30
31
|
export interface Operation {
|
|
31
32
|
name: string;
|
|
32
|
-
errors: string[];
|
|
33
33
|
type: string;
|
|
34
34
|
trigger: Record<string, any>;
|
|
35
|
-
outgoingContentType?: string;
|
|
36
|
-
parser: Parser;
|
|
37
35
|
schemas: Record<string, string>;
|
|
38
36
|
inputs: Record<string, OperationInput>;
|
|
39
|
-
|
|
40
|
-
import: string;
|
|
41
|
-
use: string;
|
|
42
|
-
};
|
|
37
|
+
outgoingContentType?: string;
|
|
43
38
|
}
|
|
44
39
|
export declare function generateInputs(operationsSet: Spec['operations'], commonZod: Map<string, string>, makeImport: MakeImportFn): any;
|
|
45
|
-
export declare function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
export declare function toEndpoint(groupName: string, spec: OpenAPIObject, specOperation: OperationObject, operation: Operation, utils: {
|
|
41
|
+
makeImport: MakeImportFn;
|
|
42
|
+
}): {
|
|
43
|
+
responses: {
|
|
44
|
+
schemas: Record<string, string>;
|
|
45
|
+
imports: Record<string, Import>;
|
|
46
|
+
endpointImports: Record<string, Import>;
|
|
47
|
+
responses: {
|
|
48
|
+
name: string;
|
|
49
|
+
schema: string;
|
|
50
|
+
}[];
|
|
51
|
+
outputs: string[];
|
|
52
|
+
}[];
|
|
53
|
+
schemas: string[];
|
|
49
54
|
};
|
|
50
55
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/lib/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/lib/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/lib/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAA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Y,CAAC;CAC1B;;;;;;kBAoIwB,MAAM;oBAAU,MAAM;;;;;EA5ChD"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import type { ComponentsObject,
|
|
1
|
+
import type { ComponentsObject, SecurityRequirementObject } from 'openapi3-ts/oas31';
|
|
2
2
|
import { type Options } from './sdk.ts';
|
|
3
|
-
export declare function isRef(obj: any): obj is ReferenceObject;
|
|
4
|
-
export declare function cleanRef(ref: string): string;
|
|
5
|
-
export declare function parseRef(ref: string): {
|
|
6
|
-
model: string;
|
|
7
|
-
path: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function followRef(spec: OpenAPIObject, ref: string): SchemaObject;
|
|
10
3
|
export declare function securityToOptions(security: SecurityRequirementObject[], securitySchemes: ComponentsObject['securitySchemes'], staticIn?: string): Options;
|
|
11
|
-
export declare function mergeImports(imports: Import[]): Import[];
|
|
4
|
+
export declare function mergeImports(...imports: Import[]): Import[];
|
|
12
5
|
export interface Import {
|
|
13
|
-
isTypeOnly
|
|
6
|
+
isTypeOnly?: boolean;
|
|
14
7
|
moduleSpecifier: string;
|
|
15
|
-
defaultImport
|
|
8
|
+
defaultImport?: string | undefined;
|
|
16
9
|
namedImports: NamedImport[];
|
|
17
|
-
namespaceImport
|
|
10
|
+
namespaceImport?: string | undefined;
|
|
18
11
|
}
|
|
19
12
|
export interface NamedImport {
|
|
20
13
|
name: string;
|
|
21
14
|
alias?: string;
|
|
22
|
-
isTypeOnly
|
|
15
|
+
isTypeOnly?: boolean;
|
|
23
16
|
}
|
|
24
17
|
export declare function importsToString(...imports: Import[]): string[];
|
|
25
18
|
export declare function exclude<T>(list: T[], exclude: T[]): T[];
|
|
26
|
-
export declare function useImports(content: string, imports: Import[]): string[];
|
|
19
|
+
export declare function useImports(content: string, ...imports: Import[]): string[];
|
|
27
20
|
export type MakeImportFn = (moduleSpecifier: string) => string;
|
|
28
21
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,yBAAyB,EAAE,EACrC,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,EACpD,QAAQ,CAAC,EAAE,MAAM,WAsClB;AAED,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,YAsBhD;AAED,MAAM,WAAW,MAAM;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,YAenD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,YAe/D;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"!**/*.tsbuildinfo"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@sdk-it/core": "0.
|
|
24
|
+
"@sdk-it/core": "0.16.0",
|
|
25
25
|
"openapi3-ts": "^4.4.0",
|
|
26
26
|
"stringcase": "^4.3.1",
|
|
27
27
|
"lodash-es": "^4.17.21",
|