gd-sprest-def
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -120,2 +120,15 @@ /** | ||
/** | ||
* Mapper | ||
*/ | ||
export interface IMapper { | ||
data?: any; | ||
inheritMetadataType?: boolean; | ||
metadataType?: any; | ||
replaceEndpointFl?: boolean; | ||
requestType?: number; | ||
requestMethod?: string; | ||
returnType?: string; | ||
} | ||
/** | ||
* Method Information Settings | ||
@@ -122,0 +135,0 @@ */ |
@@ -120,2 +120,15 @@ /** | ||
/** | ||
* Mapper | ||
*/ | ||
export interface IMapper { | ||
data?: any; | ||
inheritMetadataType?: boolean; | ||
metadataType?: any; | ||
replaceEndpointFl?: boolean; | ||
requestType?: number; | ||
requestMethod?: string; | ||
returnType?: string; | ||
} | ||
/** | ||
* Method Information Settings | ||
@@ -122,0 +135,0 @@ */ |
64
main.js
@@ -456,2 +456,3 @@ let fs = require("fs"); | ||
// Directory -> File | ||
let mapper = {}; | ||
for (let dirName in directories) { | ||
@@ -462,3 +463,2 @@ let api = []; | ||
let filesIndex = []; | ||
let mapper = {}; | ||
@@ -799,44 +799,44 @@ // Set the path | ||
} | ||
} | ||
// Parse the mapper | ||
let mapperContent = []; | ||
for (let mapperKey in mapper) { | ||
let methods = []; | ||
// Parse the mapper | ||
let mapperContent = []; | ||
for (let mapperKey in mapper) { | ||
let methods = []; | ||
// Add the header | ||
methods.push('\/* ' + mapperKey + ' *\/'); | ||
methods.push('export interface ' + mapperKey + ' {'); | ||
// Add the header | ||
methods.push('\/* ' + mapperKey + ' *\/'); | ||
methods.push('export interface ' + mapperKey + ' {'); | ||
// Parse the methods | ||
for (let i = 0; i < mapper[mapperKey].length; i++) { | ||
let argNames = []; | ||
let methodInfo = mapper[mapperKey][i]; | ||
// Parse the methods | ||
for (let i = 0; i < mapper[mapperKey].length; i++) { | ||
let argNames = []; | ||
let methodInfo = mapper[mapperKey][i]; | ||
// Parse the parameters | ||
for (let j = 0; j < methodInfo.params.length; j++) { | ||
let param = methodInfo.params[j]; | ||
// Parse the parameters | ||
for (let j = 0; j < methodInfo.params.length; j++) { | ||
let param = methodInfo.params[j]; | ||
// Append the argument | ||
argNames.push(param.$.Name); | ||
} | ||
// Add the method | ||
methods.push([ | ||
'\t' + methodInfo.name + ': { ', | ||
argNames.length > 0 ? '\t\targNames: [ "' + argNames.join('", "') + '" ],' : '', | ||
'\t},' | ||
].join('\n')); | ||
// Append the argument | ||
argNames.push(param.$.Name); | ||
} | ||
// Add the closing tag | ||
methods.push('};\n'); | ||
// Generate the interface | ||
mapperContent.push(methods.join('\n')); | ||
// Add the method | ||
methods.push([ | ||
'\t' + methodInfo.name + ': { ', | ||
argNames.length > 0 ? '\t\targNames: IMapper & [ "' + argNames.join('", "') + '" ],' : '', | ||
'\t},' | ||
].join('\n')); | ||
} | ||
// Create the index file | ||
fs.appendFileSync('lib/mapper.ts', '\n' + mapperContent.join('\n')); | ||
// Add the closing tag | ||
methods.push('};\n'); | ||
// Generate the interface | ||
mapperContent.push(methods.join('\n')); | ||
} | ||
// Create the index file | ||
fs.appendFileSync('lib/mapper.ts', 'import { IMapper } from "./base";\n\n' + mapperContent.join('\n')); | ||
// Log | ||
@@ -843,0 +843,0 @@ console.log("Library generated in './lib'"); |
{ | ||
"name": "gd-sprest-def", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"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
4058201
42299