gd-sprest-def
Advanced tools
Comparing version 1.6.4 to 1.6.5
18
main.js
@@ -696,3 +696,3 @@ let fs = require("fs"); | ||
content = [ | ||
"import { IBaseCollection, IBaseQuery } from \"../../base\";", | ||
"import { IBaseCollection, IBaseQuery, IBaseResults } from \"../../base\";", | ||
"import * as ComplexTypes from \"./complexTypes.d\";", | ||
@@ -727,2 +727,3 @@ "import * as EnumTypes from \"./enumTypes.d\";" | ||
let methods = []; | ||
let odataMethods = []; | ||
for (let method of entity.methods) { | ||
@@ -737,4 +738,12 @@ // Add the method | ||
let returnType = getGraphType(method.returnType, true) || "void"; | ||
let methodsType = returnType == "void" || returnType.indexOf("ComplexTypes.") == 0 || returnType.indexOf("[]") > 0 ? "" : " & " + returnType.replace(/\[\]$/, '') + "Methods"; | ||
methods.push(`\t${method.name}(${argStrings.join(", ")}): ${returnType.indexOf("[]") > 0 ? "IBaseCollection" : "IBaseQuery"}<${returnType.replace(/\[\]$/, '')}>${methodsType}${method.returnType2 && getGraphType(method.returnType2, true) ? " & " + getGraphType(method.returnType2, true) : ""};`); | ||
let isCollection = returnType.indexOf("[]") > 0; | ||
let isComplexType = returnType.indexOf("ComplexTypes.") == 0; | ||
let returnTypeName = returnType.replace(/\[\]$/, ''); | ||
let methodsType = returnType == "void" || isComplexType || isCollection ? "" : " & " + returnTypeName + "Methods"; | ||
methods.push(`\t${method.name}(${argStrings.join(", ")}): ${isCollection ? "IBaseCollection" : "IBaseQuery"}<${returnTypeName}${isCollection && !isComplexType ? ", " + returnTypeName + "OData" : ""}>${methodsType}${method.returnType2 && getGraphType(method.returnType2, true) ? " & " + getGraphType(method.returnType2, true) : ""};`); | ||
// See if this is a collection | ||
if (isCollection) { | ||
odataMethods.push(`\t${method.name}: ${isCollection ? "IBaseResults<" : ""}${returnTypeName}${isCollection ? ">" : ""};`); | ||
} | ||
} | ||
@@ -752,2 +761,5 @@ | ||
${methods.join('\n')} | ||
} | ||
export interface ${name}OData { | ||
${odataMethods.join('\n')} | ||
}`); | ||
@@ -754,0 +766,0 @@ } |
{ | ||
"name": "gd-sprest-def", | ||
"version": "1.6.4", | ||
"version": "1.6.5", | ||
"description": "TypeScript definition files generated from the $metadata REST endpoint in SharePoint.", | ||
@@ -5,0 +5,0 @@ "author": "Gunjan Datta <me@dattabase.com> (https://gunjandatta.github.io)", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11044687
110714