gd-sprest-def
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -33,4 +33,7 @@ var fs = require('fs'); | ||
// Delete the file | ||
fs.unlinkSync("./graph.xml"); | ||
// See if the file exists | ||
if (fs.existsSync("./graph.xml")) { | ||
// Delete the file | ||
fs.unlinkSync("./graph.xml"); | ||
} | ||
@@ -37,0 +40,0 @@ // Create the folder |
import { Base } from "../../../"; | ||
import { microsoft } from "../../../"; | ||
import { Edm } from "../../../"; | ||
import { graph } from "../../../"; | ||
import { graph } from "../../"; | ||
@@ -25,4 +24,4 @@ /********************************************* | ||
export interface clientUserAgent { | ||
platform?: microsoft.graph.callRecords.clientPlatform; | ||
productFamily?: microsoft.graph.callRecords.productFamily; | ||
platform?: microsoft.graph.clientPlatform; | ||
productFamily?: microsoft.graph.productFamily; | ||
} | ||
@@ -81,12 +80,12 @@ | ||
duration?: number; | ||
endDateTime?: anyOffset; | ||
failureDateTime?: anyOffset; | ||
endDateTime?: any; | ||
failureDateTime?: any; | ||
finalSipCode?: number; | ||
finalSipCodePhrase?: string; | ||
id?: string; | ||
inviteDateTime?: anyOffset; | ||
inviteDateTime?: any; | ||
mediaBypassEnabled?: boolean; | ||
mediaPathLocation?: string; | ||
signalingLocation?: string; | ||
startDateTime?: anyOffset; | ||
startDateTime?: any; | ||
successfulCall?: boolean; | ||
@@ -125,3 +124,3 @@ trunkFullyQualifiedDomainName?: string; | ||
reason?: string; | ||
stage?: microsoft.graph.callRecords.failureStage; | ||
stage?: microsoft.graph.failureStage; | ||
} | ||
@@ -175,3 +174,3 @@ | ||
basicServiceSetIdentifier?: string; | ||
connectionType?: microsoft.graph.callRecords.networkConnectionType; | ||
connectionType?: microsoft.graph.networkConnectionType; | ||
delayEventRatio?: any; | ||
@@ -182,3 +181,3 @@ dnsSuffix?: string; | ||
macAddress?: string; | ||
networkTransportProtocol?: microsoft.graph.callRecords.networkTransportProtocol; | ||
networkTransportProtocol?: microsoft.graph.networkTransportProtocol; | ||
port?: number; | ||
@@ -192,3 +191,3 @@ receivedQualityEventRatio?: any; | ||
traceRouteHops?: Array<microsoft.graph.callRecords.traceRouteHop>; | ||
wifiBand?: microsoft.graph.callRecords.wifiBand; | ||
wifiBand?: microsoft.graph.wifiBand; | ||
wifiBatteryCharge?: number; | ||
@@ -198,3 +197,3 @@ wifiChannel?: number; | ||
wifiMicrosoftDriverVersion?: string; | ||
wifiRadioType?: microsoft.graph.callRecords.wifiRadioType; | ||
wifiRadioType?: microsoft.graph.wifiRadioType; | ||
wifiSignalStrength?: number; | ||
@@ -216,28 +215,28 @@ wifiVendorDriver?: string; | ||
export interface mediaStream { | ||
audioCodec?: microsoft.graph.callRecords.audioCodec; | ||
audioCodec?: microsoft.graph.audioCodec; | ||
averageAudioDegradation?: any; | ||
averageAudioNetworkJitter?: Edm.Duration; | ||
averageAudioNetworkJitter?: number; | ||
averageBandwidthEstimate?: number; | ||
averageJitter?: Edm.Duration; | ||
averageJitter?: number; | ||
averagePacketLossRate?: any; | ||
averageRatioOfConcealedSamples?: any; | ||
averageReceivedFrameRate?: any; | ||
averageRoundTripTime?: Edm.Duration; | ||
averageRoundTripTime?: number; | ||
averageVideoFrameLossPercentage?: any; | ||
averageVideoFrameRate?: any; | ||
averageVideoPacketLossRate?: any; | ||
endDateTime?: anyOffset; | ||
endDateTime?: any; | ||
lowFrameRateRatio?: any; | ||
lowVideoProcessingCapabilityRatio?: any; | ||
maxAudioNetworkJitter?: Edm.Duration; | ||
maxJitter?: Edm.Duration; | ||
maxAudioNetworkJitter?: number; | ||
maxJitter?: number; | ||
maxPacketLossRate?: any; | ||
maxRatioOfConcealedSamples?: any; | ||
maxRoundTripTime?: Edm.Duration; | ||
maxRoundTripTime?: number; | ||
packetUtilization?: number; | ||
postForwardErrorCorrectionPacketLossRate?: any; | ||
startDateTime?: anyOffset; | ||
streamDirection?: microsoft.graph.callRecords.mediaStreamDirection; | ||
startDateTime?: any; | ||
streamDirection?: microsoft.graph.mediaStreamDirection; | ||
streamId?: string; | ||
videoCodec?: microsoft.graph.callRecords.videoCodec; | ||
videoCodec?: microsoft.graph.videoCodec; | ||
wasMediaBypassed?: boolean; | ||
@@ -259,3 +258,3 @@ } | ||
ipAddress?: string; | ||
roundTripTime?: Edm.Duration; | ||
roundTripTime?: number; | ||
} | ||
@@ -289,3 +288,3 @@ | ||
export interface userFeedback { | ||
rating?: microsoft.graph.callRecords.userFeedbackRating; | ||
rating?: microsoft.graph.userFeedbackRating; | ||
text?: string; | ||
@@ -306,3 +305,3 @@ tokens?: microsoft.graph.callRecords.feedbackTokenSet; | ||
export interface pstnCallLogRow { | ||
callDurationSource?: microsoft.graph.callRecords.pstnCallDurationSource; | ||
callDurationSource?: microsoft.graph.pstnCallDurationSource; | ||
calleeNumber?: string; | ||
@@ -319,3 +318,3 @@ callerNumber?: string; | ||
duration?: number; | ||
endDateTime?: anyOffset; | ||
endDateTime?: any; | ||
id?: string; | ||
@@ -325,3 +324,3 @@ inventoryType?: string; | ||
operator?: string; | ||
startDateTime?: anyOffset; | ||
startDateTime?: any; | ||
tenantCountryCode?: string; | ||
@@ -359,3 +358,3 @@ usageCountryCode?: string; | ||
export interface serviceUserAgent { | ||
role?: microsoft.graph.callRecords.serviceRole; | ||
role?: microsoft.graph.serviceRole; | ||
} | ||
@@ -362,0 +361,0 @@ |
import { Base } from "../../../"; | ||
import { graph } from "../../../"; | ||
import { graph } from "../../"; | ||
import { microsoft } from "../../../"; | ||
@@ -9,10 +9,10 @@ | ||
export interface callRecord { | ||
endDateTime?: anyOffset; | ||
endDateTime?: any; | ||
joinWebUrl?: string; | ||
lastModifiedDateTime?: anyOffset; | ||
lastModifiedDateTime?: any; | ||
modalities?: { results: Array<microsoft.graph.callRecords.modality> }; | ||
organizer?: graph.identitySet; | ||
participants?: { results: Array<graph.identitySet> }; | ||
startDateTime?: anyOffset; | ||
type?: microsoft.graph.callRecords.callType; | ||
startDateTime?: any; | ||
type?: microsoft.graph.callType; | ||
version?: number; | ||
@@ -34,6 +34,6 @@ } | ||
caller?: microsoft.graph.callRecords.endpoint; | ||
endDateTime?: anyOffset; | ||
endDateTime?: any; | ||
failureInfo?: microsoft.graph.callRecords.failureInfo; | ||
modalities?: { results: Array<microsoft.graph.callRecords.modality> }; | ||
startDateTime?: anyOffset; | ||
startDateTime?: any; | ||
} | ||
@@ -54,6 +54,6 @@ | ||
caller?: microsoft.graph.callRecords.endpoint; | ||
endDateTime?: anyOffset; | ||
endDateTime?: any; | ||
failureInfo?: microsoft.graph.callRecords.failureInfo; | ||
media?: { results: Array<microsoft.graph.callRecords.media> }; | ||
startDateTime?: anyOffset; | ||
startDateTime?: any; | ||
} | ||
@@ -60,0 +60,0 @@ |
export * from "./enumtypes"; | ||
export * from "./entitytypes"; | ||
export * from "./complextypes"; | ||
export * from "./functions"; |
@@ -8,4 +8,4 @@ import { Base } from "../../../"; | ||
export interface acl { | ||
accessType?: microsoft.graph.externalConnectors.accessType; | ||
type?: microsoft.graph.externalConnectors.aclType; | ||
accessType?: microsoft.graph.accessType; | ||
type?: microsoft.graph.aclType; | ||
value?: string; | ||
@@ -39,3 +39,3 @@ } | ||
export interface externalItemContent { | ||
type?: microsoft.graph.externalConnectors.externalItemContentType; | ||
type?: microsoft.graph.externalItemContentType; | ||
value?: string; | ||
@@ -76,3 +76,3 @@ } | ||
name?: string; | ||
type?: microsoft.graph.externalConnectors.propertyType; | ||
type?: microsoft.graph.propertyType; | ||
} | ||
@@ -79,0 +79,0 @@ |
import { Base } from "../../../"; | ||
import { graph } from "../../../"; | ||
import { graph } from "../../"; | ||
import { microsoft } from "../../../"; | ||
@@ -10,3 +10,3 @@ | ||
error?: graph.publicError; | ||
status?: microsoft.graph.externalConnectors.connectionOperationStatus; | ||
status?: microsoft.graph.connectionOperationStatus; | ||
} | ||
@@ -42,3 +42,3 @@ | ||
name?: string; | ||
state?: microsoft.graph.externalConnectors.connectionState; | ||
state?: microsoft.graph.connectionState; | ||
} | ||
@@ -103,3 +103,3 @@ | ||
export interface identity { | ||
type?: microsoft.graph.externalConnectors.identityType; | ||
type?: microsoft.graph.identityType; | ||
} | ||
@@ -106,0 +106,0 @@ |
export * from "./enumtypes"; | ||
export * from "./complextypes"; | ||
export * from "./entitytypes"; |
@@ -8,4 +8,3 @@ import * as callRecords from "./callRecords"; | ||
import * as termStore from "./termStore"; | ||
export { termStore } | ||
export * from "./enumtypes"; | ||
export { termStore }export * from "./enums"; | ||
export * from "./entitytypes"; | ||
@@ -12,0 +11,0 @@ export * from "./complextypes"; |
import { Base } from "../../../"; | ||
import { Edm } from "../../../"; | ||
@@ -10,3 +9,3 @@ /********************************************* | ||
maxImageSize?: number; | ||
timeout?: Edm.Duration; | ||
timeout?: number; | ||
} | ||
@@ -13,0 +12,0 @@ |
import { Base } from "../../../"; | ||
import { graph } from "../../../"; | ||
import { graph } from "../../"; | ||
import { microsoft } from "../../../"; | ||
@@ -23,8 +23,8 @@ | ||
export interface case { | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
description?: string; | ||
displayName?: string; | ||
lastModifiedBy?: graph.identitySet; | ||
lastModifiedDateTime?: anyOffset; | ||
status?: microsoft.graph.security.caseStatus; | ||
lastModifiedDateTime?: any; | ||
status?: microsoft.graph.caseStatus; | ||
} | ||
@@ -43,9 +43,9 @@ | ||
export interface caseOperation { | ||
action?: microsoft.graph.security.caseAction; | ||
completedDateTime?: anyOffset; | ||
action?: microsoft.graph.caseAction; | ||
completedDateTime?: any; | ||
createdBy?: graph.identitySet; | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
percentProgress?: number; | ||
resultInfo?: graph.resultInfo; | ||
status?: microsoft.graph.security.caseOperationStatus; | ||
status?: microsoft.graph.caseOperationStatus; | ||
} | ||
@@ -65,3 +65,3 @@ | ||
closedBy?: graph.identitySet; | ||
closedDateTime?: anyOffset; | ||
closedDateTime?: any; | ||
externalId?: string; | ||
@@ -82,3 +82,3 @@ } | ||
createdBy?: graph.identitySet; | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
displayName?: string; | ||
@@ -99,5 +99,5 @@ } | ||
createdBy?: graph.identitySet; | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
displayName?: string; | ||
holdStatus?: microsoft.graph.security.dataSourceHoldStatus; | ||
holdStatus?: microsoft.graph.dataSourceHoldStatus; | ||
} | ||
@@ -116,8 +116,8 @@ | ||
export interface dataSourceContainer { | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
displayName?: string; | ||
holdStatus?: microsoft.graph.security.dataSourceHoldStatus; | ||
lastModifiedDateTime?: anyOffset; | ||
releasedDateTime?: anyOffset; | ||
status?: microsoft.graph.security.dataSourceContainerStatus; | ||
holdStatus?: microsoft.graph.dataSourceHoldStatus; | ||
lastModifiedDateTime?: any; | ||
releasedDateTime?: any; | ||
status?: microsoft.graph.dataSourceContainerStatus; | ||
} | ||
@@ -166,7 +166,7 @@ | ||
createdBy?: graph.identitySet; | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
description?: string; | ||
displayName?: string; | ||
lastModifiedBy?: graph.identitySet; | ||
lastModifiedDateTime?: anyOffset; | ||
lastModifiedDateTime?: any; | ||
} | ||
@@ -185,3 +185,3 @@ | ||
export interface ediscoverySearch { | ||
dataSourceScopes?: microsoft.graph.security.dataSourceScopes; | ||
dataSourceScopes?: microsoft.graph.dataSourceScopes; | ||
} | ||
@@ -200,3 +200,3 @@ | ||
export interface ediscoveryCustodian { | ||
acknowledgedDateTime?: anyOffset; | ||
acknowledgedDateTime?: any; | ||
email?: string; | ||
@@ -249,3 +249,3 @@ } | ||
displayName?: string; | ||
lastModifiedDateTime?: anyOffset; | ||
lastModifiedDateTime?: any; | ||
} | ||
@@ -264,3 +264,3 @@ | ||
export interface ediscoveryReviewTag { | ||
childSelectability?: microsoft.graph.security.childSelectability; | ||
childSelectability?: microsoft.graph.childSelectability; | ||
} | ||
@@ -307,3 +307,3 @@ | ||
export interface unifiedGroupSource { | ||
includedSources?: microsoft.graph.security.sourceType; | ||
includedSources?: microsoft.graph.sourceType; | ||
} | ||
@@ -323,3 +323,3 @@ | ||
email?: string; | ||
includedSources?: microsoft.graph.security.sourceType; | ||
includedSources?: microsoft.graph.sourceType; | ||
siteWebUrl?: string; | ||
@@ -326,0 +326,0 @@ } |
export * from "./enumtypes"; | ||
export * from "./entitytypes"; | ||
@@ -4,0 +3,0 @@ export * from "./complextypes"; |
import { Base } from "../../../"; | ||
import { graph } from "../../../"; | ||
import { graph } from "../../"; | ||
import { microsoft } from "../../../"; | ||
@@ -24,7 +24,7 @@ | ||
export interface group { | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
description?: string; | ||
displayName?: string; | ||
parentSiteId?: string; | ||
scope?: microsoft.graph.termStore.termGroupScope; | ||
scope?: microsoft.graph.termGroupScope; | ||
} | ||
@@ -43,3 +43,3 @@ | ||
export interface set { | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
description?: string; | ||
@@ -61,3 +61,3 @@ localizedNames?: { results: Array<microsoft.graph.termStore.localizedName> }; | ||
export interface relation { | ||
relationship?: microsoft.graph.termStore.relationType; | ||
relationship?: microsoft.graph.relationType; | ||
} | ||
@@ -76,6 +76,6 @@ | ||
export interface term { | ||
createdDateTime?: anyOffset; | ||
createdDateTime?: any; | ||
descriptions?: { results: Array<microsoft.graph.termStore.localizedDescription> }; | ||
labels?: { results: Array<microsoft.graph.termStore.localizedLabel> }; | ||
lastModifiedDateTime?: anyOffset; | ||
lastModifiedDateTime?: any; | ||
properties?: { results: Array<graph.keyValue> }; | ||
@@ -82,0 +82,0 @@ } |
export * from "./enumtypes"; | ||
export * from "./entitytypes"; | ||
export * from "./complextypes"; |
84
main.js
@@ -225,3 +225,11 @@ let fs = require("fs"); | ||
// Method to convert the type | ||
function getType(type = "any") { | ||
function getType(type = "any", enumInterfaces) { | ||
if (type.indexOf("microsoft.graph") >= 0) { | ||
let typeInfo = type.split('.'); | ||
let typeName = typeInfo[typeInfo.length - 1]; | ||
if (enumInterfaces[typeName]) { | ||
return "microsoft.graph." + typeName; | ||
} | ||
} | ||
// Return the type | ||
@@ -232,5 +240,7 @@ return type | ||
.replace(/Edm\.Byte/, 'any') | ||
.replace(/Edm\.DateTimeOffset/, 'any') | ||
.replace(/Edm\.DateTime/, 'any') | ||
.replace(/Edm\.Decimal/, 'number') | ||
.replace(/Edm\.Double/, 'number') | ||
.replace(/Edm\.Duration/, 'number') | ||
.replace(/Edm\.Guid/, 'any') | ||
@@ -259,2 +269,8 @@ .replace(/Edm\.Int16/, 'number') | ||
// See if this is the graph | ||
if (root == "graph") { | ||
// Update the name | ||
dirName = dirName.replace("microsoft.graph", "microsoftgraph"); | ||
} | ||
// Build the reference to the lib folder | ||
@@ -272,2 +288,4 @@ let refPath = ""; | ||
let directories = {}; | ||
let enums = {}; | ||
let enumInterfaces = {}; | ||
let methods = {}; | ||
@@ -279,2 +297,3 @@ let methodTypes = {}; | ||
let schema = schemas[i]; | ||
let isGraph = (schema.$ ? schema.$.Alias : null) == "graph"; | ||
@@ -296,2 +315,35 @@ // Ensure a namespace name exists | ||
// See if it's an enumerator | ||
if (key == "EnumType") { | ||
// Parse the enums | ||
for (let j = 0; j < value.length; j++) { | ||
let enumInfo = value[j]; | ||
let name = enumInfo.$.Name; | ||
// Add the interface and enum | ||
let enumInterface = "/** " + name + " types */\nexport type " + name + " = {\n"; | ||
let enumDef = "/** " + name + " types */\nexport const " + name + ": GraphTypes." + name + " = {\n"; | ||
// Parse the members | ||
for (let k = 0; k < enumInfo.Member.length; k++) { | ||
let member = enumInfo.Member[k]; | ||
// Add the member | ||
enumInterface += "\t" + member.$.Name + ": " + member.$.Value + ";\n" | ||
enumDef += "\t" + member.$.Name + ": " + member.$.Value + ",\n" | ||
} | ||
// Close the interface and enum | ||
enumInterface += "}\n"; | ||
enumDef += "}\n" | ||
// Add the enum | ||
enums[name] = enumDef; | ||
enumInterfaces[name] = enumInterface; | ||
} | ||
// Continue | ||
continue; | ||
} | ||
// See if this is a collection | ||
@@ -352,3 +404,3 @@ if (value.length > 0) { | ||
let name = functionInfo.$.Name[0].toLowerCase() + functionInfo.$.Name.slice(1); | ||
let returnType = getType(functionInfo.$.ReturnType); | ||
let returnType = getType(functionInfo.$.ReturnType, enumInterfaces); | ||
let parentName = functionInfo.Parameter[0].$.Type; | ||
@@ -437,5 +489,20 @@ | ||
// Create the enum definitions | ||
let enumContent = []; | ||
for (let key in enumInterfaces) { enumContent.push(enumInterfaces[key]); } | ||
fs.writeFileSync("lib/microsoft/graph/enums.d.ts", enumContent.join('\n')); | ||
// Generate the index files | ||
generateIndexFiles("lib"); | ||
// Append the export of the enums | ||
fs.appendFileSync("lib/microsoft/graph/index.d.ts", [ | ||
'export * from "./enums";' | ||
].join('\n')); | ||
// Create the graph enum types | ||
enumContent = ["import * as GraphTypes from \"./microsoft/graph/enums.d\";\n"]; | ||
for (let key in enums) { enumContent.push(enums[key]); } | ||
fs.writeFileSync("lib/enums.ts", enumContent.join('\n')); | ||
// Append the index file | ||
@@ -603,3 +670,3 @@ fs.appendFileSync("lib/index.d.ts", [ | ||
let param = methodInfo.params[j].$; | ||
let paramType = getType(param.Type); | ||
let paramType = getType(param.Type, enumInterfaces); | ||
@@ -611,7 +678,7 @@ // Update the reference | ||
// Add the parameter | ||
params.push(param.Name + "?: " + getType(param.Type)); | ||
params.push(param.Name + "?: " + getType(param.Type, enumInterfaces)); | ||
} | ||
// Set the method type | ||
let methodType = getType(methodInfo.returnType) | ||
let methodType = getType(methodInfo.returnType, enumInterfaces) | ||
@@ -661,3 +728,3 @@ // Ensure this method isn't being overridden | ||
let param = methodInfo.params[j].$; | ||
let paramType = getType(param.Type); | ||
let paramType = getType(param.Type, enumInterfaces); | ||
@@ -691,3 +758,3 @@ // Update the reference | ||
// Get the type | ||
methodType = getType(methodInfo.returnType); | ||
methodType = getType(methodInfo.returnType, enumInterfaces); | ||
@@ -723,3 +790,3 @@ // See if this is an array | ||
// Update the type | ||
let type = getType(prop.Type); | ||
let type = getType(prop.Type, enumInterfaces); | ||
@@ -949,2 +1016,3 @@ // Update the references | ||
processMetadata(schemas); | ||
//processMetadata(graphXML["edmx:Edmx"]["edmx:DataServices"][0].Schema); | ||
}); | ||
@@ -951,0 +1019,0 @@ }); |
{ | ||
"name": "gd-sprest-def", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "TypeScript definition files generated from the $metadata REST endpoint in SharePoint.", | ||
@@ -13,3 +13,5 @@ "author": "Gunjan Datta <me@dattabase.com> (https://gunjandatta.github.io)", | ||
"scripts": { | ||
"build": "node clean.js && node main.js" | ||
"build": "node main.js", | ||
"clean": "node clean.js", | ||
"package": "npm run clean && npm run build" | ||
}, | ||
@@ -16,0 +18,0 @@ "repository": { |
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
7812069
90843
311