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,13 +1,14 @@
{
"name": "importer-postman",
"name": "importer-openapi",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "importer-postman",
"name": "importer-openapi",
"version": "0.0.1",
"dependencies": {
"@yaakapp/api": "^0.1.6",
"openapi-to-postmanv2": "^4.23.1",
"yaml": "^2.4.2"
},
@@ -54,6 +55,27 @@
"@types/node": "*"
}
},
"node_modules/@yaakapp/api": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.1.6.tgz",
"integrity": "sha512-5lYXKcOVmLzVUrkfU4JOCbz+CBV5Dm/cALoZvfbelvZWOVu3sTrBxS9cbNVQQq2B6WwLInSevk7pMq58GqIj5Q==",
"dependencies": {
"@types/node": "^22.0.0"
}
},
"node_modules/@yaakapp/api/node_modules/@types/node": {
"version": "22.3.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.3.0.tgz",
"integrity": "sha512-nrWpWVaDZuaVc5X84xJ0vNrLvomM205oQyLsRt7OHNZbSHslcWsvgFR7O7hire2ZonjLrWBbedmotmIlJDVd6g==",
"dependencies": {
"undici-types": "~6.18.2"
}
},
"node_modules/@yaakapp/api/node_modules/undici-types": {
"version": "6.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.18.2.tgz",
"integrity": "sha512-5ruQbENj95yDYJNS3TvcaxPMshV7aizdv/hWYjGIKoANWKjhWNBsr2YEuYZKodQulB1b8l7ILOuDQep3afowQQ=="
},
"node_modules/ajv": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",

View File

@@ -5,6 +5,7 @@
"build": "yaakcli ./src/index.js"
},
"dependencies": {
"@yaakapp/api": "^0.1.6",
"openapi-to-postmanv2": "^4.23.1",
"yaml": "^2.4.2"
},

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) {