Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg
public static final String STRING_ENUMS = "stringEnums";
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";

protected String nestVersion = "6.0.0";
protected String nestVersion = "8.3.1";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should default this to 8.4.0, I ran into some issues installing fastify plugins on 8.3.x

protected String npmRepository = null;
protected String serviceSuffix = "Service";
protected String serviceFileSuffix = ".service";
Expand Down Expand Up @@ -109,7 +109,7 @@ public String getName() {

@Override
public String getHelp() {
return "Generates a TypeScript Nestjs 6.x client library.";
return "Generates a TypeScript Nestjs 8.x client library.";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { DynamicModule, HttpService, HttpModule, Module, Global } from '@nestjs/common';
import { DynamicModule, Module, Global } from '@nestjs/common';
import { Configuration } from './configuration';
import { HttpService, HttpModule } from '@nestjs/axios';
import { ConfigModule, ConfigService } from '@nestjs/config';

{{#apiInfo}}
{{#apis}}
Expand All @@ -9,7 +11,7 @@ import { {{classname}} } from './{{importPath}}';

@Global()
@Module({
imports: [ HttpModule ],
imports: [ HttpModule, ConfigModule ],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

exports: [
{{#apiInfo}}{{#apis}}{{classname}}{{^-last}},
{{/-last}}{{/apis}}{{/apiInfo}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{>licenseInfo}}
/* tslint:disable:no-unused-variable member-ordering */

import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
import { AxiosResponse } from 'axios';
import { Inject, Injectable, Optional } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { AxiosResponse, AxiosRequestConfig } from 'axios';
import { Observable } from 'rxjs';
{{#imports}}
import { {{classname}} } from '../{{filename}}';
Expand Down Expand Up @@ -53,8 +54,8 @@ export class {{classname}} {
{{/allParams}}* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}): Observable<any> {
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}options?: AxiosRequestConfig): Observable<AxiosResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{#allParams}}{{^isConstEnumParam}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/isConstEnumParam}}{{/allParams}}options?: AxiosRequestConfig): any {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we'd want to pump in the same Configuration object that is being passed into the constructor, like done in the Axios generated clients.

{{#allParams}}

{{#required}}
Expand Down Expand Up @@ -218,7 +219,7 @@ export class {{classname}} {
responseType: "blob",
{{/isResponseFile}}
withCredentials: this.configuration.withCredentials,
headers: headers
headers: { ...headers, ...options?.headers }
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
"@nestjs/common": "^{{nestVersion}}",
"@nestjs/core": "^{{nestVersion}}",
"@nestjs/platform-express": "^{{nestVersion}}",
"@nestjs/config": "1.1.6",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a variable for setting the config version, some of our applications are using 1.2.0 already

"reflect-metadata": "^0.1.13",
"rimraf": "^2.6.3",
"rxjs": "^6.5.2"
"rxjs": "^7.1.0",
"@nestjs/axios": "^0.0.6"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a variable for setting the axios version

},
"devDependencies": {
"@nestjs/testing": "~{{nestVersion}}",
Expand Down