gd-sprest-def 1.1.6 → 1.2.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.
package/clean.js CHANGED
@@ -1,4 +1,5 @@
1
1
  var fs = require('fs');
2
+ var https = require("https");
2
3
 
3
4
  // Deletes a directory
4
5
  function deleteDirectory(src) {
@@ -29,8 +30,37 @@ console.log("Cleaning the files...");
29
30
  // Delete the folder
30
31
  deleteDirectory("./lib");
31
32
 
33
+ // See if the file exists
34
+ if (fs.existsSync("./graph.xml")) {
35
+ // Delete the file
36
+ fs.unlinkSync("./graph.xml");
37
+ }
38
+
32
39
  // Create the folder
33
40
  fs.mkdirSync("./lib");
34
41
 
35
42
  // Log
36
- console.log("Successfully cleaned the library");
43
+ console.log("Successfully cleaned the library");
44
+
45
+ // Log
46
+ console.log("Getting the graph api metadata");
47
+
48
+ // Get the metadata
49
+ https.get("https://graph.microsoft.com/v1.0/$metadata", (res) => {
50
+ let data = "";
51
+
52
+ // Read the data
53
+ res.on("data", function (chunk) { data += chunk; });
54
+
55
+ // Wait for the read to complete
56
+ res.on("end", function () {
57
+ // Rename the "case" type. It will cause issues w/ TypeScript
58
+ let content = data.toString().replace('Name="case"', 'Name="_case"');
59
+
60
+ // Write the file
61
+ fs.writeFileSync("graph.xml", content);
62
+
63
+ // Log
64
+ console.log("Graph metadata updated.");
65
+ });
66
+ });