gd-sprest-def 1.3.6 → 1.3.7

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.
@@ -12,14 +12,20 @@ export interface drive {
12
12
  quota: ComplexTypes.quota;
13
13
  sharePointIds: ComplexTypes.sharepointIds;
14
14
  system: ComplexTypes.system;
15
- activities: () => IBaseExecution<activityEntity[]>;
16
- activitycounts: () => IBaseExecution<itemActivityStatEntity[]>;
17
- apps: () => IBaseExecution<driveApp[]>;
15
+ activities: () => IBaseExecution<activityEntityCollection>;
16
+ activitycounts: () => IBaseExecution<itemActivityStatEntityCollection>;
17
+ apps: () => IBaseExecution<driveAppCollection>;
18
18
  commands: () => IBaseExecution<ComplexTypes.command[]>;
19
- items: () => IBaseExecution<item[]>;
19
+ items: () => IBaseExecution<itemCollection>;
20
20
  list: () => IBaseExecution<list>;
21
- special: () => IBaseExecution<item[]>;
22
- trackedItems: () => IBaseExecution<item[]>;
21
+ special: () => IBaseExecution<itemCollection>;
22
+ trackedItems: () => IBaseExecution<itemCollection>;
23
+ }
24
+ /*********************************************
25
+ * drive
26
+ **********************************************/
27
+ export interface driveCollection {
28
+ results: drive[];
23
29
  }
24
30
  /*********************************************
25
31
  * share
@@ -70,16 +76,22 @@ export interface item {
70
76
  formats: ComplexTypes.formats;
71
77
  media: ComplexTypes.media;
72
78
  source: ComplexTypes.driveItemSource;
73
- permissions: () => IBaseExecution<permission[]>;
74
- children: () => IBaseExecution<item[]>;
75
- subscriptions: () => IBaseExecution<subscription[]>;
76
- thumbnails: () => IBaseExecution<thumbnailSet[]>;
77
- activities: () => IBaseExecution<activityEntity[]>;
79
+ permissions: () => IBaseExecution<permissionCollection>;
80
+ children: () => IBaseExecution<itemCollection>;
81
+ subscriptions: () => IBaseExecution<subscriptionCollection>;
82
+ thumbnails: () => IBaseExecution<thumbnailSetCollection>;
83
+ activities: () => IBaseExecution<activityEntityCollection>;
78
84
  analytics: () => IBaseExecution<analytics>;
79
85
  commands: () => IBaseExecution<ComplexTypes.command[]>;
80
86
  featureStatus: () => IBaseExecution<featureStatus>;
81
87
  listItem: () => IBaseExecution<listItem>;
82
- versions: () => IBaseExecution<driveItemVersion[]>;
88
+ versions: () => IBaseExecution<driveItemVersionCollection>;
89
+ }
90
+ /*********************************************
91
+ * item
92
+ **********************************************/
93
+ export interface itemCollection {
94
+ results: item[];
83
95
  }
84
96
  /*********************************************
85
97
  * permission
@@ -96,6 +108,12 @@ export interface permission {
96
108
 
97
109
  }
98
110
  /*********************************************
111
+ * permission
112
+ **********************************************/
113
+ export interface permissionCollection {
114
+ results: permission[];
115
+ }
116
+ /*********************************************
99
117
  * subscription
100
118
  **********************************************/
101
119
  export interface subscription {
@@ -108,6 +126,12 @@ export interface subscription {
108
126
 
109
127
  }
110
128
  /*********************************************
129
+ * subscription
130
+ **********************************************/
131
+ export interface subscriptionCollection {
132
+ results: subscription[];
133
+ }
134
+ /*********************************************
111
135
  * thumbnailSet
112
136
  **********************************************/
113
137
  export interface thumbnailSet {
@@ -118,6 +142,12 @@ export interface thumbnailSet {
118
142
 
119
143
  }
120
144
  /*********************************************
145
+ * thumbnailSet
146
+ **********************************************/
147
+ export interface thumbnailSetCollection {
148
+ results: thumbnailSet[];
149
+ }
150
+ /*********************************************
121
151
  * activityEntity
122
152
  **********************************************/
123
153
  export interface activityEntity {
@@ -131,6 +161,12 @@ export interface activityEntity {
131
161
  listItem: () => IBaseExecution<listItem>;
132
162
  }
133
163
  /*********************************************
164
+ * activityEntity
165
+ **********************************************/
166
+ export interface activityEntityCollection {
167
+ results: activityEntity[];
168
+ }
169
+ /*********************************************
134
170
  * analytics
135
171
  **********************************************/
136
172
  export interface analytics {
@@ -161,11 +197,17 @@ export interface featureStatus {
161
197
  export interface listItem extends baseItem {
162
198
  contentType: ComplexTypes.contentTypeFacet;
163
199
  sharepointIds: ComplexTypes.sharepointIds;
164
- activities: () => IBaseExecution<activityEntity[]>;
200
+ activities: () => IBaseExecution<activityEntityCollection>;
165
201
  analytics: () => IBaseExecution<analytics>;
166
202
  driveItem: () => IBaseExecution<item>;
167
203
  fields: () => IBaseExecution<fieldValueSet>;
168
- versions: () => IBaseExecution<listItemVersion[]>;
204
+ versions: () => IBaseExecution<listItemVersionCollection>;
205
+ }
206
+ /*********************************************
207
+ * listItem
208
+ **********************************************/
209
+ export interface listItemCollection {
210
+ results: listItem[];
169
211
  }
170
212
  /*********************************************
171
213
  * fieldValueSet
@@ -192,11 +234,23 @@ export interface listItemVersion extends baseItemVersion {
192
234
  fields: () => IBaseExecution<fieldValueSet>;
193
235
  }
194
236
  /*********************************************
237
+ * listItemVersion
238
+ **********************************************/
239
+ export interface listItemVersionCollection {
240
+ results: listItemVersion[];
241
+ }
242
+ /*********************************************
195
243
  * driveItemVersion
196
244
  **********************************************/
197
245
  export interface driveItemVersion extends baseItemVersion {
198
246
  size: number;
199
- streams: () => IBaseExecution<stream[]>;
247
+ streams: () => IBaseExecution<streamCollection>;
248
+ }
249
+ /*********************************************
250
+ * driveItemVersion
251
+ **********************************************/
252
+ export interface driveItemVersionCollection {
253
+ results: driveItemVersion[];
200
254
  }
201
255
  /*********************************************
202
256
  * stream
@@ -209,6 +263,12 @@ export interface stream {
209
263
 
210
264
  }
211
265
  /*********************************************
266
+ * stream
267
+ **********************************************/
268
+ export interface streamCollection {
269
+ results: stream[];
270
+ }
271
+ /*********************************************
212
272
  * columnDefinition
213
273
  **********************************************/
214
274
  export interface columnDefinition {
@@ -236,6 +296,12 @@ export interface columnDefinition {
236
296
 
237
297
  }
238
298
  /*********************************************
299
+ * columnDefinition
300
+ **********************************************/
301
+ export interface columnDefinitionCollection {
302
+ results: columnDefinition[];
303
+ }
304
+ /*********************************************
239
305
  * contentType
240
306
  **********************************************/
241
307
  export interface contentType {
@@ -249,7 +315,13 @@ export interface contentType {
249
315
  parentId: string;
250
316
  readOnly: boolean;
251
317
  sealed: boolean;
252
- columnLinks: () => IBaseExecution<columnLink[]>;
318
+ columnLinks: () => IBaseExecution<columnLinkCollection>;
319
+ }
320
+ /*********************************************
321
+ * contentType
322
+ **********************************************/
323
+ export interface contentTypeCollection {
324
+ results: contentType[];
253
325
  }
254
326
  /*********************************************
255
327
  * columnLink
@@ -260,6 +332,12 @@ export interface columnLink {
260
332
 
261
333
  }
262
334
  /*********************************************
335
+ * columnLink
336
+ **********************************************/
337
+ export interface columnLinkCollection {
338
+ results: columnLink[];
339
+ }
340
+ /*********************************************
263
341
  * itemActivityStatEntity
264
342
  **********************************************/
265
343
  export interface itemActivityStatEntity {
@@ -269,13 +347,25 @@ export interface itemActivityStatEntity {
269
347
 
270
348
  }
271
349
  /*********************************************
350
+ * itemActivityStatEntity
351
+ **********************************************/
352
+ export interface itemActivityStatEntityCollection {
353
+ results: itemActivityStatEntity[];
354
+ }
355
+ /*********************************************
272
356
  * driveApp
273
357
  **********************************************/
274
358
  export interface driveApp {
275
359
  application: ComplexTypes.identity;
276
360
  fileHandler: ComplexTypes.fileHandler;
277
361
  id: string;
278
- actions: () => IBaseExecution<driveAppAction[]>;
362
+ actions: () => IBaseExecution<driveAppActionCollection>;
363
+ }
364
+ /*********************************************
365
+ * driveApp
366
+ **********************************************/
367
+ export interface driveAppCollection {
368
+ results: driveApp[];
279
369
  }
280
370
  /*********************************************
281
371
  * driveAppAction
@@ -290,6 +380,12 @@ export interface driveAppAction {
290
380
 
291
381
  }
292
382
  /*********************************************
383
+ * driveAppAction
384
+ **********************************************/
385
+ export interface driveAppActionCollection {
386
+ results: driveAppAction[];
387
+ }
388
+ /*********************************************
293
389
  * list
294
390
  **********************************************/
295
391
  export interface list extends baseItem {
@@ -297,11 +393,17 @@ export interface list extends baseItem {
297
393
  list: ComplexTypes.listInfo;
298
394
  sharepointIds: ComplexTypes.sharepointIds;
299
395
  system: ComplexTypes.system;
300
- activities: () => IBaseExecution<activityEntity[]>;
301
- columns: () => IBaseExecution<columnDefinition[]>;
302
- contentTypes: () => IBaseExecution<contentType[]>;
396
+ activities: () => IBaseExecution<activityEntityCollection>;
397
+ columns: () => IBaseExecution<columnDefinitionCollection>;
398
+ contentTypes: () => IBaseExecution<contentTypeCollection>;
303
399
  drive: () => IBaseExecution<drive>;
304
- items: () => IBaseExecution<listItem[]>;
400
+ items: () => IBaseExecution<listItemCollection>;
401
+ }
402
+ /*********************************************
403
+ * list
404
+ **********************************************/
405
+ export interface listCollection {
406
+ results: list[];
305
407
  }
306
408
  /*********************************************
307
409
  * baseItem
@@ -320,6 +422,12 @@ export interface baseItem {
320
422
 
321
423
  }
322
424
  /*********************************************
425
+ * baseItem
426
+ **********************************************/
427
+ export interface baseItemCollection {
428
+ results: baseItem[];
429
+ }
430
+ /*********************************************
323
431
  * site
324
432
  **********************************************/
325
433
  export interface site extends baseItem {
@@ -328,13 +436,19 @@ export interface site extends baseItem {
328
436
  siteCollection: ComplexTypes.siteCollection;
329
437
  title: string;
330
438
  analytics: () => IBaseExecution<analytics>;
331
- columns: () => IBaseExecution<columnDefinition[]>;
332
- contentTypes: () => IBaseExecution<contentType[]>;
439
+ columns: () => IBaseExecution<columnDefinitionCollection>;
440
+ contentTypes: () => IBaseExecution<contentTypeCollection>;
333
441
  drive: () => IBaseExecution<drive>;
334
- drives: () => IBaseExecution<drive[]>;
335
- items: () => IBaseExecution<baseItem[]>;
336
- lists: () => IBaseExecution<list[]>;
337
- sites: () => IBaseExecution<site[]>;
442
+ drives: () => IBaseExecution<driveCollection>;
443
+ items: () => IBaseExecution<baseItemCollection>;
444
+ lists: () => IBaseExecution<listCollection>;
445
+ sites: () => IBaseExecution<siteCollection>;
446
+ }
447
+ /*********************************************
448
+ * site
449
+ **********************************************/
450
+ export interface siteCollection {
451
+ results: site[];
338
452
  }
339
453
  /*********************************************
340
454
  * sharePoint
@@ -342,5 +456,5 @@ export interface site extends baseItem {
342
456
  export interface sharePoint {
343
457
 
344
458
  site: () => IBaseExecution<site>;
345
- sites: () => IBaseExecution<site[]>;
459
+ sites: () => IBaseExecution<siteCollection>;
346
460
  }
package/main.js CHANGED
@@ -289,6 +289,7 @@ function updateReferences(fileImports, dirName, type) {
289
289
 
290
290
  // Process the Graph metadata
291
291
  function processGraph(schemas) {
292
+ let collections = {};
292
293
  let complexTypes = {};
293
294
  let endPoints = {};
294
295
  let enums = {};
@@ -409,6 +410,13 @@ function processGraph(schemas) {
409
410
 
410
411
  // Add the method
411
412
  methods.push({ name, returnType });
413
+
414
+ // See if this is a collection
415
+ if (returnType.startsWith("Collection(")) {
416
+ let collectionType = returnType.replace("Collection(", "").replace(")", "");
417
+ collectionType = collectionType.split('.')[1];
418
+ collections[collectionType] = returnType;
419
+ }
412
420
  }
413
421
 
414
422
  // Add the entity type
@@ -501,7 +509,7 @@ function processGraph(schemas) {
501
509
  }
502
510
 
503
511
  // Method to get the type
504
- let getGraphType = (returnType = "") => {
512
+ let getGraphType = (returnType = "", isMethod = false) => {
505
513
  // See if the return type is in not an Edm
506
514
  if (returnType.indexOf("graph." == 0)) {
507
515
  // Set the return type information
@@ -557,8 +565,10 @@ function processGraph(schemas) {
557
565
  returnType = "ComplexTypes.columnDefinition[]";
558
566
  }
559
567
 
560
- // Update the collection
561
- isCollection ? returnType += "[]" : null;
568
+ // See if this is a collection
569
+ if (isCollection) {
570
+ returnType += isMethod ? "Collection" : "[]";
571
+ }
562
572
  }
563
573
 
564
574
  // Return the type
@@ -662,7 +672,7 @@ ${props.join('\n')}
662
672
  let methods = [];
663
673
  for (let method of entity.methods) {
664
674
  // Add the method
665
- methods.push("\t" + method.name + ": () => IBaseExecution<" + getGraphType(method.returnType) + ">;");
675
+ methods.push("\t" + method.name + ": () => IBaseExecution<" + getGraphType(method.returnType, true) + ">;");
666
676
  }
667
677
 
668
678
  // Add the endpoint
@@ -673,6 +683,16 @@ export interface ${name} ${entity.returnType ? "extends " + entity.returnType :
673
683
  ${props.join('\n')}
674
684
  ${methods.join('\n')}
675
685
  }`);
686
+
687
+ // See if there is a collection required for this
688
+ if(collections[name]) {
689
+ content.push(`/*********************************************
690
+ * ${name}
691
+ **********************************************/
692
+ export interface ${name}Collection {
693
+ results: ${name}[];
694
+ }`);
695
+ }
676
696
  }
677
697
  fs.writeFileSync("lib/microsoft/graph/entityTypes.d.ts", content.join('\n').replace(/EntityTypes./g, ""));
678
698
  }
@@ -1128,10 +1148,6 @@ function processREST(schemas) {
1128
1148
  // Update the references
1129
1149
  updateReferences(fileImports, dirName, type);
1130
1150
 
1131
- if (propName == "Cells") {
1132
- console.log(propName);
1133
- console.log(type);
1134
- }
1135
1151
  // See if this type is a collection and this is the complex or entity types
1136
1152
  if ((filename == "ComplexTypes" || filename == "EntityTypes") && /^Array\<.*\>$/.test(type)) {
1137
1153
  // Ensure it's a results type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-sprest-def",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
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",