removes lodash (#4550)

This commit is contained in:
Dimitri Mitropoulos authored and GitHub committed 2022-03-08 14:28:37 +00:00
1 parent f4bc702401
commit 29479b8bcf
8 files changed
+34 -25

No files matched your search

@@ -1,4 +1,4 @@
import { groupBy } from 'lodash';
import { groupBy, map, pipe } from 'ramda';
import type { GrpcMethodDefinition, GrpcMethodType } from '../network/grpc/method';
import { getMethodType } from '../network/grpc/method';
@@ -36,8 +36,6 @@ export interface GrpcMethodInfo {
type: GrpcMethodType;
fullPath: string;
}
type GroupedGrpcMethodInfo = Record<string, GrpcMethodInfo[]>;
export const NO_PACKAGE_KEY = 'no-package';
const getMethodInfo = (method: GrpcMethodDefinition): GrpcMethodInfo => ({
segments: getGrpcPathSegments(method.path),
@@ -45,7 +43,10 @@ const getMethodInfo = (method: GrpcMethodDefinition): GrpcMethodInfo => ({
fullPath: method.path,
});
export const groupGrpcMethodsByPackage = (
methods: GrpcMethodDefinition[],
): GroupedGrpcMethodInfo =>
groupBy(methods.map(getMethodInfo), m => m.segments.packageName || NO_PACKAGE_KEY);
export const NO_PACKAGE_KEY = 'no-package';
export const groupGrpcMethodsByPackage = (grpcMethodDefinitions: GrpcMethodDefinition[]) => pipe(
() => grpcMethodDefinitions,
map(getMethodInfo),
groupBy(({ segments }) => segments.packageName || NO_PACKAGE_KEY),
)();
@@ -1,4 +1,4 @@
import { difference } from 'lodash';
import { difference } from 'ramda';
import { generateId } from '../../../common/misc';
import { isGrpcRequest, isGrpcRequestId } from '../../grpc-request';
@@ -1,5 +1,5 @@
import { createBuilder } from '@develohpanda/fluent-builder';
import { difference } from 'lodash';
import { difference } from 'ramda';
import * as models from '../../../models';
import { baseModelSchema, grpcRequestModelSchema, requestGroupModelSchema, requestModelSchema } from '../../../models/__schemas__/model-schemas';
-1
View File
@@ -31,7 +31,6 @@
"apiconnect-wsdl": "^1.8.31",
"change-case": "^4.1.1",
"commander": "^7.1.0",
"lodash": "^4.17.15",
"ramda": "^0.27.1",
"ramda-adjunct": "^2.33.0",
"shell-quote": "^1.7.2",
@@ -50,6 +50,20 @@ declare module 'apiconnect-wsdl' {
definitions: {
Security?: UNKNOWN;
};
consumes: string[];
produces: string[];
info: {
title: string;
};
['x-ibm-configuration']: {
assembly: {
execute: {
proxy: {
['target-url']: string;
};
}[];
};
};
paths: UNKNOWN_OBJ;
}
@@ -5,7 +5,6 @@ import {
getWSDLServices,
Swagger,
} from 'apiconnect-wsdl';
import { get } from 'lodash';
import { Converter } from '../entities';
import * as postman from './postman';
@@ -17,20 +16,17 @@ export const description = 'Importer for WSDL files';
const convertToPostman = (items: Swagger[]) => {
const item = items.map(swagger => {
const item = [];
const url = get(
swagger,
'x-ibm-configuration.assembly.execute.0.proxy.target-url',
);
const url = swagger['x-ibm-configuration'].assembly.execute[0].proxy['target-url'];
for (const path of Object.keys(swagger.paths)) {
const methods = swagger.paths[path];
for (const method of Object.keys(methods)) {
const api = methods[method];
const paths = get(api, 'parameters.0.schema.$ref').split('/');
const paths = api.parameters[0].schema.$ref.split('/');
paths.shift();
paths.push('example');
const example = get(swagger, paths.join('.'));
const example = swagger.paths.join('.');
item.push({
name: api.operationId,
description: api.description || '',
@@ -40,17 +36,17 @@ const convertToPostman = (items: Swagger[]) => {
header: [
{
key: 'SOAPAction',
value: get(api, 'x-ibm-soap.soap-action'),
value: api['x-ibm-soap.soap-action'],
disabled: false,
},
{
key: 'Content-Type',
value: get(swagger, 'consumes.0'),
value: swagger.consumes[0],
disabled: false,
},
{
key: 'Accept',
value: get(swagger, 'produces.0'),
value: swagger.produces[0],
disabled: false,
},
],
@@ -64,13 +60,13 @@ const convertToPostman = (items: Swagger[]) => {
}
return {
name: get(swagger, 'info.title'),
name: swagger.info.title,
item,
};
});
return {
info: {
name: get(items[0], 'info.title'),
name: items[0].info.title,
schema: 'https://schema.getpostman.com/json/collection/v2.0.0/', // required
},
item,
-1
View File
@@ -88,7 +88,6 @@
"insomnia-plugin-uuid": "2.5.1",
"insomnia-send-request": "2.5.1",
"insomnia-testing": "2.5.1",
"lodash.flattendeep": "^4.4.0",
"mkdirp": "^1.0.4",
"nedb": "^1.8.0",
"openapi-2-kong": "2.5.1",
@@ -1,6 +1,6 @@
// @ts-expect-error the enquirer types are incomplete https://github.com/enquirer/enquirer/pull/307
import { AutoComplete } from 'enquirer';
import flattenDeep from 'lodash.flattendeep';
import { flatten } from 'ramda';
import { logger } from '../../logger';
import type { Database } from '../index';
@@ -69,7 +69,7 @@ export const promptTestSuites = async (
const prompt = new AutoComplete({
name: 'testSuite',
message: 'Select a document or unit test suite',
choices: flattenDeep(choices),
choices: flatten(choices),
});
logger.trace('Prompt for document or test suite');
const [idIsh] = (await prompt.run()).split(' - ').reverse();