gd-sprest 7.1.9 → 7.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.
@@ -269,6 +269,9 @@ export interface IContextInformation {
269
269
  /** Page Personalization Scope */
270
270
  pagePersonalizationScope: number;
271
271
 
272
+ /** Portal URL */
273
+ portalUrl: string;
274
+
272
275
  /** Prefer User Time Zone */
273
276
  preferUserTimeZone: boolean;
274
277
 
@@ -1,4 +1,5 @@
1
1
  import { IBaseExecution } from "gd-sprest-def/lib/base";
2
+ import { graph } from "gd-sprest-def/lib/microsoft";
2
3
  import { IGraph as IGraphCore, IGraphToken } from "../intellisense/graph";
3
4
  import { ITargetInfo } from "../utils";
4
5
 
@@ -30,6 +31,21 @@ export interface IGraphProperties {
30
31
  version?: string;
31
32
  }
32
33
 
34
+ /**
35
+ * Graph EndPoints
36
+ */
37
+ export interface IGraphCustom extends IGraphCore {
38
+ me(): IBaseExecution<graph.user>;
39
+ group(id: string): IBaseExecution<graph.group>;
40
+ groups(): IBaseExecution<graph.groupCollections>;
41
+ list(siteId: string, id: string): IBaseExecution<graph.list>;
42
+ lists(siteId: string): IBaseExecution<graph.listCollections>;
43
+ site(id: string): IBaseExecution<graph.site>;
44
+ sites(): IBaseExecution<graph.siteCollections>;
45
+ user(id: string): IBaseExecution<graph.user>;
46
+ users(): IBaseExecution<graph.userCollections>;
47
+ }
48
+
33
49
  /**
34
50
  * Graph
35
51
  */
@@ -38,7 +54,7 @@ export interface IGraph {
38
54
  * Creates an instance of the graph library.
39
55
  * @param props - The graph request information.
40
56
  */
41
- (props: IGraphProperties): IGraphCore;
57
+ (props?: IGraphProperties): IGraphCustom;
42
58
 
43
59
  /** The default cloud environment to use for the requests. */
44
60
  Cloud: string;
@@ -20,7 +20,9 @@ export type IRequestType = {
20
20
 
21
21
  // Graph Requests
22
22
  GraphGet: number;
23
+ GraphGetReplace: number;
23
24
  GraphPost: number;
25
+ GraphPostReplace: number;
24
26
 
25
27
  // Post Requests
26
28
  Post: number;
@@ -429,6 +429,11 @@ var _ContextInfo = /** @class */ (function () {
429
429
  enumerable: false,
430
430
  configurable: true
431
431
  });
432
+ Object.defineProperty(_ContextInfo, "portalUrl", {
433
+ get: function () { return this._contextInfo.portalUrl; },
434
+ enumerable: false,
435
+ configurable: true
436
+ });
432
437
  Object.defineProperty(_ContextInfo, "profileUrl", {
433
438
  get: function () { return this._contextInfo.profileUrl; },
434
439
  enumerable: false,
@@ -9,14 +9,16 @@ var utils_1 = require("../utils");
9
9
  * Graph
10
10
  */
11
11
  exports.Graph = (function (props) {
12
- var graph = new utils_1.Base({ accessToken: props.accessToken || exports.Graph.Token });
12
+ var graph = new utils_1.Base({ accessToken: props && props.accessToken ? props.accessToken : exports.Graph.Token });
13
13
  // Default the target information
14
- graph.targetInfo.requestType = (props.requestType || "").toLowerCase() == "post" ? utils_1.RequestType.GraphPost : utils_1.RequestType.GraphGet;
14
+ graph.targetInfo.requestType = (props && props.requestType ? props.requestType : "").toLowerCase() == "post" ? utils_1.RequestType.GraphPost : utils_1.RequestType.GraphGet;
15
15
  // Set the endpoint
16
- graph.targetInfo.data = props.data;
17
- graph.targetInfo.endpoint = props.cloud || exports.Graph.Cloud || sptypes_1.SPTypes.CloudEnvironment.Default;
18
- graph.targetInfo.endpoint += "/" + (props.version || exports.Graph.Version || "v1.0");
19
- props.url ? graph.targetInfo.endpoint += "/" + props.url : null;
16
+ graph.targetInfo.data = props ? props.data : null;
17
+ graph.targetInfo.endpoint = props && props.cloud ? props.cloud : exports.Graph.Cloud || sptypes_1.SPTypes.CloudEnvironment.Default;
18
+ graph.targetInfo.endpoint += "/" + (props && props.version ? props.version : exports.Graph.Version || "v1.0");
19
+ props && props.url ? graph.targetInfo.endpoint += "/" + props.url : null;
20
+ // Add the methods
21
+ utils_1.Request.addMethods(graph, { __metadata: { type: "graph" } });
20
22
  // Return the graph
21
23
  return graph;
22
24
  });
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graph = void 0;
4
+ var utils_1 = require("../../utils");
5
+ /**
6
+ * Graph
7
+ */
8
+ exports.graph = {
9
+ // Me
10
+ me: {
11
+ requestType: utils_1.RequestType.GraphGet
12
+ },
13
+ // Group
14
+ group: {
15
+ argNames: ["id"],
16
+ name: "groups/[[id]]",
17
+ requestType: utils_1.RequestType.GraphGetReplace
18
+ },
19
+ // Groups
20
+ groups: {
21
+ name: "groups",
22
+ requestType: utils_1.RequestType.GraphGet
23
+ },
24
+ // List
25
+ list: {
26
+ argNames: ["siteId", "id"],
27
+ name: "sites/[[siteId]]/lists/[[id]]",
28
+ requestType: utils_1.RequestType.GraphGetReplace
29
+ },
30
+ // Lists
31
+ lists: {
32
+ argNames: ["siteId"],
33
+ name: "sites/[[siteId]]/lists",
34
+ requestType: utils_1.RequestType.GraphGetReplace
35
+ },
36
+ // Queries the collection
37
+ query: {
38
+ argNames: ["oData"],
39
+ requestType: utils_1.RequestType.OData
40
+ },
41
+ // Root Site
42
+ root: {
43
+ requestType: utils_1.RequestType.GraphGet
44
+ },
45
+ // Site
46
+ site: {
47
+ argNames: ["id"],
48
+ name: "sites/[[id]]",
49
+ requestType: utils_1.RequestType.GraphGetReplace
50
+ },
51
+ // Sites
52
+ sites: {
53
+ name: "sites",
54
+ requestType: utils_1.RequestType.GraphGet
55
+ },
56
+ // User
57
+ user: {
58
+ argNames: ["id"],
59
+ name: "users/[[id]]",
60
+ requestType: utils_1.RequestType.GraphGetReplace
61
+ },
62
+ // Users
63
+ users: {
64
+ requestType: utils_1.RequestType.GraphGet
65
+ },
66
+ };
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./audit"), exports);
14
+ __exportStar(require("./graph"), exports);
14
15
  __exportStar(require("./old"), exports);
15
16
  __exportStar(require("./peoplePicker"), exports);
16
17
  __exportStar(require("./propertyValues"), exports);
@@ -104,7 +104,7 @@ var MethodInfo = /** @class */ (function () {
104
104
  configurable: true
105
105
  });
106
106
  Object.defineProperty(MethodInfo.prototype, "replace", {
107
- get: function () { return this.methodInfo.requestType == _1.RequestType.GetReplace || this.methodInfo.requestType == _1.RequestType.PostReplace; },
107
+ get: function () { return this.methodInfo.requestType == _1.RequestType.GetReplace || this.methodInfo.requestType == _1.RequestType.GraphGetReplace || this.methodInfo.requestType == _1.RequestType.PostReplace || this.methodInfo.requestType == _1.RequestType.GraphPostReplace; },
108
108
  enumerable: false,
109
109
  configurable: true
110
110
  });
@@ -531,6 +531,17 @@ exports.Request = {
531
531
  // Update the expanded properties
532
532
  helper_1.Helper.updateExpandedProperties(obj);
533
533
  }
534
+ // Else, see if this is a graph request
535
+ else if (data["@odata.context"]) {
536
+ // Save a reference to it
537
+ obj["d"] = data;
538
+ // Update the base object's properties
539
+ exports.Request.addProperties(obj, data);
540
+ // Add the methods
541
+ exports.Request.addMethods(obj, data, data["@odata.context"]);
542
+ // Update the data collection
543
+ helper_1.Helper.updateDataCollection(obj, data.value);
544
+ }
534
545
  else {
535
546
  // Update the base object's properties
536
547
  exports.Request.addProperties(obj, data);
@@ -21,7 +21,9 @@ exports.RequestType = {
21
21
  GetReplace: 17,
22
22
  // Graph Requests
23
23
  GraphGet: 20,
24
- GraphPost: 21,
24
+ GraphGetReplace: 21,
25
+ GraphPost: 22,
26
+ GraphPostReplace: 23,
25
27
  // Post Requests
26
28
  Post: 30,
27
29
  PostBodyNoArgs: 31,
@@ -30,7 +30,7 @@ var TargetInfo = /** @class */ (function () {
30
30
  // See if this is a graph request
31
31
  if (this.isGraph) {
32
32
  // Set the request method
33
- this.requestMethod = this.props.requestType == _1.RequestType.GraphGet ? "GET" : "POST";
33
+ this.requestMethod = this.props.requestType == _1.RequestType.GraphGet || this.props.requestType == _1.RequestType.GraphGetReplace ? "GET" : "POST";
34
34
  // Set the security flag
35
35
  var defaultProps = this.requestData || {};
36
36
  this.requestData = __assign({ securityEnabledOnly: true }, defaultProps);
@@ -50,7 +50,10 @@ var TargetInfo = /** @class */ (function () {
50
50
  });
51
51
  Object.defineProperty(TargetInfo.prototype, "isGraph", {
52
52
  // Flag to determine if this is a graph request
53
- get: function () { return this.props.requestType == _1.RequestType.GraphGet || this.props.requestType == _1.RequestType.GraphPost; },
53
+ get: function () {
54
+ return this.props.requestType == _1.RequestType.GraphGet || this.props.requestType == _1.RequestType.GraphPost ||
55
+ this.props.requestType == _1.RequestType.GraphGetReplace || this.props.requestType == _1.RequestType.GraphPostReplace;
56
+ },
54
57
  enumerable: false,
55
58
  configurable: true
56
59
  });
@@ -5,6 +5,7 @@
5
5
  // ../gd-sprest-def/lib/SP/entitytypes
6
6
  // ../gd-sprest-def
7
7
  // ../gd-sprest-def/lib/Microsoft/AppServices/entitytypes
8
+ // ../gd-sprest-def/lib/microsoft
8
9
  // ../gd-sprest-def/lib/Microsoft/SharePoint/Portal/entitytypes
9
10
  // ../gd-sprest-def/lib/Microsoft/SharePoint/Navigation/REST/entitytypes
10
11
  // ../gd-sprest-def/lib/SP/UserProfiles/entitytypes
@@ -722,6 +723,9 @@ declare module 'gd-sprest/lib/contextInfo' {
722
723
  /** Page Personalization Scope */
723
724
  pagePersonalizationScope: number;
724
725
 
726
+ /** Portal URL */
727
+ portalUrl: string;
728
+
725
729
  /** Prefer User Time Zone */
726
730
  preferUserTimeZone: boolean;
727
731
 
@@ -932,6 +936,7 @@ declare module 'gd-sprest/lib/contextInfo' {
932
936
 
933
937
  declare module 'gd-sprest/lib/graph' {
934
938
  import { IBaseExecution } from "gd-sprest-def/lib/base";
939
+ import { graph } from "gd-sprest-def/lib/microsoft";
935
940
  import { IGraph as IGraphCore, IGraphToken } from "gd-sprest/intellisense/graph";
936
941
  import { ITargetInfo } from "gd-sprest/utils";
937
942
 
@@ -963,6 +968,21 @@ declare module 'gd-sprest/lib/graph' {
963
968
  version?: string;
964
969
  }
965
970
 
971
+ /**
972
+ * Graph EndPoints
973
+ */
974
+ export interface IGraphCustom extends IGraphCore {
975
+ me(): IBaseExecution<graph.user>;
976
+ group(id: string): IBaseExecution<graph.group>;
977
+ groups(): IBaseExecution<graph.groupCollections>;
978
+ list(siteId: string, id: string): IBaseExecution<graph.list>;
979
+ lists(siteId: string): IBaseExecution<graph.listCollections>;
980
+ site(id: string): IBaseExecution<graph.site>;
981
+ sites(): IBaseExecution<graph.siteCollections>;
982
+ user(id: string): IBaseExecution<graph.user>;
983
+ users(): IBaseExecution<graph.userCollections>;
984
+ }
985
+
966
986
  /**
967
987
  * Graph
968
988
  */
@@ -971,7 +991,7 @@ declare module 'gd-sprest/lib/graph' {
971
991
  * Creates an instance of the graph library.
972
992
  * @param props - The graph request information.
973
993
  */
974
- (props: IGraphProperties): IGraphCore;
994
+ (props?: IGraphProperties): IGraphCustom;
975
995
 
976
996
  /** The default cloud environment to use for the requests. */
977
997
  Cloud: string;
@@ -6522,7 +6542,9 @@ declare module 'gd-sprest/utils/requestType' {
6522
6542
 
6523
6543
  // Graph Requests
6524
6544
  GraphGet: number;
6545
+ GraphGetReplace: number;
6525
6546
  GraphPost: number;
6547
+ GraphPostReplace: number;
6526
6548
 
6527
6549
  // Post Requests
6528
6550
  Post: number;