Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pList.upsert(certificate); // $ExpectType boolean | null
pmCollection.PropertyList.isPropertyList(pList); // $ExpectType boolean
// CertificateList Tests
const certList = new pmCollection.CertificateList(null, [pList]);
certList.resolveOne("string"); // $ExpectType CertificateDefinition
pmCollection.CertificateList.isCertificateList(certList); // $ExpectType boolean
// ItemGroupDefinition Tests
const igDef: pmCollection.ItemGroupDefinition = {};
igDef.item; // $ExpectType (ItemGroupDefinition | ItemDefinition)[] | undefined
igDef.auth; // $ExpectType RequestAuthDefinition | undefined
igDef.event; // $ExpectType EventDefinition[] | undefined
// ItemGroup Tests
const ig = new pmCollection.ItemGroup();
ig.auth; // $ExpectType RequestAuth | undefined
ig.items; // $ExpectType PropertyList
ig.events; // $ExpectType EventList
ig.authorizeRequestsUsing("string"); // $ExpectType void
ig.authorizeRequestsUsing({}); // $ExpectType void
ig.authorizeRequestsUsing("string", new pmCollection.VariableList(ig, [])); // $ExpectType void
ig.forEachItem((el) => {}); // $ExpectType void
ig.forEachItemGroup((el) => {}); // $ExpectType void
ig.oneDeep("string"); // $ExpectType Certificate
pmCollection.ItemGroup.isItemGroup(ig); // $ExpectType boolean
// CollectionDefinition Tests
itemGroup,
subChild,
item,
i,
requestCount;
// it's a folder
if (resource.type === 'item-group') {
// 3 options:
// 1. folder with more than one request in its subtree
// (immediate children or otherwise)
if (resource.requestCount > 1) {
// only return a Postman folder if this folder has>1 requests in its subtree
// otherwise we can end up with 10 levels of folders with 1 request in the end
itemGroup = new sdk.ItemGroup({
name: this.insertSpacesInName(resource.name)
// TODO: have to add auth here (but first, auth to be put into the openapi tree)
});
// recurse over child leaf nodes
// and add as children to this folder
for (i = 0, requestCount = resource.requests.length; i < requestCount; i++) {
itemGroup.items.add(
this.convertChildToItemGroup(openapi, resource.requests[i])
);
}
// recurse over child folders
// and add as child folders to this folder
for (subChild in resource.children) {
if (resource.children.hasOwnProperty(subChild) && resource.children[subChild].requestCount > 0) {
convertChildToItemGroup: function(child) {
var thisItemGroup, thisItem, rCount;
// child will be a folder or request
// depending on the type
if (child.type === "group") {
// folder
thisItemGroup = new ItemGroup({
name: child.name
});
for(var subChild in child.children) {
if(child.children.hasOwnProperty(subChild)) {
thisItemGroup.items.add(
this.convertChildToItemGroup(child.children[subChild])
);
}
}
for(var i = 0, rCount = child.requests.length; i < rCount; i++) {
thisItemGroup.items.add(this.convertChildToItemGroup(child.requests[i]));
}
return thisItemGroup;
}
else {
// request