gd-sprest-def
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -8,3 +8,2 @@ /** | ||
name: "update", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
@@ -16,3 +15,2 @@ } | ||
name: "update", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
@@ -24,3 +22,2 @@ } | ||
name: "update", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
@@ -32,3 +29,2 @@ } | ||
name: "update", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
@@ -40,3 +36,2 @@ } | ||
name: "extractSensitivityLabel", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
@@ -46,3 +41,2 @@ }, | ||
name: "setSensitivityLabel", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "{ actionSource?: string; assignmentMethod?: string; id: string; justificationText?: string; }" }] | ||
@@ -52,6 +46,11 @@ }, | ||
name: "update", | ||
returnType: "void", | ||
argNames: [{ name: "values", type: "any" }] | ||
} | ||
], | ||
sites: [ | ||
{ | ||
name: "add", | ||
argNames: [{ name: "values", type: "any" }] | ||
} | ||
] | ||
} |
52
main.js
@@ -399,3 +399,2 @@ let fs = require("fs"); | ||
let returnType = entityType.$.BaseType; | ||
if (name == "drive") { debugger; } | ||
@@ -703,2 +702,6 @@ // See if the return type exists | ||
// Create the mapper content | ||
let contentMapper = []; | ||
let contentMapperDef = []; | ||
// Parse the custom methods | ||
@@ -717,3 +720,10 @@ for (let name in customV2) { | ||
for (let name in entities) { | ||
// Get the entity names | ||
let entityNames = []; | ||
for (let name in entities) { entityNames.push(name); } | ||
entityNames = entityNames.sort(); | ||
// Parse the entity names | ||
for (let i = 0; i < entityNames.length; i++) { | ||
let name = entityNames[i]; | ||
let entity = entities[name]; | ||
@@ -729,3 +739,6 @@ let baseType = entity.returnType && getGraphType(entity.returnType) ? getGraphType(entity.returnType) + " & " : ""; | ||
if (name == "columnDefinition") { debugger; } | ||
// Parse the methods | ||
let mapper = []; | ||
let mapperDef = []; | ||
let methods = []; | ||
@@ -738,4 +751,6 @@ let odataResults = []; | ||
let argStrings = []; | ||
let argsMapper = []; | ||
for (let i = 0; i < argNames.length; i++) { | ||
let argName = argNames[i]; | ||
argsMapper.push(argName.name); | ||
argStrings.push(argName.name + ": " + argName.type); | ||
@@ -753,2 +768,9 @@ } | ||
if (method.name != prevName) { | ||
// Add the mapper | ||
let mapperReturnType = returnTypeName.split('.'); | ||
mapperReturnType = mapperReturnType[mapperReturnType.length - 1]; | ||
argsMapperStr = argsMapper.length > 0 ? `"${argsMapper.join('", "')}"` : ""; | ||
mapper.push(`\t\t${method.name}: {\n${argsMapperStr ? "\t\t\argNames: [" + argsMapperStr + "],\n" : ""}${mapperReturnType != "void" ? "\t\t\treturnType: \"" + mapperReturnType + "\"\n" : ""}\t\t},`) | ||
mapperDef.push(`\t\t${method.name}: IMapperMethod${argsMapperStr ? " & {\n\t\t\targNames: [" + argsMapperStr + "]\n\t\t}" : ""},`); | ||
// See if it has args | ||
@@ -782,4 +804,30 @@ if (argStrings.length > 0) { | ||
}`); | ||
// Add the mapper | ||
contentMapper.push(`\t${name}: { | ||
${mapper.join('\n')} | ||
\t},`); | ||
// Add the mapper | ||
contentMapperDef.push(`\t${name}: { | ||
\t\tproperties?: Array<string>; | ||
${mapperDef.join('\n')} | ||
\t},`); | ||
} | ||
fs.writeFileSync("lib/microsoft/graph/entityTypes.d.ts", content.join('\n').replace(/EntityTypes./g, "")); | ||
// Create the mapper files | ||
fs.appendFileSync('lib/mapperv2.d.ts', [ | ||
'import { IMapperMethod } from "./base";\n\n', | ||
'/** Mapper */', | ||
'export interface IMapper {', | ||
contentMapperDef.join('\n'), | ||
'}' | ||
].join('\n')); | ||
fs.appendFileSync('lib/mapperv2.ts', [ | ||
'import { IMapper } from "./mapperv2.d";', | ||
'export const Mapper: IMapper = {', | ||
contentMapper.join('\n'), | ||
'};' | ||
].join('\n')); | ||
} | ||
@@ -786,0 +834,0 @@ |
{ | ||
"name": "gd-sprest-def", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"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
11289339
368
120766