gd-sprest 6.9.9 → 7.0.2
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/@types/index.d.ts +2 -2
- package/@types/lib/index.d.ts +1 -0
- package/@types/lib/sitePages.d.ts +43 -0
- package/@types/rest.d.ts +5 -0
- package/@types/sptypes/index.d.ts +1 -0
- package/@types/sptypes/sptypes.d.ts +10 -0
- package/build/lib/index.js +1 -0
- package/build/lib/sitePages.js +74 -0
- package/build/mapper/def.js +71 -17
- package/build/rest.js +2 -1
- package/build/sptypes/sptypes.js +10 -1
- package/build/utils/batch.js +2 -1
- package/build/utils/request.js +1 -1
- package/dist/gd-sprest.d.ts +66 -2
- package/dist/gd-sprest.js +17 -6
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
package/@types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Library
|
|
3
3
|
*/
|
|
4
|
-
import { Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility, List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SocialFeed, UserProfile, Utility, Web, ThemeManager, WorkflowInstanceService, WorkflowSubscriptionService } from "./lib";
|
|
4
|
+
import { Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility, List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SitePages, SocialFeed, UserProfile, Utility, Web, ThemeManager, WorkflowInstanceService, WorkflowSubscriptionService } from "./lib";
|
|
5
5
|
export {
|
|
6
6
|
Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility,
|
|
7
|
-
List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager,
|
|
7
|
+
List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SitePages,
|
|
8
8
|
SocialFeed, ThemeManager, UserProfile, Utility, Web, WorkflowInstanceService, WorkflowSubscriptionService
|
|
9
9
|
}
|
|
10
10
|
|
package/@types/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SitePage, ISitePageService } from "gd-sprest-def/lib/SP/Publishing/entitytypes";
|
|
2
|
+
import { ITargetInfoProps } from "../utils";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* #### REST API
|
|
6
|
+
* _api/sitePages
|
|
7
|
+
*
|
|
8
|
+
* #### Get site pages
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Site } from "gd-sprest";
|
|
12
|
+
*
|
|
13
|
+
* SitePages().execute(sitePages => {
|
|
14
|
+
* // TODO
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const SitePages: ISitePages;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Site Pages
|
|
22
|
+
* @category Site Pages
|
|
23
|
+
*/
|
|
24
|
+
export interface ISitePages {
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of the site library.
|
|
27
|
+
* @param url - (Optional) The site url.
|
|
28
|
+
* @param targetInfo - (Optional) The target information.
|
|
29
|
+
*/
|
|
30
|
+
(url?: string, targetInfo?: ITargetInfoProps): ISitePageService;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a modern page.
|
|
34
|
+
* @param url - The url of the file to create.
|
|
35
|
+
* @param title - The title of the page.
|
|
36
|
+
* @param template - The type of page to create.
|
|
37
|
+
*/
|
|
38
|
+
createPage(url: string, title: string, template: string): PromiseLike<{
|
|
39
|
+
file: SP.File;
|
|
40
|
+
item: SP.ListItem;
|
|
41
|
+
page: SP.Publishing.SitePage;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
package/@types/rest.d.ts
CHANGED
|
@@ -132,6 +132,11 @@ export interface IREST {
|
|
|
132
132
|
* Use this api to create/delete site collections.
|
|
133
133
|
*/
|
|
134
134
|
SiteManager: LibTypes.ISiteManager;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Use this api to create/edit modern pages.
|
|
138
|
+
*/
|
|
139
|
+
SitePages: LibTypes.ISitePages;
|
|
135
140
|
|
|
136
141
|
/**
|
|
137
142
|
* Use this api to see if a site collection exists.
|
|
@@ -11,6 +11,7 @@ export interface ISPTypes {
|
|
|
11
11
|
CheckInType: Types.ICheckInType;
|
|
12
12
|
CheckOutType: Types.ICheckOutType;
|
|
13
13
|
ChoiceFormatType: Types.IChoiceFormatType;
|
|
14
|
+
ClientSidePageLayout: Types.IClientSidePageLayout;
|
|
14
15
|
ClientTemplateUtility: Types.IClientTemplateUtility;
|
|
15
16
|
ControlMode: Types.IControlMode;
|
|
16
17
|
DateFormat: Types.IDateFormat;
|
|
@@ -140,6 +140,16 @@ export type IClientTemplateUtility = {
|
|
|
140
140
|
UserMultiValueDelimitString: string
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Client Side Page Layouts
|
|
145
|
+
*/
|
|
146
|
+
export type IClientSidePageLayout = {
|
|
147
|
+
Article: string;
|
|
148
|
+
Home: string;
|
|
149
|
+
SingleWebPartAppPage: string;
|
|
150
|
+
RepostPage: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
143
153
|
/**
|
|
144
154
|
* Control Modes
|
|
145
155
|
*/
|
package/build/lib/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./profileLoader"), exports);
|
|
|
25
25
|
__exportStar(require("./search"), exports);
|
|
26
26
|
__exportStar(require("./site"), exports);
|
|
27
27
|
__exportStar(require("./siteManager"), exports);
|
|
28
|
+
__exportStar(require("./sitePages"), exports);
|
|
28
29
|
__exportStar(require("./socialFeed"), exports);
|
|
29
30
|
__exportStar(require("./themeManager"), exports);
|
|
30
31
|
__exportStar(require("./userProfile"), exports);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SitePages = void 0;
|
|
4
|
+
var web_1 = require("./web");
|
|
5
|
+
var utils_1 = require("../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Site Pages
|
|
8
|
+
*/
|
|
9
|
+
exports.SitePages = (function (url, targetInfo) {
|
|
10
|
+
var sitePages = new utils_1.Base(targetInfo);
|
|
11
|
+
// Default the properties
|
|
12
|
+
sitePages.targetInfo.defaultToWebFl = true;
|
|
13
|
+
sitePages.targetInfo.endpoint = "SitePages";
|
|
14
|
+
// See if the web url exists
|
|
15
|
+
if (url) {
|
|
16
|
+
// Set the settings
|
|
17
|
+
sitePages.targetInfo.url = url;
|
|
18
|
+
}
|
|
19
|
+
// Add the methods
|
|
20
|
+
utils_1.Request.addMethods(sitePages, { __metadata: { type: "SP.Publishing.SitePageService" } });
|
|
21
|
+
// Return the site pages
|
|
22
|
+
return sitePages;
|
|
23
|
+
});
|
|
24
|
+
// Static method to create a modern page
|
|
25
|
+
exports.SitePages.createPage = (function (pageName, pageTitle, pageTemplate, url, targetInfo) {
|
|
26
|
+
// Return a promise
|
|
27
|
+
return new Promise(function (resolve, reject) {
|
|
28
|
+
// Method called after the updates have completed
|
|
29
|
+
var onComplete = function (itemId, fileUrl) {
|
|
30
|
+
var web = web_1.Web(url, targetInfo);
|
|
31
|
+
var results = { file: null, item: null, page: null };
|
|
32
|
+
// Get the file
|
|
33
|
+
web.getFileByUrl(fileUrl).query({ Select: ["*", "ListId"] }).execute(function (file) {
|
|
34
|
+
// Set the file
|
|
35
|
+
results.file = file;
|
|
36
|
+
// Get the list
|
|
37
|
+
web.Lists().getById(file.ListId).Items(itemId).execute(function (item) {
|
|
38
|
+
// Set the item
|
|
39
|
+
results.item = item;
|
|
40
|
+
// Get the page
|
|
41
|
+
exports.SitePages(url, targetInfo).Pages(itemId).execute(function (page) {
|
|
42
|
+
// Set the page
|
|
43
|
+
results.page = page;
|
|
44
|
+
// Resolve the request
|
|
45
|
+
resolve(results);
|
|
46
|
+
}, reject);
|
|
47
|
+
}, reject);
|
|
48
|
+
}, reject);
|
|
49
|
+
};
|
|
50
|
+
// Create the page
|
|
51
|
+
exports.SitePages(url, targetInfo).Pages().createAppPage({
|
|
52
|
+
Title: pageTitle,
|
|
53
|
+
PageLayoutType: pageTemplate
|
|
54
|
+
}).execute(function (page) {
|
|
55
|
+
// Update the file name
|
|
56
|
+
web_1.Web(url, targetInfo).Lists("Site Pages").Items(page.Id).update({
|
|
57
|
+
FileLeafRef: pageName
|
|
58
|
+
}).execute(
|
|
59
|
+
// Updated the file name successfully
|
|
60
|
+
function () {
|
|
61
|
+
// Update the file url
|
|
62
|
+
var idx = page.Url.lastIndexOf('/');
|
|
63
|
+
var fileUrl = page.Url.substring(0, idx + 1) + pageName;
|
|
64
|
+
// Complete the request
|
|
65
|
+
onComplete(page.Id, fileUrl);
|
|
66
|
+
},
|
|
67
|
+
// Unable to update the file name, but still return the object
|
|
68
|
+
function () {
|
|
69
|
+
// Complete the request
|
|
70
|
+
onComplete(page.Id, page.Url);
|
|
71
|
+
});
|
|
72
|
+
}, reject);
|
|
73
|
+
});
|
|
74
|
+
});
|
package/build/mapper/def.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.Mapper = {
|
|
|
6
6
|
"MS.FileServices.File": {
|
|
7
7
|
copyTo: {
|
|
8
8
|
argNames: ["target", "overwrite"],
|
|
9
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
9
10
|
},
|
|
10
11
|
delete: {
|
|
11
12
|
requestType: utils_1.RequestType.Delete
|
|
@@ -69,6 +70,7 @@ exports.Mapper = {
|
|
|
69
70
|
"Microsoft.Office.Server.ContentCenter.SPMachineLearningModel": {
|
|
70
71
|
copy: {
|
|
71
72
|
argNames: ["copyTo"],
|
|
73
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
72
74
|
},
|
|
73
75
|
delete: {},
|
|
74
76
|
importMeta: {},
|
|
@@ -927,14 +929,17 @@ exports.Mapper = {
|
|
|
927
929
|
},
|
|
928
930
|
updateWebPartData: {
|
|
929
931
|
argNames: ["webPartDataAsJson"],
|
|
932
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
930
933
|
},
|
|
931
934
|
},
|
|
932
935
|
"Microsoft.SharePoint.ClientSideComponent.HostedAppsManager": {
|
|
933
936
|
add: {
|
|
934
937
|
argNames: ["webPartDataAsJson", "hostType"],
|
|
938
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
935
939
|
},
|
|
936
940
|
addEx: {
|
|
937
941
|
argNames: ["webPartDataAsJson", "hostType"],
|
|
942
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
938
943
|
},
|
|
939
944
|
getById: {
|
|
940
945
|
argNames: ["id"],
|
|
@@ -1463,6 +1468,7 @@ exports.Mapper = {
|
|
|
1463
1468
|
"PS.Calendar": {
|
|
1464
1469
|
copyTo: {
|
|
1465
1470
|
argNames: ["name"],
|
|
1471
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
1466
1472
|
},
|
|
1467
1473
|
delete: {
|
|
1468
1474
|
requestType: utils_1.RequestType.Delete
|
|
@@ -4424,9 +4430,12 @@ exports.Mapper = {
|
|
|
4424
4430
|
},
|
|
4425
4431
|
checkOut: {},
|
|
4426
4432
|
checkoutPage: {},
|
|
4427
|
-
copy: {
|
|
4433
|
+
copy: {
|
|
4434
|
+
requestType: utils_1.RequestType.Post
|
|
4435
|
+
},
|
|
4428
4436
|
copyWithConfiguration: {
|
|
4429
4437
|
argNames: ["sitePageFlags", "isNews"],
|
|
4438
|
+
requestType: utils_1.RequestType.Post
|
|
4430
4439
|
},
|
|
4431
4440
|
createNewsCopy: {},
|
|
4432
4441
|
demoteFromNews: {},
|
|
@@ -4562,9 +4571,12 @@ exports.Mapper = {
|
|
|
4562
4571
|
},
|
|
4563
4572
|
checkOut: {},
|
|
4564
4573
|
checkoutPage: {},
|
|
4565
|
-
copy: {
|
|
4574
|
+
copy: {
|
|
4575
|
+
requestType: utils_1.RequestType.Post
|
|
4576
|
+
},
|
|
4566
4577
|
copyWithConfiguration: {
|
|
4567
4578
|
argNames: ["sitePageFlags", "isNews"],
|
|
4579
|
+
requestType: utils_1.RequestType.Post
|
|
4568
4580
|
},
|
|
4569
4581
|
createNewsCopy: {},
|
|
4570
4582
|
demoteFromNews: {},
|
|
@@ -4635,36 +4647,63 @@ exports.Mapper = {
|
|
|
4635
4647
|
boostNews: {
|
|
4636
4648
|
argNames: ["SitePageBoost"],
|
|
4637
4649
|
},
|
|
4638
|
-
checkOut: {
|
|
4639
|
-
|
|
4640
|
-
|
|
4650
|
+
checkOut: {
|
|
4651
|
+
requestType: utils_1.RequestType.Post
|
|
4652
|
+
},
|
|
4653
|
+
checkoutPage: {
|
|
4654
|
+
requestType: utils_1.RequestType.Post
|
|
4655
|
+
},
|
|
4656
|
+
copy: {
|
|
4657
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
4658
|
+
},
|
|
4641
4659
|
copyWithConfiguration: {
|
|
4642
4660
|
argNames: ["sitePageFlags", "isNews"],
|
|
4661
|
+
requestType: utils_1.RequestType.Post
|
|
4662
|
+
},
|
|
4663
|
+
createNewsCopy: {
|
|
4664
|
+
requestType: utils_1.RequestType.Post
|
|
4665
|
+
},
|
|
4666
|
+
demoteFromNews: {
|
|
4667
|
+
requestType: utils_1.RequestType.Post
|
|
4668
|
+
},
|
|
4669
|
+
discardPage: {
|
|
4670
|
+
requestType: utils_1.RequestType.Post
|
|
4643
4671
|
},
|
|
4644
|
-
createNewsCopy: {},
|
|
4645
|
-
demoteFromNews: {},
|
|
4646
|
-
discardPage: {},
|
|
4647
4672
|
getVersion: {
|
|
4648
4673
|
argNames: ["versionId"],
|
|
4649
4674
|
},
|
|
4650
|
-
promoteToNews: {
|
|
4651
|
-
|
|
4652
|
-
|
|
4675
|
+
promoteToNews: {
|
|
4676
|
+
requestType: utils_1.RequestType.Post
|
|
4677
|
+
},
|
|
4678
|
+
publish: {
|
|
4679
|
+
requestType: utils_1.RequestType.Post
|
|
4680
|
+
},
|
|
4681
|
+
query: {
|
|
4682
|
+
argNames: ["oData"],
|
|
4683
|
+
requestType: utils_1.RequestType.OData
|
|
4684
|
+
},
|
|
4653
4685
|
saveDraft: {
|
|
4654
4686
|
argNames: ["sitePage"],
|
|
4687
|
+
requestType: utils_1.RequestType.Post
|
|
4655
4688
|
},
|
|
4656
4689
|
savePage: {
|
|
4657
4690
|
argNames: ["pageStream"],
|
|
4691
|
+
requestType: utils_1.RequestType.Post
|
|
4658
4692
|
},
|
|
4659
4693
|
savePageAsDraft: {
|
|
4660
4694
|
argNames: ["pageStream"],
|
|
4695
|
+
requestType: utils_1.RequestType.Post
|
|
4696
|
+
},
|
|
4697
|
+
savePageAsTemplate: {
|
|
4698
|
+
requestType: utils_1.RequestType.Post
|
|
4661
4699
|
},
|
|
4662
|
-
savePageAsTemplate: {},
|
|
4663
4700
|
schedulePublish: {
|
|
4664
4701
|
argNames: ["sitePage"],
|
|
4702
|
+
requestType: utils_1.RequestType.Post
|
|
4665
4703
|
},
|
|
4666
4704
|
sharePagePreviewByEmail: {
|
|
4667
4705
|
argNames: ["message", "recipientEmails"],
|
|
4706
|
+
requestType: utils_1.RequestType.Post
|
|
4668
4707
|
},
|
|
4669
4708
|
update: {
|
|
4670
4709
|
metadataType: "",
|
|
@@ -4675,7 +4714,10 @@ exports.Mapper = {
|
|
|
4675
4714
|
},
|
|
4676
4715
|
"SP.Publishing.SitePage.Collection": {
|
|
4677
4716
|
createAppPage: {
|
|
4678
|
-
argNames: ["webPartDataAsJson"]
|
|
4717
|
+
argNames: ["webPartDataAsJson"],
|
|
4718
|
+
metadataType: "SP.Publishing.SitePage",
|
|
4719
|
+
name: "",
|
|
4720
|
+
requestType: utils_1.RequestType.PostBodyNoArgs
|
|
4679
4721
|
},
|
|
4680
4722
|
ensureTitleResource: {},
|
|
4681
4723
|
feed: {
|
|
@@ -4705,10 +4747,12 @@ exports.Mapper = {
|
|
|
4705
4747
|
query: { argNames: ["oData"], requestType: utils_1.RequestType.OData },
|
|
4706
4748
|
templates: {},
|
|
4707
4749
|
updateAppPage: {
|
|
4708
|
-
argNames: ["pageId", "webPartDataAsJson", "title", "includeInNavigation"]
|
|
4750
|
+
argNames: ["pageId", "webPartDataAsJson", "title", "includeInNavigation"],
|
|
4751
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
4709
4752
|
},
|
|
4710
4753
|
updateFullPageApp: {
|
|
4711
|
-
argNames: ["serverRelativeUrl", "webPartDataAsJson"]
|
|
4754
|
+
argNames: ["serverRelativeUrl", "webPartDataAsJson"],
|
|
4755
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
4712
4756
|
}
|
|
4713
4757
|
},
|
|
4714
4758
|
"SP.Publishing.SitePage3D": {
|
|
@@ -4717,7 +4761,9 @@ exports.Mapper = {
|
|
|
4717
4761
|
},
|
|
4718
4762
|
checkOut: {},
|
|
4719
4763
|
checkoutPage: {},
|
|
4720
|
-
copy: {
|
|
4764
|
+
copy: {
|
|
4765
|
+
requestType: utils_1.RequestType.Post
|
|
4766
|
+
},
|
|
4721
4767
|
copyWithConfiguration: {
|
|
4722
4768
|
argNames: ["sitePageFlags", "isNews"],
|
|
4723
4769
|
},
|
|
@@ -4758,11 +4804,17 @@ exports.Mapper = {
|
|
|
4758
4804
|
query: { argNames: ["oData"], requestType: utils_1.RequestType.OData },
|
|
4759
4805
|
},
|
|
4760
4806
|
"SP.Publishing.SitePageService": {
|
|
4807
|
+
properties: [
|
|
4808
|
+
"CommunicationSite|SP.Publishing.CommunicationSite",
|
|
4809
|
+
"Pages|SP.Publishing.SitePage.Collection|('[Name]')|SP.Publishing.SitePage"
|
|
4810
|
+
],
|
|
4761
4811
|
addImage: {
|
|
4762
4812
|
argNames: ["pageName", "imageFileName", "imageStream", "pageId"],
|
|
4813
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
4763
4814
|
},
|
|
4764
4815
|
addImageFromExternalUrl: {
|
|
4765
4816
|
argNames: ["pageName", "imageFileName", "externalUrl", "subFolderName", "pageId"],
|
|
4817
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
4766
4818
|
},
|
|
4767
4819
|
canCreatePage: {},
|
|
4768
4820
|
canCreatePromotedPage: {},
|
|
@@ -4829,7 +4881,9 @@ exports.Mapper = {
|
|
|
4829
4881
|
},
|
|
4830
4882
|
checkOut: {},
|
|
4831
4883
|
checkoutPage: {},
|
|
4832
|
-
copy: {
|
|
4884
|
+
copy: {
|
|
4885
|
+
requestType: utils_1.RequestType.Post
|
|
4886
|
+
},
|
|
4833
4887
|
copyWithConfiguration: {
|
|
4834
4888
|
argNames: ["sitePageFlags", "isNews"],
|
|
4835
4889
|
},
|
package/build/rest.js
CHANGED
|
@@ -8,7 +8,7 @@ var sptypes_1 = require("./sptypes");
|
|
|
8
8
|
* SharePoint REST Library
|
|
9
9
|
*/
|
|
10
10
|
exports.$REST = {
|
|
11
|
-
__ver:
|
|
11
|
+
__ver: 7.02,
|
|
12
12
|
AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
|
|
13
13
|
Apps: Lib.Apps,
|
|
14
14
|
ContextInfo: Lib.ContextInfo,
|
|
@@ -30,6 +30,7 @@ exports.$REST = {
|
|
|
30
30
|
Search: Lib.Search,
|
|
31
31
|
Site: Lib.Site,
|
|
32
32
|
SiteManager: Lib.SiteManager,
|
|
33
|
+
SitePages: Lib.SitePages,
|
|
33
34
|
SiteExists: function (url) { return Lib.Site.exists(url); },
|
|
34
35
|
SiteUrl: function (id) { return Lib.Site.getUrlById(id); },
|
|
35
36
|
SPTypes: sptypes_1.SPTypes,
|
package/build/sptypes/sptypes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebTemplateType = exports.ViewType = exports.UserCustomActionRegistrationType = exports.URLZones = exports.UrlFormatType = exports.StatusPriColor = exports.RoleType = exports.ReorderingRuleMatchType = exports.RenderListDataOptions = exports.RelationshipDeleteBehaviorType = exports.PrincipalTypes = exports.PrincipalSources = exports.PersonalSiteCapabilities = exports.PersonalizationScope = exports.PageType = exports.ModalDialogResult = exports.LocaleLCIDType = exports.ListTemplateType = exports.ListExperienceOptions = exports.FriendlyDateFormat = exports.FileTemplateType = exports.FileLevelType = exports.FieldUserSelectionType = exports.FieldType = exports.FieldResultType = exports.FieldNumberType = exports.FieldNoteType = exports.EventReceiverType = exports.EventReceiverSynchronizationType = exports.DraftVisibilityType = exports.DateFormat = exports.ControlMode = exports.ClientTemplatesUtility = exports.ChoiceFormatType = exports.CheckOutType = exports.CheckInType = exports.CalendarTypes = exports.BasePermissionTypes = void 0;
|
|
3
|
+
exports.WebTemplateType = exports.ViewType = exports.UserCustomActionRegistrationType = exports.URLZones = exports.UrlFormatType = exports.StatusPriColor = exports.RoleType = exports.ReorderingRuleMatchType = exports.RenderListDataOptions = exports.RelationshipDeleteBehaviorType = exports.PrincipalTypes = exports.PrincipalSources = exports.PersonalSiteCapabilities = exports.PersonalizationScope = exports.PageType = exports.ModalDialogResult = exports.LocaleLCIDType = exports.ListTemplateType = exports.ListExperienceOptions = exports.FriendlyDateFormat = exports.FileTemplateType = exports.FileLevelType = exports.FieldUserSelectionType = exports.FieldType = exports.FieldResultType = exports.FieldNumberType = exports.FieldNoteType = exports.EventReceiverType = exports.EventReceiverSynchronizationType = exports.DraftVisibilityType = exports.DateFormat = exports.ControlMode = exports.ClientSidePageLayout = exports.ClientTemplatesUtility = exports.ChoiceFormatType = exports.CheckOutType = exports.CheckInType = exports.CalendarTypes = exports.BasePermissionTypes = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Base Permission Types
|
|
6
6
|
*/
|
|
@@ -81,6 +81,15 @@ exports.ClientTemplatesUtility = {
|
|
|
81
81
|
UserLookupDelimitString: ";#",
|
|
82
82
|
UserMultiValueDelimitString: ",#"
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Client Side Templates
|
|
86
|
+
*/
|
|
87
|
+
exports.ClientSidePageLayout = {
|
|
88
|
+
Article: "Article",
|
|
89
|
+
Home: "Home",
|
|
90
|
+
RepostPage: "RepostPage",
|
|
91
|
+
SingleWebPartAppPage: "SingleWebPartAppPage"
|
|
92
|
+
};
|
|
84
93
|
/**
|
|
85
94
|
* Control Modes
|
|
86
95
|
*/
|
package/build/utils/batch.js
CHANGED
|
@@ -51,7 +51,7 @@ var Batch = /** @class */ (function () {
|
|
|
51
51
|
return base;
|
|
52
52
|
};
|
|
53
53
|
// Method to generate a batch request
|
|
54
|
-
Batch.getTargetInfo = function (requests) {
|
|
54
|
+
Batch.getTargetInfo = function (url, requests) {
|
|
55
55
|
var batchId = "batch_" + lib_1.ContextInfo.generateGUID();
|
|
56
56
|
var batchRequests = [];
|
|
57
57
|
// Parse the requests
|
|
@@ -63,6 +63,7 @@ var Batch = /** @class */ (function () {
|
|
|
63
63
|
batchRequests.push("--" + batchId + "--");
|
|
64
64
|
// Return the target info
|
|
65
65
|
return new _1.TargetInfo({
|
|
66
|
+
url: url,
|
|
66
67
|
endpoint: "$batch",
|
|
67
68
|
method: "POST",
|
|
68
69
|
data: batchRequests.join("\r\n"),
|
package/build/utils/request.js
CHANGED
|
@@ -289,7 +289,7 @@ exports.Request = {
|
|
|
289
289
|
// Method to execute the request
|
|
290
290
|
executeRequest: function (base, asyncFl, callback) {
|
|
291
291
|
var isBatchRequest = base.base && base.base.batchRequests && base.base.batchRequests.length > 0;
|
|
292
|
-
var targetInfo = isBatchRequest ? batch_1.Batch.getTargetInfo(base.base.batchRequests) : new targetInfo_1.TargetInfo(base.targetInfo);
|
|
292
|
+
var targetInfo = isBatchRequest ? batch_1.Batch.getTargetInfo(base.targetInfo.url, base.base.batchRequests) : new targetInfo_1.TargetInfo(base.targetInfo);
|
|
293
293
|
// See if this is an asynchronous request
|
|
294
294
|
if (asyncFl) {
|
|
295
295
|
// See if the not a batch request, and it already exists
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// ../gd-sprest-def/lib/SP/UserProfiles/entitytypes
|
|
11
11
|
// ../gd-sprest-def/lib/Microsoft/Office/Server/Search/REST/complextypes
|
|
12
12
|
// ../gd-sprest-def/lib/Microsoft/Office/Server/Search/REST/entitytypes
|
|
13
|
+
// ../gd-sprest-def/lib/SP/Publishing/entitytypes
|
|
13
14
|
// ../gd-sprest-def/lib/SP/Social/complextypes
|
|
14
15
|
// ../gd-sprest-def/lib/SP/Social/entitytypes
|
|
15
16
|
// ../gd-sprest-def/lib/SP/Utilities/entitytypes
|
|
@@ -24,10 +25,10 @@ declare module 'gd-sprest' {
|
|
|
24
25
|
/**
|
|
25
26
|
* Library
|
|
26
27
|
*/
|
|
27
|
-
import { Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility, List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SocialFeed, UserProfile, Utility, Web, ThemeManager, WorkflowInstanceService, WorkflowSubscriptionService } from "gd-sprest/lib";
|
|
28
|
+
import { Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility, List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SitePages, SocialFeed, UserProfile, Utility, Web, ThemeManager, WorkflowInstanceService, WorkflowSubscriptionService } from "gd-sprest/lib";
|
|
28
29
|
export {
|
|
29
30
|
Apps, ContextInfo, GroupService, GroupSiteManager, HubSites, HubSitesUtility,
|
|
30
|
-
List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager,
|
|
31
|
+
List, Navigation, PeopleManager, PeoplePicker, ProfileLoader, Search, Site, SiteManager, SitePages,
|
|
31
32
|
SocialFeed, ThemeManager, UserProfile, Utility, Web, WorkflowInstanceService, WorkflowSubscriptionService
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -77,6 +78,7 @@ declare module 'gd-sprest/lib' {
|
|
|
77
78
|
export * from "gd-sprest/lib/search";
|
|
78
79
|
export * from "gd-sprest/lib/site";
|
|
79
80
|
export * from "gd-sprest/lib/siteManager";
|
|
81
|
+
export * from "gd-sprest/lib/sitePages";
|
|
80
82
|
export * from "gd-sprest/lib/socialFeed";
|
|
81
83
|
export * from "gd-sprest/lib/themeManager";
|
|
82
84
|
export * from "gd-sprest/lib/userProfile";
|
|
@@ -297,6 +299,11 @@ declare module 'gd-sprest/rest' {
|
|
|
297
299
|
*/
|
|
298
300
|
SiteManager: LibTypes.ISiteManager;
|
|
299
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Use this api to create/edit modern pages.
|
|
304
|
+
*/
|
|
305
|
+
SitePages: LibTypes.ISitePages;
|
|
306
|
+
|
|
300
307
|
/**
|
|
301
308
|
* Use this api to see if a site collection exists.
|
|
302
309
|
* @param url - The absolute url of the site collection.
|
|
@@ -370,6 +377,7 @@ declare module 'gd-sprest/sptypes' {
|
|
|
370
377
|
CheckInType: Types.ICheckInType;
|
|
371
378
|
CheckOutType: Types.ICheckOutType;
|
|
372
379
|
ChoiceFormatType: Types.IChoiceFormatType;
|
|
380
|
+
ClientSidePageLayout: Types.IClientSidePageLayout;
|
|
373
381
|
ClientTemplateUtility: Types.IClientTemplateUtility;
|
|
374
382
|
ControlMode: Types.IControlMode;
|
|
375
383
|
DateFormat: Types.IDateFormat;
|
|
@@ -1407,6 +1415,52 @@ declare module 'gd-sprest/lib/siteManager' {
|
|
|
1407
1415
|
}
|
|
1408
1416
|
}
|
|
1409
1417
|
|
|
1418
|
+
declare module 'gd-sprest/lib/sitePages' {
|
|
1419
|
+
import { SitePage, ISitePageService } from "gd-sprest-def/lib/SP/Publishing/entitytypes";
|
|
1420
|
+
import { ITargetInfoProps } from "gd-sprest/utils";
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* #### REST API
|
|
1424
|
+
* _api/sitePages
|
|
1425
|
+
*
|
|
1426
|
+
* #### Get site pages
|
|
1427
|
+
*
|
|
1428
|
+
* ```typescript
|
|
1429
|
+
* import { Site } from "gd-sprest";
|
|
1430
|
+
*
|
|
1431
|
+
* SitePages().execute(sitePages => {
|
|
1432
|
+
* // TODO
|
|
1433
|
+
* });
|
|
1434
|
+
* ```
|
|
1435
|
+
*/
|
|
1436
|
+
export const SitePages: ISitePages;
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* Site Pages
|
|
1440
|
+
* @category Site Pages
|
|
1441
|
+
*/
|
|
1442
|
+
export interface ISitePages {
|
|
1443
|
+
/**
|
|
1444
|
+
* Creates an instance of the site library.
|
|
1445
|
+
* @param url - (Optional) The site url.
|
|
1446
|
+
* @param targetInfo - (Optional) The target information.
|
|
1447
|
+
*/
|
|
1448
|
+
(url?: string, targetInfo?: ITargetInfoProps): ISitePageService;
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* Creates a modern page.
|
|
1452
|
+
* @param url - The url of the file to create.
|
|
1453
|
+
* @param title - The title of the page.
|
|
1454
|
+
* @param template - The type of page to create.
|
|
1455
|
+
*/
|
|
1456
|
+
createPage(url: string, title: string, template: string): PromiseLike<{
|
|
1457
|
+
file: SP.File;
|
|
1458
|
+
item: SP.ListItem;
|
|
1459
|
+
page: SP.Publishing.SitePage;
|
|
1460
|
+
}>;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1410
1464
|
declare module 'gd-sprest/lib/socialFeed' {
|
|
1411
1465
|
import { IBaseExecution } from "gd-sprest-def/lib/base";
|
|
1412
1466
|
import { SocialPostCreationData } from "gd-sprest-def/lib/SP/Social/complextypes";
|
|
@@ -3976,6 +4030,16 @@ declare module 'gd-sprest/sptypes/sptypes' {
|
|
|
3976
4030
|
UserMultiValueDelimitString: string
|
|
3977
4031
|
}
|
|
3978
4032
|
|
|
4033
|
+
/**
|
|
4034
|
+
* Client Side Page Layouts
|
|
4035
|
+
*/
|
|
4036
|
+
export type IClientSidePageLayout = {
|
|
4037
|
+
Article: string;
|
|
4038
|
+
Home: string;
|
|
4039
|
+
SingleWebPartAppPage: string;
|
|
4040
|
+
RepostPage: string;
|
|
4041
|
+
}
|
|
4042
|
+
|
|
3979
4043
|
/**
|
|
3980
4044
|
* Control Modes
|
|
3981
4045
|
*/
|