New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

api-typescript-generator

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-typescript-generator - npm Package Compare versions

Comparing version 2.4.10 to 2.4.11

8

lib/schema-to-typescript/common/client.js

@@ -63,3 +63,7 @@ "use strict";

});
clientClassBody.body.push((0, jsdoc_1.attachJsDocComment)((0, types_1.classProperty)((0, types_1.identifier)((0, string_utils_1.applyEntityNameCase)(tag, 'camelCase')), (0, types_1.newExpression)((0, types_1.identifier)(name), [(0, types_1.memberExpression)((0, types_1.thisExpression)(), (0, types_1.identifier)('getClient'))])), (0, jsdoc_1.renderJsDoc)(jsdoc, jsDocRenderConfig)));
clientClassBody.body.push((0, jsdoc_1.attachJsDocComment)((0, types_1.classMethod)('get', (0, types_1.identifier)((0, string_utils_1.applyEntityNameCase)(tag, 'camelCase')), [], (0, types_1.blockStatement)([
(0, types_1.returnStatement)((0, types_1.callExpression)((0, types_1.memberExpression)((0, types_1.thisExpression)(), (0, types_1.identifier)('getServiceInstance')), [
(0, types_1.identifier)(name)
]))
])), (0, jsdoc_1.renderJsDoc)(jsdoc, jsDocRenderConfig)));
}

@@ -95,3 +99,3 @@ }

]))
])), (0, types_1.classProperty)((0, types_1.identifier)('createClientWithServices'), (0, types_1.memberExpression)((0, types_1.identifier)(commonHttpClientImportName), (0, types_1.identifier)('createClientWithServices')), null, null, false, true));
])));
if (generatedMethods.validationStatements.length > 0) {

@@ -98,0 +102,0 @@ clientClassBody.body.push((0, types_1.classMethod)('method', (0, types_1.identifier)('initialize'), [], (0, types_1.blockStatement)(generatedMethods.validationStatements), false, true));

import * as commonHttpClient from './common-http-client';
export class CommonHttpService {
protected serviceInstancesMap: Map<
new (getClientInstance: () => commonHttpClient.CommonHttpClient) => CommonHttpService,
CommonHttpService
> = new Map();
protected getServiceInstance<T extends CommonHttpService>(
serviceClass: new (getClientInstance: () => commonHttpClient.CommonHttpClient) => T
): T {
let serviceInstance = this.serviceInstancesMap.get(serviceClass);
if (!serviceInstance) {
serviceInstance = new serviceClass(this.getClientInstance);
this.serviceInstancesMap.set(serviceClass, serviceInstance);
}
return serviceInstance as T;
}
protected getClientInstance: () => commonHttpClient.CommonHttpClient;

@@ -5,0 +21,0 @@ constructor(getClientInstance: () => commonHttpClient.CommonHttpClient) {

{
"name": "api-typescript-generator",
"version": "2.4.10",
"version": "2.4.11",
"description": "Generates OpenAPI TypeScript client. Extremely fast and flexible.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,2 +21,3 @@ import {

program,
returnStatement,
spreadElement,

@@ -170,5 +171,13 @@ Statement,

attachJsDocComment(
classProperty(
classMethod(
'get',
identifier(applyEntityNameCase(tag, 'camelCase')),
newExpression(identifier(name), [memberExpression(thisExpression(), identifier('getClient'))])
[],
blockStatement([
returnStatement(
callExpression(memberExpression(thisExpression(), identifier('getServiceInstance')), [
identifier(name)
])
)
])
),

@@ -251,10 +260,2 @@ renderJsDoc(jsdoc, jsDocRenderConfig)

])
),
classProperty(
identifier('createClientWithServices'),
memberExpression(identifier(commonHttpClientImportName), identifier('createClientWithServices')),
null,
null,
false,
true
)

@@ -261,0 +262,0 @@ );

import * as commonHttpClient from './common-http-client';
export class CommonHttpService {
protected serviceInstancesMap: Map<
new (getClientInstance: () => commonHttpClient.CommonHttpClient) => CommonHttpService,
CommonHttpService
> = new Map();
protected getServiceInstance<T extends CommonHttpService>(
serviceClass: new (getClientInstance: () => commonHttpClient.CommonHttpClient) => T
): T {
let serviceInstance = this.serviceInstancesMap.get(serviceClass);
if (!serviceInstance) {
serviceInstance = new serviceClass(this.getClientInstance);
this.serviceInstancesMap.set(serviceClass, serviceInstance);
}
return serviceInstance as T;
}
protected getClientInstance: () => commonHttpClient.CommonHttpClient;

@@ -5,0 +21,0 @@ constructor(getClientInstance: () => commonHttpClient.CommonHttpClient) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc