@goast/typescript 0.3.1 → 0.3.3

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.
Files changed (49) hide show
  1. package/README.md +2 -0
  2. package/assets/client/k6/request-builder.js +411 -0
  3. package/cjs/lib/ast/nodes/method.js +9 -6
  4. package/cjs/lib/ast/nodes/reference.js +9 -4
  5. package/cjs/lib/ast/references/index.js +2 -1
  6. package/cjs/lib/ast/references/k6.js +9 -0
  7. package/cjs/lib/file-builder.js +9 -4
  8. package/cjs/lib/generators/index.js +2 -1
  9. package/cjs/lib/generators/models/model-generator.js +1 -1
  10. package/cjs/lib/generators/services/k6-clients/index.js +6 -0
  11. package/cjs/lib/generators/services/k6-clients/k6-client-generator.js +311 -0
  12. package/cjs/lib/generators/services/k6-clients/k6-clients-generator.js +116 -0
  13. package/cjs/lib/generators/services/k6-clients/models.js +28 -0
  14. package/cjs/lib/generators/services/k6-clients/refs.js +12 -0
  15. package/cjs/lib/import-collection.js +49 -7
  16. package/esm/lib/ast/nodes/method.js +9 -6
  17. package/esm/lib/ast/nodes/reference.js +9 -4
  18. package/esm/lib/ast/references/index.js +2 -0
  19. package/esm/lib/ast/references/k6.js +6 -0
  20. package/esm/lib/file-builder.js +9 -4
  21. package/esm/lib/generators/index.js +2 -1
  22. package/esm/lib/generators/models/model-generator.js +1 -1
  23. package/esm/lib/generators/services/k6-clients/index.js +3 -0
  24. package/esm/lib/generators/services/k6-clients/k6-client-generator.js +307 -0
  25. package/esm/lib/generators/services/k6-clients/k6-clients-generator.js +112 -0
  26. package/esm/lib/generators/services/k6-clients/models.js +25 -0
  27. package/esm/lib/generators/services/k6-clients/refs.js +9 -0
  28. package/esm/lib/import-collection.js +49 -7
  29. package/package.json +3 -3
  30. package/types/lib/ast/nodes/method.d.ts +2 -0
  31. package/types/lib/ast/nodes/reference.d.ts +8 -2
  32. package/types/lib/ast/references/angular.d.ts +21 -7
  33. package/types/lib/ast/references/easy-network-stub.d.ts +12 -4
  34. package/types/lib/ast/references/index.d.ts +1 -0
  35. package/types/lib/ast/references/k6.d.ts +24 -0
  36. package/types/lib/ast/references/rxjs.d.ts +15 -5
  37. package/types/lib/ast/references/typescript.d.ts +87 -29
  38. package/types/lib/common-results.d.ts +2 -0
  39. package/types/lib/file-builder.d.ts +3 -3
  40. package/types/lib/generators/index.d.ts +2 -1
  41. package/types/lib/generators/services/angular-services/refs.d.ts +21 -7
  42. package/types/lib/generators/services/easy-network-stub/refs.d.ts +27 -9
  43. package/types/lib/generators/services/fetch-clients/refs.d.ts +9 -3
  44. package/types/lib/generators/services/k6-clients/index.d.ts +3 -0
  45. package/types/lib/generators/services/k6-clients/k6-client-generator.d.ts +39 -0
  46. package/types/lib/generators/services/k6-clients/k6-clients-generator.d.ts +27 -0
  47. package/types/lib/generators/services/k6-clients/models.d.ts +118 -0
  48. package/types/lib/generators/services/k6-clients/refs.d.ts +20 -0
  49. package/types/lib/import-collection.d.ts +10 -3
@@ -1,59 +1,77 @@
1
1
  import { TypeScriptEasyNetworkStubsGeneratorConfig } from './models';
2
2
  import { ts } from '../../../ast';
3
3
  export declare function getReferenceFactories(options: TypeScriptEasyNetworkStubsGeneratorConfig): {
4
- easyNetworkStubWrapperOptions: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
4
+ easyNetworkStubWrapperOptions: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
5
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
6
+ }) => ts.Reference<TBuilder, never>) & {
5
7
  refName: string;
6
8
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
7
9
  } & {
8
10
  moduleNameOrfilePath: string;
9
11
  };
10
- stubRequestItem: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
12
+ stubRequestItem: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
13
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
14
+ }) => ts.Reference<TBuilder, never>) & {
11
15
  refName: string;
12
16
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
13
17
  } & {
14
18
  moduleNameOrfilePath: string;
15
19
  };
16
- stubRequestInfo: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
20
+ stubRequestInfo: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>], options?: {
21
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
22
+ } | undefined) => ts.Reference<TBuilder, never>) & {
17
23
  refName: string;
18
24
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
19
25
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
20
26
  } & {
21
27
  moduleNameOrfilePath: string;
22
28
  };
23
- strictRouteResponseCallback: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>, ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
29
+ strictRouteResponseCallback: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>, ts.Type<TBuilder>], options?: {
30
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
31
+ } | undefined) => ts.Reference<TBuilder, never>) & {
24
32
  refName: string;
25
33
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
26
34
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
27
35
  } & {
28
36
  moduleNameOrfilePath: string;
29
37
  };
30
- getStubResponder: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
38
+ getStubResponder: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>], options?: {
39
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
40
+ } | undefined) => ts.Reference<TBuilder, never>) & {
31
41
  refName: string;
32
42
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
33
43
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
34
44
  } & {
35
45
  moduleNameOrfilePath: string;
36
46
  };
37
- easyNetworkStubWrapper: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
47
+ easyNetworkStubWrapper: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
48
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
49
+ }) => ts.Reference<TBuilder, never>) & {
38
50
  refName: string;
39
51
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
40
52
  } & {
41
53
  moduleNameOrfilePath: string;
42
54
  };
43
- easyNetworkStubBase: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
55
+ easyNetworkStubBase: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
56
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
57
+ }) => ts.Reference<TBuilder, never>) & {
44
58
  refName: string;
45
59
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
46
60
  } & {
47
61
  moduleNameOrfilePath: string;
48
62
  };
49
- easyNetworkStubGroup: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
63
+ easyNetworkStubGroup: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>], options?: {
64
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
65
+ } | undefined) => ts.Reference<TBuilder, never>) & {
50
66
  refName: string;
51
67
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
52
68
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
53
69
  } & {
54
70
  moduleNameOrfilePath: string;
55
71
  };
56
- createEasyNetworkStubGroup: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
72
+ createEasyNetworkStubGroup: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>, ts.Type<TBuilder>], options?: {
73
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
74
+ } | undefined) => ts.Reference<TBuilder, never>) & {
57
75
  refName: string;
58
76
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
59
77
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
@@ -1,20 +1,26 @@
1
1
  import { TypeScriptFetchClientsGeneratorConfig } from './models';
2
2
  import { ts } from '../../../ast';
3
3
  export declare function getReferenceFactories(options: TypeScriptFetchClientsGeneratorConfig): {
4
- typedResponse: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>]) => ts.Reference<TBuilder, never>) & {
4
+ typedResponse: (<TBuilder extends import("@goast/core").SourceBuilder>(generics: [ts.Type<TBuilder>], options?: {
5
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
6
+ } | undefined) => ts.Reference<TBuilder, never>) & {
5
7
  refName: string;
6
8
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
7
9
  infer: <TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>;
8
10
  } & {
9
11
  moduleNameOrfilePath: string;
10
12
  };
11
- fetchClientOptions: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
13
+ fetchClientOptions: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
14
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
15
+ }) => ts.Reference<TBuilder, never>) & {
12
16
  refName: string;
13
17
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
14
18
  } & {
15
19
  moduleNameOrfilePath: string;
16
20
  };
17
- urlBuilder: (<TBuilder extends import("@goast/core").SourceBuilder>() => ts.Reference<TBuilder, never>) & {
21
+ urlBuilder: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
22
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
23
+ }) => ts.Reference<TBuilder, never>) & {
18
24
  refName: string;
19
25
  moduleNameOrfilePath: import("@goast/core").Nullable<string>;
20
26
  } & {
@@ -0,0 +1,3 @@
1
+ export * from './k6-client-generator';
2
+ export * from './k6-clients-generator';
3
+ export * from './models';
@@ -0,0 +1,39 @@
1
+ import { ApiEndpoint, ApiSchema, AppendValueGroup } from '@goast/core';
2
+ import { TypeScriptK6ClientGeneratorContext, TypeScriptK6ClientGeneratorOutput } from './models';
3
+ import { ts } from '../../../ast';
4
+ import { TypeScriptExportOutput } from '../../../common-results';
5
+ import { TypeScriptFileBuilder } from '../../../file-builder';
6
+ import { TypeScriptImportOptions } from '../../../import-collection';
7
+ import { TypeScriptFileGenerator } from '../../file-generator';
8
+ type Context = TypeScriptK6ClientGeneratorContext;
9
+ type Output = TypeScriptK6ClientGeneratorOutput;
10
+ type Builder = TypeScriptFileBuilder;
11
+ export interface TypeScriptK6ClientGenerator<TOutput extends Output = Output> {
12
+ generate(context: Context): TOutput;
13
+ }
14
+ export declare class DefaultTypeScriptK6ClientGenerator extends TypeScriptFileGenerator<Context, Output> implements TypeScriptK6ClientGenerator {
15
+ generate(ctx: TypeScriptK6ClientGeneratorContext): TypeScriptK6ClientGeneratorOutput;
16
+ protected generateResponseModels(ctx: Context): Record<string, TypeScriptExportOutput>;
17
+ protected getResponseModelFileContent(ctx: Context, endpoint: ApiEndpoint): AppendValueGroup<Builder>;
18
+ protected getEndpointStatusCodes(ctx: Context, endpoint: ApiEndpoint): Record<number, {
19
+ type: ts.Type<Builder>;
20
+ }>;
21
+ protected getClientFileContent(ctx: Context): AppendValueGroup<Builder>;
22
+ protected getEndpointParamsType(ctx: Context, endpoint: ApiEndpoint): ts.Doc<Builder>;
23
+ protected getClass(ctx: Context): ts.Class<Builder>;
24
+ protected getEndpointMethod(ctx: Context, endpoint: ApiEndpoint): ts.Method<Builder>;
25
+ protected getGetK6ParamsMethod(ctx: Context): ts.Method<Builder>;
26
+ protected getEndpointSuccessResponse(ctx: Context, endpoint: ApiEndpoint): import("@goast/core").ApiResponse | undefined;
27
+ protected getSchemaType(ctx: Context, schema: ApiSchema | undefined, options?: TypeScriptImportOptions & {
28
+ fallback?: ts.Type<Builder>;
29
+ }): ts.Type<Builder>;
30
+ protected getClassName(ctx: Context): string;
31
+ protected getResponseModelName(ctx: Context, endpoint: ApiEndpoint): string;
32
+ protected getEndpointParamsTypeName(ctx: Context, endpoint: ApiEndpoint): string;
33
+ protected getEndpointPathPropertyName(ctx: Context, endpoint: ApiEndpoint): string;
34
+ protected getEndpointMethodName(ctx: Context, endpoint: ApiEndpoint): string;
35
+ protected getFilePath(ctx: Context): string;
36
+ protected getResponseModelFilePath(ctx: Context): string;
37
+ protected hasEndpointParams(ctx: Context, endpoint: ApiEndpoint): boolean;
38
+ }
39
+ export {};
@@ -0,0 +1,27 @@
1
+ import { OpenApiServicesGenerationProviderBase, Factory, OpenApiGeneratorContext, ApiService, AppendValueGroup } from '@goast/core';
2
+ import { TypeScriptK6ClientGenerator } from './k6-client-generator';
3
+ import { TypeScriptK6ClientsGeneratorInput, TypeScriptK6ClientsGeneratorOutput, TypeScriptK6ClientsGeneratorConfig, TypeScriptK6ClientGeneratorOutput, TypeScriptK6ClientsGeneratorContext } from './models';
4
+ import { TypeScriptFileBuilder } from '../../../file-builder';
5
+ type Input = TypeScriptK6ClientsGeneratorInput;
6
+ type Output = TypeScriptK6ClientsGeneratorOutput;
7
+ type Config = TypeScriptK6ClientsGeneratorConfig;
8
+ type ServiceOutput = TypeScriptK6ClientGeneratorOutput;
9
+ type Context = TypeScriptK6ClientsGeneratorContext;
10
+ export declare class TypeScriptK6ClientsGenerator extends OpenApiServicesGenerationProviderBase<Input, Output, Config, ServiceOutput, Context> {
11
+ private readonly _clientGeneratorFactory;
12
+ constructor(clientGeneratorFactory?: Factory<TypeScriptK6ClientGenerator, []>);
13
+ protected initResult(): Output;
14
+ protected buildContext(context: OpenApiGeneratorContext<Input>, config?: Partial<Config> | undefined): Context;
15
+ onGenerate(ctx: Context): Output;
16
+ protected generateService(ctx: Context, service: ApiService): ServiceOutput;
17
+ protected addServiceResult(ctx: Context, service: ApiService, result: ServiceOutput): void;
18
+ protected generateUtilsFiles(ctx: Context): void;
19
+ protected getHttpStatusCodeFileContent(ctx: Context): AppendValueGroup<TypeScriptFileBuilder>;
20
+ protected generateIndexFiles(ctx: Context): Output['typescript']['indexFiles'];
21
+ protected getIndexFilePath(ctx: Context): string | null;
22
+ protected getResponseModelsIndexFilePath(ctx: Context): string | null;
23
+ protected getIndexFileContent(ctx: Context): AppendValueGroup<TypeScriptFileBuilder>;
24
+ protected getResponseModelsIndexFileContent(ctx: Context): AppendValueGroup<TypeScriptFileBuilder>;
25
+ private copyFile;
26
+ }
27
+ export {};
@@ -0,0 +1,118 @@
1
+ import { Nullable, ExtendedStringCasing, DefaultGenerationProviderConfig, ApiService, OpenApiServicesGenerationProviderContext, ApiSchema } from '@goast/core';
2
+ import { getReferenceFactories } from './refs';
3
+ import { ts } from '../../../ast';
4
+ import { TypeScriptExportOutput } from '../../../common-results';
5
+ import { TypeScriptGeneratorConfig } from '../../../config';
6
+ import { TypeScriptFileBuilder } from '../../../file-builder';
7
+ import { TypeScriptModelsGeneratorOutput } from '../../models';
8
+ export type TypeScriptK6ClientsGeneratorConfig = TypeScriptGeneratorConfig & {
9
+ /**
10
+ * Whether to use strict response types for the services.
11
+ * If enabled only the status codes are included that are defined in the OpenAPI specification or the `defaultStatusCodeResponseTypes` option.
12
+ * @default true
13
+ */
14
+ strictResponseTypes: boolean;
15
+ /**
16
+ * The default response types for status codes that are not defined in the OpenAPI specification.
17
+ * @example
18
+ * {
19
+ * 400: {
20
+ * parser: 'json',
21
+ * type: schemas =>
22
+ * schemas.find(s => s.name === 'BadRequestResponse')
23
+ * ?? throwExp('BadRequestResponse not found'),
24
+ * },
25
+ * 404: null,
26
+ * 500: {
27
+ * parser: 'json',
28
+ * type: ts.refs.any(),
29
+ * },
30
+ * }
31
+ * @default
32
+ * {
33
+ * 401: null,
34
+ * 403: null,
35
+ * 500: null,
36
+ * }
37
+ */
38
+ defaultStatusCodeResponseTypes: Record<number, {
39
+ parser: 'text' | 'json';
40
+ type: Exclude<ts.Type<TypeScriptFileBuilder>, Function> | ((schemas: readonly ApiSchema[]) => ApiSchema);
41
+ } | null>;
42
+ /**
43
+ * The possible status codes that any API endpoint can return.
44
+ * This is only used when `strictResponseTypes` is set to `false`.
45
+ * @default
46
+ * [100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, 511]
47
+ */
48
+ possibleStatusCodes: number[];
49
+ /**
50
+ * The casing of the client file names. If nullish, the `fileNameCasing` is used.
51
+ * @default { casing: 'kebab', suffix: '-client' }
52
+ */
53
+ clientFileNameCasing: Nullable<ExtendedStringCasing>;
54
+ /**
55
+ * The casing of the file names for the response models. If nullish, the `fileNameCasing` is used.
56
+ * @default { casing: 'kebab', suffix: '-responses' }
57
+ */
58
+ responseModelFileNameCasing: Nullable<ExtendedStringCasing>;
59
+ /**
60
+ * The casing of the client names. If nullish, the `typeNameCasing` is used.
61
+ * @default { casing: 'pascal', suffix: 'Client' }
62
+ */
63
+ clientNameCasing: Nullable<ExtendedStringCasing>;
64
+ /**
65
+ * The directory where the client files should be saved. The path is relative to the output directory.
66
+ * @default 'clients'
67
+ */
68
+ clientDir: string;
69
+ /**
70
+ * The directory where the response models should be saved. The path is relative to the output directory.
71
+ * @default 'models/responses'
72
+ */
73
+ responseModelsDir: string;
74
+ /**
75
+ * The index file where all clients should be exported. The path is relative to the output directory. If nullish, no index file will be generated.
76
+ * @default 'clients.ts'
77
+ */
78
+ clientsIndexFile: Nullable<string>;
79
+ /**
80
+ * The path to the index file where all response models should be exported. The path is relative to the output directory. If nullish, no index file will be generated.
81
+ * @default 'responses.ts'
82
+ */
83
+ responseModelsIndexFile: Nullable<string>;
84
+ /**
85
+ * The directory where the utilies should be saved. The path is relative to the output directory.
86
+ * @default 'utils'
87
+ */
88
+ utilsDir: string;
89
+ /**
90
+ * Whether to generate clients calling the async API of k6.
91
+ * @default true
92
+ */
93
+ async: boolean;
94
+ };
95
+ export declare const defaultTypeScriptK6ClientsGeneratorConfig: DefaultGenerationProviderConfig<TypeScriptK6ClientsGeneratorConfig>;
96
+ export type TypeScriptK6ClientsGeneratorInput = TypeScriptModelsGeneratorOutput;
97
+ export type TypeScriptK6ClientsGeneratorOutput = {
98
+ typescript: {
99
+ k6Clients: {
100
+ [serviceId: string]: TypeScriptK6ClientGeneratorOutput;
101
+ };
102
+ indexFiles: {
103
+ k6Clients: Nullable<string>;
104
+ k6ResponseModels: Nullable<string>;
105
+ };
106
+ };
107
+ };
108
+ export type TypeScriptK6ClientGeneratorOutput = TypeScriptExportOutput & {
109
+ responseModels: {
110
+ [operationId: string]: TypeScriptExportOutput;
111
+ };
112
+ };
113
+ export type TypeScriptK6ClientsGeneratorContext = OpenApiServicesGenerationProviderContext<TypeScriptK6ClientsGeneratorInput, TypeScriptK6ClientsGeneratorOutput, TypeScriptK6ClientsGeneratorConfig, TypeScriptK6ClientGeneratorOutput> & {
114
+ refs: ReturnType<typeof getReferenceFactories>;
115
+ };
116
+ export type TypeScriptK6ClientGeneratorContext = TypeScriptK6ClientsGeneratorContext & {
117
+ readonly service: ApiService;
118
+ };
@@ -0,0 +1,20 @@
1
+ import { TypeScriptK6ClientsGeneratorConfig } from './models';
2
+ import { ts } from '../../../ast';
3
+ export declare function getReferenceFactories(options: TypeScriptK6ClientsGeneratorConfig): {
4
+ requestBuilder: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
5
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
6
+ }) => ts.Reference<TBuilder, never>) & {
7
+ refName: string;
8
+ moduleNameOrfilePath: import("@goast/core").Nullable<string>;
9
+ } & {
10
+ moduleNameOrfilePath: string;
11
+ };
12
+ httpStatusCode: (<TBuilder extends import("@goast/core").SourceBuilder>(options?: {
13
+ importType?: import("@goast/core").Nullable<import("../../../common-results").TypeScriptImportType>;
14
+ }) => ts.Reference<TBuilder, never>) & {
15
+ refName: string;
16
+ moduleNameOrfilePath: import("@goast/core").Nullable<string>;
17
+ } & {
18
+ moduleNameOrfilePath: string;
19
+ };
20
+ };
@@ -1,5 +1,5 @@
1
1
  import { SourceBuilderOptions, StringBuilder } from '@goast/core';
2
- import { TypeScriptImport, TypeScriptImportKind } from './common-results';
2
+ import { TypeScriptImport, TypeScriptImportKind, TypeScriptImportType } from './common-results';
3
3
  import { ImportModuleTransformer } from './utils';
4
4
  export type ImportExportCollectionOptions = {
5
5
  filePath?: string;
@@ -7,20 +7,27 @@ export type ImportExportCollectionOptions = {
7
7
  useSingleQuotes: boolean;
8
8
  };
9
9
  export declare const defaultImportExportCollectionOptions: ImportExportCollectionOptions;
10
+ export type TypeScriptImportOptions = {
11
+ type?: TypeScriptImportType;
12
+ };
10
13
  export declare class ImportExportCollection {
11
14
  private readonly _imports;
15
+ private readonly _typeImports;
16
+ private readonly _jsDocImports;
12
17
  private readonly _exports;
13
18
  private readonly _options;
14
19
  constructor(options?: Partial<ImportExportCollectionOptions>);
15
20
  get hasImports(): boolean;
16
21
  get hasExports(): boolean;
17
22
  get imports(): TypeScriptImport[];
18
- addImport(importName: string, fromModule: string): void;
23
+ private toImport;
24
+ addImport(importName: string, fromModule: string, options?: TypeScriptImportOptions): void;
25
+ getImportMap(type: TypeScriptImportType): Map<string, Set<string>>;
19
26
  addExport(exportName: string, fromModule: string): void;
20
27
  clear(): void;
21
28
  toString(options: Partial<SourceBuilderOptions>): string;
22
29
  writeTo(builder: StringBuilder): void;
23
- protected writeImportsExports(builder: StringBuilder, keyword: 'import' | 'export', data: (readonly [string, TypeScriptImportKind, string[]])[], options: {
30
+ protected writeImportsExports(builder: StringBuilder, keyword: 'import' | 'export' | 'import type' | ' * @import', data: (readonly [string, TypeScriptImportKind, string[]])[], options: {
24
31
  useSingleQuotes: boolean;
25
32
  }): void;
26
33
  protected sortAndResolve(data: Map<string, Set<string>>, filePath: string | undefined, importModuleTransformer: ImportModuleTransformer): (readonly [string, TypeScriptImportKind, string[]])[];