gd-sprest-def
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -15,12 +15,18 @@ import { IBaseExecution } from "../../base"; | ||
system: ComplexTypes.system; | ||
activities: () => IBaseExecution<activityEntity[]>; | ||
activitycounts: () => IBaseExecution<itemActivityStatEntity[]>; | ||
apps: () => IBaseExecution<driveApp[]>; | ||
activities: () => IBaseExecution<activityEntityCollection>; | ||
activitycounts: () => IBaseExecution<itemActivityStatEntityCollection>; | ||
apps: () => IBaseExecution<driveAppCollection>; | ||
commands: () => IBaseExecution<ComplexTypes.command[]>; | ||
items: () => IBaseExecution<item[]>; | ||
items: () => IBaseExecution<itemCollection>; | ||
list: () => IBaseExecution<list>; | ||
special: () => IBaseExecution<item[]>; | ||
trackedItems: () => IBaseExecution<item[]>; | ||
special: () => IBaseExecution<itemCollection>; | ||
trackedItems: () => IBaseExecution<itemCollection>; | ||
} | ||
/********************************************* | ||
* drive | ||
**********************************************/ | ||
export interface driveCollection { | ||
results: drive[]; | ||
} | ||
/********************************************* | ||
* share | ||
@@ -74,7 +80,7 @@ **********************************************/ | ||
source: ComplexTypes.driveItemSource; | ||
permissions: () => IBaseExecution<permission[]>; | ||
children: () => IBaseExecution<item[]>; | ||
subscriptions: () => IBaseExecution<subscription[]>; | ||
thumbnails: () => IBaseExecution<thumbnailSet[]>; | ||
activities: () => IBaseExecution<activityEntity[]>; | ||
permissions: () => IBaseExecution<permissionCollection>; | ||
children: () => IBaseExecution<itemCollection>; | ||
subscriptions: () => IBaseExecution<subscriptionCollection>; | ||
thumbnails: () => IBaseExecution<thumbnailSetCollection>; | ||
activities: () => IBaseExecution<activityEntityCollection>; | ||
analytics: () => IBaseExecution<analytics>; | ||
@@ -84,5 +90,11 @@ commands: () => IBaseExecution<ComplexTypes.command[]>; | ||
listItem: () => IBaseExecution<listItem>; | ||
versions: () => IBaseExecution<driveItemVersion[]>; | ||
versions: () => IBaseExecution<driveItemVersionCollection>; | ||
} | ||
/********************************************* | ||
* item | ||
**********************************************/ | ||
export interface itemCollection { | ||
results: item[]; | ||
} | ||
/********************************************* | ||
* permission | ||
@@ -102,2 +114,8 @@ **********************************************/ | ||
/********************************************* | ||
* permission | ||
**********************************************/ | ||
export interface permissionCollection { | ||
results: permission[]; | ||
} | ||
/********************************************* | ||
* subscription | ||
@@ -115,2 +133,8 @@ **********************************************/ | ||
/********************************************* | ||
* subscription | ||
**********************************************/ | ||
export interface subscriptionCollection { | ||
results: subscription[]; | ||
} | ||
/********************************************* | ||
* thumbnailSet | ||
@@ -126,2 +150,8 @@ **********************************************/ | ||
/********************************************* | ||
* thumbnailSet | ||
**********************************************/ | ||
export interface thumbnailSetCollection { | ||
results: thumbnailSet[]; | ||
} | ||
/********************************************* | ||
* activityEntity | ||
@@ -140,2 +170,8 @@ **********************************************/ | ||
/********************************************* | ||
* activityEntity | ||
**********************************************/ | ||
export interface activityEntityCollection { | ||
results: activityEntity[]; | ||
} | ||
/********************************************* | ||
* analytics | ||
@@ -171,9 +207,15 @@ **********************************************/ | ||
sharepointIds: ComplexTypes.sharepointIds; | ||
activities: () => IBaseExecution<activityEntity[]>; | ||
activities: () => IBaseExecution<activityEntityCollection>; | ||
analytics: () => IBaseExecution<analytics>; | ||
driveItem: () => IBaseExecution<item>; | ||
fields: () => IBaseExecution<fieldValueSet>; | ||
versions: () => IBaseExecution<listItemVersion[]>; | ||
versions: () => IBaseExecution<listItemVersionCollection>; | ||
} | ||
/********************************************* | ||
* listItem | ||
**********************************************/ | ||
export interface listItemCollection { | ||
results: listItem[]; | ||
} | ||
/********************************************* | ||
* fieldValueSet | ||
@@ -203,2 +245,8 @@ **********************************************/ | ||
/********************************************* | ||
* listItemVersion | ||
**********************************************/ | ||
export interface listItemVersionCollection { | ||
results: listItemVersion[]; | ||
} | ||
/********************************************* | ||
* driveItemVersion | ||
@@ -208,5 +256,11 @@ **********************************************/ | ||
size: number; | ||
streams: () => IBaseExecution<stream[]>; | ||
streams: () => IBaseExecution<streamCollection>; | ||
} | ||
/********************************************* | ||
* driveItemVersion | ||
**********************************************/ | ||
export interface driveItemVersionCollection { | ||
results: driveItemVersion[]; | ||
} | ||
/********************************************* | ||
* stream | ||
@@ -222,2 +276,8 @@ **********************************************/ | ||
/********************************************* | ||
* stream | ||
**********************************************/ | ||
export interface streamCollection { | ||
results: stream[]; | ||
} | ||
/********************************************* | ||
* columnDefinition | ||
@@ -250,2 +310,8 @@ **********************************************/ | ||
/********************************************* | ||
* columnDefinition | ||
**********************************************/ | ||
export interface columnDefinitionCollection { | ||
results: columnDefinition[]; | ||
} | ||
/********************************************* | ||
* contentType | ||
@@ -264,5 +330,11 @@ **********************************************/ | ||
sealed: boolean; | ||
columnLinks: () => IBaseExecution<columnLink[]>; | ||
columnLinks: () => IBaseExecution<columnLinkCollection>; | ||
} | ||
/********************************************* | ||
* contentType | ||
**********************************************/ | ||
export interface contentTypeCollection { | ||
results: contentType[]; | ||
} | ||
/********************************************* | ||
* columnLink | ||
@@ -276,2 +348,8 @@ **********************************************/ | ||
/********************************************* | ||
* columnLink | ||
**********************************************/ | ||
export interface columnLinkCollection { | ||
results: columnLink[]; | ||
} | ||
/********************************************* | ||
* itemActivityStatEntity | ||
@@ -286,2 +364,8 @@ **********************************************/ | ||
/********************************************* | ||
* itemActivityStatEntity | ||
**********************************************/ | ||
export interface itemActivityStatEntityCollection { | ||
results: itemActivityStatEntity[]; | ||
} | ||
/********************************************* | ||
* driveApp | ||
@@ -293,5 +377,11 @@ **********************************************/ | ||
id: string; | ||
actions: () => IBaseExecution<driveAppAction[]>; | ||
actions: () => IBaseExecution<driveAppActionCollection>; | ||
} | ||
/********************************************* | ||
* driveApp | ||
**********************************************/ | ||
export interface driveAppCollection { | ||
results: driveApp[]; | ||
} | ||
/********************************************* | ||
* driveAppAction | ||
@@ -309,2 +399,8 @@ **********************************************/ | ||
/********************************************* | ||
* driveAppAction | ||
**********************************************/ | ||
export interface driveAppActionCollection { | ||
results: driveAppAction[]; | ||
} | ||
/********************************************* | ||
* list | ||
@@ -317,9 +413,15 @@ **********************************************/ | ||
system: ComplexTypes.system; | ||
activities: () => IBaseExecution<activityEntity[]>; | ||
columns: () => IBaseExecution<columnDefinition[]>; | ||
contentTypes: () => IBaseExecution<contentType[]>; | ||
activities: () => IBaseExecution<activityEntityCollection>; | ||
columns: () => IBaseExecution<columnDefinitionCollection>; | ||
contentTypes: () => IBaseExecution<contentTypeCollection>; | ||
drive: () => IBaseExecution<drive>; | ||
items: () => IBaseExecution<listItem[]>; | ||
items: () => IBaseExecution<listItemCollection>; | ||
} | ||
/********************************************* | ||
* list | ||
**********************************************/ | ||
export interface listCollection { | ||
results: list[]; | ||
} | ||
/********************************************* | ||
* baseItem | ||
@@ -341,2 +443,8 @@ **********************************************/ | ||
/********************************************* | ||
* baseItem | ||
**********************************************/ | ||
export interface baseItemCollection { | ||
results: baseItem[]; | ||
} | ||
/********************************************* | ||
* site | ||
@@ -350,11 +458,17 @@ **********************************************/ | ||
analytics: () => IBaseExecution<analytics>; | ||
columns: () => IBaseExecution<columnDefinition[]>; | ||
contentTypes: () => IBaseExecution<contentType[]>; | ||
columns: () => IBaseExecution<columnDefinitionCollection>; | ||
contentTypes: () => IBaseExecution<contentTypeCollection>; | ||
drive: () => IBaseExecution<drive>; | ||
drives: () => IBaseExecution<drive[]>; | ||
items: () => IBaseExecution<baseItem[]>; | ||
lists: () => IBaseExecution<list[]>; | ||
sites: () => IBaseExecution<site[]>; | ||
drives: () => IBaseExecution<driveCollection>; | ||
items: () => IBaseExecution<baseItemCollection>; | ||
lists: () => IBaseExecution<listCollection>; | ||
sites: () => IBaseExecution<siteCollection>; | ||
} | ||
/********************************************* | ||
* site | ||
**********************************************/ | ||
export interface siteCollection { | ||
results: site[]; | ||
} | ||
/********************************************* | ||
* sharePoint | ||
@@ -365,3 +479,3 @@ **********************************************/ | ||
site: () => IBaseExecution<site>; | ||
sites: () => IBaseExecution<site[]>; | ||
sites: () => IBaseExecution<siteCollection>; | ||
} |
32
main.js
@@ -292,2 +292,3 @@ let fs = require("fs"); | ||
function processGraph(schemas) { | ||
let collections = {}; | ||
let complexTypes = {}; | ||
@@ -413,2 +414,9 @@ let endPoints = {}; | ||
methods.push({ name, returnType }); | ||
// See if this is a collection | ||
if (returnType.startsWith("Collection(")) { | ||
let collectionType = returnType.replace("Collection(", "").replace(")", ""); | ||
collectionType = collectionType.split('.')[1]; | ||
collections[collectionType] = returnType; | ||
} | ||
} | ||
@@ -506,3 +514,3 @@ | ||
// Method to get the type | ||
let getGraphType = (returnType = "") => { | ||
let getGraphType = (returnType = "", isMethod = false) => { | ||
// See if the return type is in not an Edm | ||
@@ -563,4 +571,6 @@ if (returnType.indexOf("graph." == 0)) { | ||
// Update the collection | ||
isCollection ? returnType += "[]" : null; | ||
// See if this is a collection | ||
if (isCollection) { | ||
returnType += isMethod ? "Collection" : "[]"; | ||
} | ||
} | ||
@@ -669,3 +679,3 @@ | ||
// Add the method | ||
methods.push("\t" + method.name + ": () => IBaseExecution<" + getGraphType(method.returnType) + ">;"); | ||
methods.push("\t" + method.name + ": () => IBaseExecution<" + getGraphType(method.returnType, true) + ">;"); | ||
} | ||
@@ -681,2 +691,12 @@ | ||
}`); | ||
// See if there is a collection required for this | ||
if(collections[name]) { | ||
content.push(`/********************************************* | ||
* ${name} | ||
**********************************************/ | ||
export interface ${name}Collection { | ||
results: ${name}[]; | ||
}`); | ||
} | ||
} | ||
@@ -1137,6 +1157,2 @@ fs.writeFileSync("lib/microsoft/graph/entityTypes.d.ts", content.join('\n').replace(/EntityTypes./g, "")); | ||
if (propName == "Cells") { | ||
console.log(propName); | ||
console.log(type); | ||
} | ||
// See if this type is a collection and this is the complex or entity types | ||
@@ -1143,0 +1159,0 @@ if ((filename == "ComplexTypes" || filename == "EntityTypes") && /^Array\<.*\>$/.test(type)) { |
{ | ||
"name": "gd-sprest-def", | ||
"version": "1.3.6", | ||
"version": "1.3.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)", |
6084759
66551