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.2.5 to 2.2.6

2

lib/schema-to-typescript/common/core/common-http-client.d.ts

@@ -70,3 +70,3 @@ export interface CommonHttpClientOptions {

}
type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends any ? ((a: T) => void) extends (a: {
type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends unknown ? ((a: T) => void) extends (a: {
mediaType: K;

@@ -73,0 +73,0 @@ status: infer _Status;

@@ -210,6 +210,4 @@ "use strict";

});
if (response.headers.has('set-cookie')) {
if ('getSetCookie' in response.headers) {
headers['set-cookie'] = response.headers.getSetCookie();
}
if (response.headers.has('set-cookie') && 'getSetCookie' in response.headers) {
headers['set-cookie'] = response.headers.getSetCookie();
}

@@ -216,0 +214,0 @@ return {

@@ -222,3 +222,6 @@ export interface CommonHttpClientOptions {

type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends any
/**
* `extends unknown` is a trick to split the union into individual types.
*/
type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends unknown
? ((a: T) => void) extends (a: {

@@ -391,6 +394,4 @@ mediaType: K;

});
if (response.headers.has('set-cookie')) {
if ('getSetCookie' in response.headers) {
headers['set-cookie'] = (response.headers as {getSetCookie(): string[]}).getSetCookie();
}
if (response.headers.has('set-cookie') && 'getSetCookie' in response.headers) {
headers['set-cookie'] = (response.headers as {getSetCookie(): string[]}).getSetCookie();
}

@@ -397,0 +398,0 @@ return {

@@ -8,5 +8,5 @@ import * as commonHttpClient from './common-http-client';

const classInstance = this.constructor as typeof CommonHttpService;
if (!classInstance.initialized) {
if (classInstance.initialized !== true) {
classInstance.initialized = true;
if (classInstance.initialize) {
if (classInstance.initialize !== undefined) {
classInstance.initialize();

@@ -20,3 +20,3 @@ }

protected static initialized: boolean | undefined;
protected static initialize: () => void | undefined;
protected static initialize: (() => void) | undefined;
}

@@ -462,6 +462,22 @@ "use strict";

caseEntries = Object.entries(cases);
let prefIfStatement = (0, types_1.ifStatement)(buildCondition(caseEntries[0][0]), buildStatement(caseEntries[0][1], caseEntries[0][0]));
const ifBlockInfos = caseEntries.map(([key, value]) => ({
condition: buildCondition(key),
statement: buildStatement(value, key)
}));
const resultingIfBlocks = [];
while (ifBlockInfos.length > 0) {
const info = ifBlockInfos.shift();
for (let i = 0; i < ifBlockInfos.length; i++) {
if (R.equals(ifBlockInfos[i].statement, info.statement)) {
info.condition = (0, types_1.logicalExpression)('||', info.condition, ifBlockInfos[i].condition);
ifBlockInfos.splice(i, 1);
i--;
}
}
resultingIfBlocks.push((0, types_1.ifStatement)(info.condition, info.statement));
}
let prefIfStatement = resultingIfBlocks.shift();
const result = prefIfStatement;
for (let i = 1; i < caseEntries.length; i++) {
const newIfStatement = (0, types_1.ifStatement)(buildCondition(caseEntries[i][0]), buildStatement(caseEntries[i][1], caseEntries[i][0]));
while (resultingIfBlocks.length > 0) {
const newIfStatement = resultingIfBlocks.shift();
prefIfStatement.alternate = newIfStatement;

@@ -468,0 +484,0 @@ prefIfStatement = newIfStatement;

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

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

@@ -222,3 +222,6 @@ export interface CommonHttpClientOptions {

type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends any
/**
* `extends unknown` is a trick to split the union into individual types.
*/
type ResponseByMediaType<T extends CommonHttpClientResponse<unknown>, K extends string> = T extends unknown
? ((a: T) => void) extends (a: {

@@ -391,6 +394,4 @@ mediaType: K;

});
if (response.headers.has('set-cookie')) {
if ('getSetCookie' in response.headers) {
headers['set-cookie'] = (response.headers as {getSetCookie(): string[]}).getSetCookie();
}
if (response.headers.has('set-cookie') && 'getSetCookie' in response.headers) {
headers['set-cookie'] = (response.headers as {getSetCookie(): string[]}).getSetCookie();
}

@@ -397,0 +398,0 @@ return {

@@ -8,5 +8,5 @@ import * as commonHttpClient from './common-http-client';

const classInstance = this.constructor as typeof CommonHttpService;
if (!classInstance.initialized) {
if (classInstance.initialized !== true) {
classInstance.initialized = true;
if (classInstance.initialize) {
if (classInstance.initialize !== undefined) {
classInstance.initialize();

@@ -20,3 +20,3 @@ }

protected static initialized: boolean | undefined;
protected static initialize: () => void | undefined;
protected static initialize: (() => void) | undefined;
}

@@ -13,2 +13,3 @@ import * as fs from 'fs';

identifier,
IfStatement,
ifStatement,

@@ -18,2 +19,3 @@ isIdentifier,

isVariableDeclaration,
logicalExpression,
memberExpression,

@@ -560,12 +562,22 @@ newExpression,

caseEntries = Object.entries(cases);
let prefIfStatement = ifStatement(
buildCondition(caseEntries[0][0]),
buildStatement(caseEntries[0][1], caseEntries[0][0])
);
const ifBlockInfos: {condition: Expression; statement: Statement}[] = caseEntries.map(([key, value]) => ({
condition: buildCondition(key),
statement: buildStatement(value, key)
}));
const resultingIfBlocks: IfStatement[] = [];
while (ifBlockInfos.length > 0) {
const info = ifBlockInfos.shift()!;
for (let i = 0; i < ifBlockInfos.length; i++) {
if (R.equals(ifBlockInfos[i].statement, info.statement)) {
info.condition = logicalExpression('||', info.condition, ifBlockInfos[i].condition);
ifBlockInfos.splice(i, 1);
i--;
}
}
resultingIfBlocks.push(ifStatement(info.condition, info.statement));
}
let prefIfStatement = resultingIfBlocks.shift()!;
const result = prefIfStatement;
for (let i = 1; i < caseEntries.length; i++) {
const newIfStatement = ifStatement(
buildCondition(caseEntries[i][0]),
buildStatement(caseEntries[i][1], caseEntries[i][0])
);
while (resultingIfBlocks.length > 0) {
const newIfStatement = resultingIfBlocks.shift()!;
prefIfStatement.alternate = newIfStatement;

@@ -572,0 +584,0 @@ prefIfStatement = newIfStatement;

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