Add @yaakapp/api everywhere

This commit is contained in:
Gregory Schier
2024-08-15 06:17:33 -07:00
parent bb3f948596
commit 54efb6ae4e
25 changed files with 258 additions and 1984 deletions

View File

@@ -1,3 +1,4 @@
import { YaakContext } from '@yaakapp/api';
import { convert } from 'openapi-to-postmanv2';
import { pluginHookImport as pluginHookImportPostman } from '../../importer-postman/src/index';
import { Folder, HttpRequest, Workspace, Environment } from '../../../types/models';
@@ -12,13 +13,13 @@ interface ExportResources {
}
export async function pluginHookImport(
ctx: any,
ctx: YaakContext,
contents: string,
): Promise<{ resources: ExportResources } | undefined> {
let postmanCollection;
try {
postmanCollection = await new Promise((resolve, reject) => {
convert({ type: 'string', data: contents }, {}, (err, result) => {
convert({ type: 'string', data: contents }, {}, (err, result: any) => {
if (err != null) reject(err);
if (Array.isArray(result.output) && result.output.length > 0) {