gd-sprest-def 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,24 @@
1
1
  import { IBaseExecution } from "../../base";
2
+ import * as EntityTypes from "./entityTypes.d";
3
+
2
4
  /*********************************************
3
5
  * invitations
4
6
  **********************************************/
5
7
  export interface invitations extends IBaseExecution<EntityTypes.invitation> {
6
- invitedUser: () => IBaseExecution<users>;
8
+ invitedUser: () => IBaseExecution<EntityTypes.user[]>;
7
9
  }
8
10
  /*********************************************
9
11
  * users
10
12
  **********************************************/
11
13
  export interface users extends IBaseExecution<EntityTypes.user> {
12
- createdObjects: () => IBaseExecution<directoryObjects>;
13
- directReports: () => IBaseExecution<directoryObjects>;
14
- manager: () => IBaseExecution<directoryObjects>;
15
- memberOf: () => IBaseExecution<directoryObjects>;
16
- ownedDevices: () => IBaseExecution<directoryObjects>;
17
- ownedObjects: () => IBaseExecution<directoryObjects>;
18
- registeredDevices: () => IBaseExecution<directoryObjects>;
19
- transitiveMemberOf: () => IBaseExecution<directoryObjects>;
14
+ createdObjects: () => IBaseExecution<EntityTypes.directoryObject[]>;
15
+ directReports: () => IBaseExecution<EntityTypes.directoryObject[]>;
16
+ manager: () => IBaseExecution<EntityTypes.directoryObject[]>;
17
+ memberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
18
+ ownedDevices: () => IBaseExecution<EntityTypes.directoryObject[]>;
19
+ ownedObjects: () => IBaseExecution<EntityTypes.directoryObject[]>;
20
+ registeredDevices: () => IBaseExecution<EntityTypes.directoryObject[]>;
21
+ transitiveMemberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
20
22
  }
21
23
  /*********************************************
22
24
  * applicationTemplates
@@ -40,8 +42,8 @@ export interface identityProviders extends IBaseExecution<EntityTypes.identityPr
40
42
  * applications
41
43
  **********************************************/
42
44
  export interface applications extends IBaseExecution<EntityTypes.application> {
43
- createdOnBehalfOf: () => IBaseExecution<directoryObjects>;
44
- owners: () => IBaseExecution<directoryObjects>;
45
+ createdOnBehalfOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
46
+ owners: () => IBaseExecution<EntityTypes.directoryObject[]>;
45
47
  }
46
48
  /*********************************************
47
49
  * certificateBasedAuthConfiguration
@@ -53,10 +55,10 @@ export interface certificateBasedAuthConfiguration extends IBaseExecution<Entity
53
55
  * contacts
54
56
  **********************************************/
55
57
  export interface contacts extends IBaseExecution<EntityTypes.orgContact> {
56
- directReports: () => IBaseExecution<directoryObjects>;
57
- manager: () => IBaseExecution<directoryObjects>;
58
- memberOf: () => IBaseExecution<directoryObjects>;
59
- transitiveMemberOf: () => IBaseExecution<directoryObjects>;
58
+ directReports: () => IBaseExecution<EntityTypes.directoryObject[]>;
59
+ manager: () => IBaseExecution<EntityTypes.directoryObject[]>;
60
+ memberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
61
+ transitiveMemberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
60
62
  }
61
63
  /*********************************************
62
64
  * contracts
@@ -68,9 +70,9 @@ export interface contracts extends IBaseExecution<EntityTypes.contract> {
68
70
  * devices
69
71
  **********************************************/
70
72
  export interface devices extends IBaseExecution<EntityTypes.device> {
71
- registeredOwners: () => IBaseExecution<directoryObjects>;
72
- registeredUsers: () => IBaseExecution<directoryObjects>;
73
- transitiveMemberOf: () => IBaseExecution<directoryObjects>;
73
+ registeredOwners: () => IBaseExecution<EntityTypes.directoryObject[]>;
74
+ registeredUsers: () => IBaseExecution<EntityTypes.directoryObject[]>;
75
+ transitiveMemberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
74
76
  }
75
77
  /*********************************************
76
78
  * directoryObjects
@@ -82,7 +84,7 @@ export interface directoryObjects extends IBaseExecution<EntityTypes.directoryOb
82
84
  * directoryRoles
83
85
  **********************************************/
84
86
  export interface directoryRoles extends IBaseExecution<EntityTypes.directoryRole> {
85
- members: () => IBaseExecution<directoryObjects>;
87
+ members: () => IBaseExecution<EntityTypes.directoryObject[]>;
86
88
  }
87
89
  /*********************************************
88
90
  * directoryRoleTemplates
@@ -100,18 +102,18 @@ export interface domainDnsRecords extends IBaseExecution<EntityTypes.domainDnsRe
100
102
  * domains
101
103
  **********************************************/
102
104
  export interface domains extends IBaseExecution<EntityTypes.domain> {
103
- domainNameReferences: () => IBaseExecution<directoryObjects>;
105
+ domainNameReferences: () => IBaseExecution<EntityTypes.directoryObject[]>;
104
106
  }
105
107
  /*********************************************
106
108
  * groups
107
109
  **********************************************/
108
110
  export interface groups extends IBaseExecution<EntityTypes.group> {
109
- createdOnBehalfOf: () => IBaseExecution<directoryObjects>;
110
- memberOf: () => IBaseExecution<directoryObjects>;
111
- members: () => IBaseExecution<directoryObjects>;
112
- owners: () => IBaseExecution<directoryObjects>;
113
- transitiveMemberOf: () => IBaseExecution<directoryObjects>;
114
- transitiveMembers: () => IBaseExecution<directoryObjects>;
111
+ createdOnBehalfOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
112
+ memberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
113
+ members: () => IBaseExecution<EntityTypes.directoryObject[]>;
114
+ owners: () => IBaseExecution<EntityTypes.directoryObject[]>;
115
+ transitiveMemberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
116
+ transitiveMembers: () => IBaseExecution<EntityTypes.directoryObject[]>;
115
117
  }
116
118
  /*********************************************
117
119
  * groupSettings
@@ -159,12 +161,12 @@ export interface scopedRoleMemberships extends IBaseExecution<EntityTypes.scoped
159
161
  * servicePrincipals
160
162
  **********************************************/
161
163
  export interface servicePrincipals extends IBaseExecution<EntityTypes.servicePrincipal> {
162
- createdObjects: () => IBaseExecution<directoryObjects>;
163
- memberOf: () => IBaseExecution<directoryObjects>;
164
+ createdObjects: () => IBaseExecution<EntityTypes.directoryObject[]>;
165
+ memberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
164
166
  oauth2PermissionGrants: () => IBaseExecution<oauth2PermissionGrants>;
165
- ownedObjects: () => IBaseExecution<directoryObjects>;
166
- owners: () => IBaseExecution<directoryObjects>;
167
- transitiveMemberOf: () => IBaseExecution<directoryObjects>;
167
+ ownedObjects: () => IBaseExecution<EntityTypes.directoryObject[]>;
168
+ owners: () => IBaseExecution<EntityTypes.directoryObject[]>;
169
+ transitiveMemberOf: () => IBaseExecution<EntityTypes.directoryObject[]>;
168
170
  }
169
171
  /*********************************************
170
172
  * subscribedSkus
@@ -194,10 +196,10 @@ export interface shares extends IBaseExecution<EntityTypes.sharedDriveItem> {
194
196
  * sites
195
197
  **********************************************/
196
198
  export interface sites extends IBaseExecution<EntityTypes.site> {
197
- parentTerm: () => IBaseExecution<terms>;
198
- termSet: () => IBaseExecution<sets>;
199
- sharedColumns: () => IBaseExecution<columns>;
200
- welcomePageColumns: () => IBaseExecution<columns>;
199
+ parentTerm: () => IBaseExecution<EntityTypes.term[]>;
200
+ termSet: () => IBaseExecution<EntityTypes.set[]>;
201
+ sharedColumns: () => IBaseExecution<ComplexTypes.columnDefinition[]>;
202
+ welcomePageColumns: () => IBaseExecution<ComplexTypes.columnDefinition[]>;
201
203
  }
202
204
  /*********************************************
203
205
  * schemaExtensions
@@ -251,8 +253,8 @@ export interface chats extends IBaseExecution<EntityTypes.chat> {
251
253
  * teams
252
254
  **********************************************/
253
255
  export interface teams extends IBaseExecution<EntityTypes.team> {
254
- group: () => IBaseExecution<groups>;
255
- template: () => IBaseExecution<teamsTemplates>;
256
+ group: () => IBaseExecution<EntityTypes.group[]>;
257
+ template: () => IBaseExecution<EntityTypes.teamsTemplate[]>;
256
258
  }
257
259
  /*********************************************
258
260
  * teamsTemplates
@@ -1,4 +1,5 @@
1
- export * as API from "./api";
2
- export * as ComplexTypes from "./complexTypes";
3
- export * from "./entityTypes";
4
- export * as Enums from "./enumTypes";
1
+ import * as API from "./api";
2
+ import * as ComplexTypes from "./complexTypes";
3
+ import * as Enums from "./enumTypes";
4
+ export { API, ComplexTypes, Enums }
5
+ export * from "./entityTypes";
package/main.js CHANGED
@@ -74,8 +74,8 @@ function applyMethodsToDirectories(methods, directories) {
74
74
  let idx = name.lastIndexOf('.');
75
75
 
76
76
  // Set the lib and obj name
77
- let lib = name.substr(0, idx);
78
- let obj = name.substr(idx + 1);
77
+ let lib = name.substring(0, idx);
78
+ let obj = name.substring(idx + 1);
79
79
 
80
80
  // See if a file name exists for this object
81
81
  if (directories[lib] && directories[lib].EntityTypes && directories[lib].EntityTypes[obj]) {
@@ -267,7 +267,7 @@ function updateReferences(fileImports, dirName, type) {
267
267
  if (type && type.indexOf('.') > 0) {
268
268
  // Get the last index of it
269
269
  let refType = type.replace(/^Array\<|\>$/g, '');
270
- refType = refType.substr(0, refType.lastIndexOf('.'));
270
+ refType = refType.substring(0, refType.lastIndexOf('.'));
271
271
 
272
272
  // Set the root namespace
273
273
  let root = refType.split('.')[0];
@@ -400,7 +400,6 @@ function processGraph(schemas) {
400
400
  returnType = returnTypeInfo[returnTypeInfo.length - 1];
401
401
  }
402
402
 
403
-
404
403
  // Add the method
405
404
  methods.push({ name, returnType });
406
405
  }
@@ -507,7 +506,7 @@ function processGraph(schemas) {
507
506
  let name2 = null;
508
507
  if (!isCollection && name[name.length - 1] == "s") {
509
508
  // Set the name
510
- name2 = name.substring(name.length - 1);
509
+ name2 = name.substring(0, name.length - 1);
511
510
  }
512
511
 
513
512
  // See if it's a complex type
@@ -542,6 +541,14 @@ function processGraph(schemas) {
542
541
  else if (info[0] == "Edm") {
543
542
  returnType = getType(returnType);
544
543
  }
544
+ // Else, see if this is a column
545
+ else if (name == "column") {
546
+ returnType = "ComplexTypes.columnDefinition";
547
+ }
548
+ // Else, see if this is a column array
549
+ else if (name == "columns") {
550
+ returnType = "ComplexTypes.columnDefinition[]";
551
+ }
545
552
 
546
553
  // Update the collection
547
554
  isCollection ? returnType += "[]" : null;
@@ -555,7 +562,10 @@ function processGraph(schemas) {
555
562
  if (fs.existsSync("lib/microsoft/Graph") == false) { fs.mkdirSync("lib/microsoft/Graph"); }
556
563
 
557
564
  // Create the endpoints
558
- let content = ["import { IBaseExecution } from \"../../base\";"];
565
+ let content = [
566
+ "import { IBaseExecution } from \"../../base\";",
567
+ "import * as EntityTypes from \"./entityTypes.d\";\n"
568
+ ];
559
569
  for (let name in endPoints) {
560
570
  let endPoint = endPoints[name];
561
571
 
@@ -583,10 +593,11 @@ ${methods.join('\n')}
583
593
 
584
594
  // Append the export of the enums
585
595
  fs.appendFileSync("lib/microsoft/graph/index.d.ts", [
586
- 'export * as API from "./api";',
587
- 'export * as ComplexTypes from "./complexTypes";',
596
+ 'import * as API from "./api";',
597
+ 'import * as ComplexTypes from "./complexTypes";',
598
+ 'import * as Enums from "./enumTypes";',
599
+ 'export { API, ComplexTypes, Enums }',
588
600
  'export * from "./entityTypes";',
589
- 'export * as Enums from "./enumTypes";'
590
601
  ].join('\n'));
591
602
 
592
603
  // Append the graph endpoint
@@ -889,7 +900,7 @@ function processREST(schemas) {
889
900
  else if (hasMethods[endpoint.ReturnType]) {
890
901
  // Update the return type
891
902
  let idx = endpoint.ReturnType.lastIndexOf('.');
892
- endpoint.ReturnType = endpoint.ReturnType.substr(0, idx) + '.I' + endpoint.ReturnType.substr(idx + 1);
903
+ endpoint.ReturnType = endpoint.ReturnType.substring(0, idx) + '.I' + endpoint.ReturnType.substring(idx + 1);
893
904
  }
894
905
 
895
906
  // Update the imports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-sprest-def",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript definition files generated from the $metadata REST endpoint in SharePoint.",
5
5
  "author": "Gunjan Datta <me@dattabase.com> (https://gunjandatta.github.io)",
6
6
  "license": "MIT",