mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
Update plugins
This commit is contained in:
@@ -45,7 +45,7 @@ function pluginHookImport(_ctx, contents) {
|
||||
model: "workspace",
|
||||
id: generateId("workspace"),
|
||||
name: info.name || "Postman Import",
|
||||
description: info.description?.content ?? info.description ?? ""
|
||||
description: info.description?.content ?? info.description
|
||||
};
|
||||
exportResources.workspaces.push(workspace);
|
||||
const environment = {
|
||||
@@ -98,7 +98,7 @@ function pluginHookImport(_ctx, contents) {
|
||||
workspaceId: workspace.id,
|
||||
folderId,
|
||||
name: v.name,
|
||||
description: v.description,
|
||||
description: v.description || void 0,
|
||||
method: r.method || "GET",
|
||||
url,
|
||||
urlParameters,
|
||||
@@ -116,7 +116,8 @@ function pluginHookImport(_ctx, contents) {
|
||||
for (const item of root.item) {
|
||||
importItem(item);
|
||||
}
|
||||
return { resources: convertTemplateSyntax(exportResources) };
|
||||
const resources = deleteUndefinedAttrs(convertTemplateSyntax(exportResources));
|
||||
return { resources };
|
||||
}
|
||||
function convertUrl(url) {
|
||||
if (typeof url === "string") {
|
||||
@@ -298,6 +299,17 @@ function convertTemplateSyntax(obj) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
function deleteUndefinedAttrs(obj) {
|
||||
if (Array.isArray(obj) && obj != null) {
|
||||
return obj.map(deleteUndefinedAttrs);
|
||||
} else if (typeof obj === "object" && obj != null) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(obj).filter(([, v]) => v !== void 0).map(([k, v]) => [k, deleteUndefinedAttrs(v)])
|
||||
);
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
var idCount = {};
|
||||
function generateId(model) {
|
||||
idCount[model] = (idCount[model] ?? -1) + 1;
|
||||
|
||||
Reference in New Issue
Block a user