gd-sprest-def
Advanced tools
Comparing version 0.5.5 to 0.5.6
@@ -126,2 +126,3 @@ /** | ||
metadataType?: any; | ||
name?: string; | ||
replaceEndpointFl?: boolean; | ||
@@ -128,0 +129,0 @@ requestType?: number; |
@@ -126,2 +126,3 @@ /** | ||
metadataType?: any; | ||
name?: string; | ||
replaceEndpointFl?: boolean; | ||
@@ -128,0 +129,0 @@ requestType?: number; |
51
main.js
@@ -806,2 +806,3 @@ let fs = require("fs"); | ||
let mapperKey = mapperKeys[i]; | ||
let mapperMethods = []; | ||
@@ -813,3 +814,4 @@ // Add the lib | ||
// See if this is not a collection | ||
if (/\.Collection$/.test(mapperKey) == false) { | ||
let isCollection = /\.Collection$/.test(mapperKey); | ||
if (!isCollection) { | ||
// Add the optional properties | ||
@@ -820,6 +822,9 @@ mapperDef.push('\t\tproperties?: Array<string>;'); | ||
// See if this type is queryable | ||
if (hasCollections[mapperKey]) { | ||
if (hasCollections[mapperKey] || isCollection) { | ||
// Add the query method | ||
mapperDef.push('\t\tquery: IMapperMethod & { argNames: ["oData"] },') | ||
mapperContent.push('\t\tquery: { argNames: ["oData"], requestType: RequestType.OData },'); | ||
mapperMethods.push({ | ||
name: "query", | ||
def: '\t\tquery: IMapperMethod & { argNames: ["oData"] },\n', | ||
method: '\t\tquery: { argNames: ["oData"], requestType: RequestType.OData },\n' | ||
}); | ||
} | ||
@@ -848,15 +853,31 @@ | ||
// Add the method | ||
mapperDef.push([ | ||
'\t\t' + methodName + ': IMapperMethod & {\n', | ||
argNames.length > 0 ? '\t\targNames: [ "' + argNames.join('", "') + '" ],\n' : '', | ||
'\t\t},\n' | ||
].join('')); | ||
mapperContent.push([ | ||
'\t\t' + methodName + ': {\n', | ||
argNames.length > 0 ? '\t\targNames: [ "' + argNames.join('", "') + '" ],\n' : '', | ||
methodName == "delete" ? '\t\trequestType: RequestType.Delete\n' : '', | ||
'\t\t},\n' | ||
].join('')); | ||
mapperMethods.push({ | ||
name: methodName, | ||
def: [ | ||
'\t\t' + methodName + ': IMapperMethod & {\n', | ||
argNames.length > 0 ? '\t\targNames: [ "' + argNames.join('", "') + '" ],\n' : '', | ||
'\t\t},\n' | ||
].join(''), | ||
method: [ | ||
'\t\t' + methodName + ': {\n', | ||
argNames.length > 0 ? '\t\targNames: [ "' + argNames.join('", "') + '" ],\n' : '', | ||
methodName == "delete" ? '\t\trequestType: RequestType.Delete\n' : '', | ||
'\t\t},\n' | ||
].join('') | ||
}); | ||
} | ||
// Sort the methods | ||
mapperMethods = mapperMethods.sort((a, b) => { | ||
if (a.name < b.name) { return -1; } | ||
if (a.name > b.name) { return 1; } | ||
return 0; | ||
}); | ||
// Parse the methods | ||
for (let i = 0; i < mapperMethods.length; i++) { | ||
mapperDef.push(mapperMethods[i].def); | ||
mapperContent.push(mapperMethods[i].method); | ||
} | ||
// Add the closing tag | ||
@@ -863,0 +884,0 @@ mapperDef.push('\t}\n'); |
{ | ||
"name": "gd-sprest-def", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"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
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
4192253
47647