gd-sprest 6.9.7 → 7.0.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/@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/helper/fieldSchemaXML.js +2 -2
- package/build/helper/spCfg.js +1 -1
- package/build/lib/index.js +1 -0
- package/build/lib/sitePages.js +74 -0
- package/build/mapper/def.js +54 -13
- package/build/rest.js +2 -1
- package/build/sptypes/sptypes.js +10 -1
- package/build/utils/request.js +18 -3
- package/dist/gd-sprest.d.ts +66 -2
- package/dist/gd-sprest.js +18 -7
- 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
|
*/
|
|
@@ -8,7 +8,7 @@ var spCfg_1 = require("./spCfg");
|
|
|
8
8
|
* Field Schema XML
|
|
9
9
|
* Helper class for generating the field schema xml
|
|
10
10
|
*/
|
|
11
|
-
exports.FieldSchemaXML = function (fieldInfo) {
|
|
11
|
+
exports.FieldSchemaXML = function (fieldInfo, targetWebUrl) {
|
|
12
12
|
var _resolve = null;
|
|
13
13
|
// Returns the schema xml for a boolean field.
|
|
14
14
|
var createBoolean = function (fieldInfo, props) {
|
|
@@ -215,7 +215,7 @@ exports.FieldSchemaXML = function (fieldInfo) {
|
|
|
215
215
|
// See if the lookup name exists
|
|
216
216
|
if (fieldInfo.listName) {
|
|
217
217
|
// Get the web containing the list
|
|
218
|
-
lib_1.Web(fieldInfo.webUrl, { disableCache: true })
|
|
218
|
+
lib_1.Web(fieldInfo.webUrl || targetWebUrl, { disableCache: true })
|
|
219
219
|
// Get the list
|
|
220
220
|
.Lists(fieldInfo.listName)
|
|
221
221
|
// Set the query
|
package/build/helper/spCfg.js
CHANGED
|
@@ -276,7 +276,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
// Compute the schema xml
|
|
279
|
-
_1.FieldSchemaXML(cfg).then(function (response) {
|
|
279
|
+
_1.FieldSchemaXML(cfg, webUrl).then(function (response) {
|
|
280
280
|
var schemas = typeof (response) === "string" ? [response] : response;
|
|
281
281
|
// Parse the fields to add
|
|
282
282
|
for (var i = 0; i < schemas.length; i++) {
|
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
|
@@ -927,14 +927,17 @@ exports.Mapper = {
|
|
|
927
927
|
},
|
|
928
928
|
updateWebPartData: {
|
|
929
929
|
argNames: ["webPartDataAsJson"],
|
|
930
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
930
931
|
},
|
|
931
932
|
},
|
|
932
933
|
"Microsoft.SharePoint.ClientSideComponent.HostedAppsManager": {
|
|
933
934
|
add: {
|
|
934
935
|
argNames: ["webPartDataAsJson", "hostType"],
|
|
936
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
935
937
|
},
|
|
936
938
|
addEx: {
|
|
937
939
|
argNames: ["webPartDataAsJson", "hostType"],
|
|
940
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
938
941
|
},
|
|
939
942
|
getById: {
|
|
940
943
|
argNames: ["id"],
|
|
@@ -4635,36 +4638,63 @@ exports.Mapper = {
|
|
|
4635
4638
|
boostNews: {
|
|
4636
4639
|
argNames: ["SitePageBoost"],
|
|
4637
4640
|
},
|
|
4638
|
-
checkOut: {
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
+
checkOut: {
|
|
4642
|
+
requestType: utils_1.RequestType.Post
|
|
4643
|
+
},
|
|
4644
|
+
checkoutPage: {
|
|
4645
|
+
requestType: utils_1.RequestType.Post
|
|
4646
|
+
},
|
|
4647
|
+
copy: {
|
|
4648
|
+
requestType: utils_1.RequestType.Post
|
|
4649
|
+
},
|
|
4641
4650
|
copyWithConfiguration: {
|
|
4642
4651
|
argNames: ["sitePageFlags", "isNews"],
|
|
4652
|
+
requestType: utils_1.RequestType.Post
|
|
4653
|
+
},
|
|
4654
|
+
createNewsCopy: {
|
|
4655
|
+
requestType: utils_1.RequestType.Post
|
|
4656
|
+
},
|
|
4657
|
+
demoteFromNews: {
|
|
4658
|
+
requestType: utils_1.RequestType.Post
|
|
4659
|
+
},
|
|
4660
|
+
discardPage: {
|
|
4661
|
+
requestType: utils_1.RequestType.Post
|
|
4643
4662
|
},
|
|
4644
|
-
createNewsCopy: {},
|
|
4645
|
-
demoteFromNews: {},
|
|
4646
|
-
discardPage: {},
|
|
4647
4663
|
getVersion: {
|
|
4648
4664
|
argNames: ["versionId"],
|
|
4649
4665
|
},
|
|
4650
|
-
promoteToNews: {
|
|
4651
|
-
|
|
4652
|
-
|
|
4666
|
+
promoteToNews: {
|
|
4667
|
+
requestType: utils_1.RequestType.Post
|
|
4668
|
+
},
|
|
4669
|
+
publish: {
|
|
4670
|
+
requestType: utils_1.RequestType.Post
|
|
4671
|
+
},
|
|
4672
|
+
query: {
|
|
4673
|
+
argNames: ["oData"],
|
|
4674
|
+
requestType: utils_1.RequestType.OData
|
|
4675
|
+
},
|
|
4653
4676
|
saveDraft: {
|
|
4654
4677
|
argNames: ["sitePage"],
|
|
4678
|
+
requestType: utils_1.RequestType.Post
|
|
4655
4679
|
},
|
|
4656
4680
|
savePage: {
|
|
4657
4681
|
argNames: ["pageStream"],
|
|
4682
|
+
requestType: utils_1.RequestType.Post
|
|
4658
4683
|
},
|
|
4659
4684
|
savePageAsDraft: {
|
|
4660
4685
|
argNames: ["pageStream"],
|
|
4686
|
+
requestType: utils_1.RequestType.Post
|
|
4687
|
+
},
|
|
4688
|
+
savePageAsTemplate: {
|
|
4689
|
+
requestType: utils_1.RequestType.Post
|
|
4661
4690
|
},
|
|
4662
|
-
savePageAsTemplate: {},
|
|
4663
4691
|
schedulePublish: {
|
|
4664
4692
|
argNames: ["sitePage"],
|
|
4693
|
+
requestType: utils_1.RequestType.Post
|
|
4665
4694
|
},
|
|
4666
4695
|
sharePagePreviewByEmail: {
|
|
4667
4696
|
argNames: ["message", "recipientEmails"],
|
|
4697
|
+
requestType: utils_1.RequestType.Post
|
|
4668
4698
|
},
|
|
4669
4699
|
update: {
|
|
4670
4700
|
metadataType: "",
|
|
@@ -4675,7 +4705,10 @@ exports.Mapper = {
|
|
|
4675
4705
|
},
|
|
4676
4706
|
"SP.Publishing.SitePage.Collection": {
|
|
4677
4707
|
createAppPage: {
|
|
4678
|
-
argNames: ["webPartDataAsJson"]
|
|
4708
|
+
argNames: ["webPartDataAsJson"],
|
|
4709
|
+
metadataType: "SP.Publishing.SitePage",
|
|
4710
|
+
name: "",
|
|
4711
|
+
requestType: utils_1.RequestType.PostBodyNoArgs
|
|
4679
4712
|
},
|
|
4680
4713
|
ensureTitleResource: {},
|
|
4681
4714
|
feed: {
|
|
@@ -4705,10 +4738,12 @@ exports.Mapper = {
|
|
|
4705
4738
|
query: { argNames: ["oData"], requestType: utils_1.RequestType.OData },
|
|
4706
4739
|
templates: {},
|
|
4707
4740
|
updateAppPage: {
|
|
4708
|
-
argNames: ["pageId", "webPartDataAsJson", "title", "includeInNavigation"]
|
|
4741
|
+
argNames: ["pageId", "webPartDataAsJson", "title", "includeInNavigation"],
|
|
4742
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
4709
4743
|
},
|
|
4710
4744
|
updateFullPageApp: {
|
|
4711
|
-
argNames: ["serverRelativeUrl", "webPartDataAsJson"]
|
|
4745
|
+
argNames: ["serverRelativeUrl", "webPartDataAsJson"],
|
|
4746
|
+
requestType: utils_1.RequestType.PostWithArgsInBody
|
|
4712
4747
|
}
|
|
4713
4748
|
},
|
|
4714
4749
|
"SP.Publishing.SitePage3D": {
|
|
@@ -4758,11 +4793,17 @@ exports.Mapper = {
|
|
|
4758
4793
|
query: { argNames: ["oData"], requestType: utils_1.RequestType.OData },
|
|
4759
4794
|
},
|
|
4760
4795
|
"SP.Publishing.SitePageService": {
|
|
4796
|
+
properties: [
|
|
4797
|
+
"CommunicationSite|SP.Publishing.CommunicationSite",
|
|
4798
|
+
"Pages|SP.Publishing.SitePage.Collection|('[Name]')|SP.Publishing.SitePage"
|
|
4799
|
+
],
|
|
4761
4800
|
addImage: {
|
|
4762
4801
|
argNames: ["pageName", "imageFileName", "imageStream", "pageId"],
|
|
4802
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
4763
4803
|
},
|
|
4764
4804
|
addImageFromExternalUrl: {
|
|
4765
4805
|
argNames: ["pageName", "imageFileName", "externalUrl", "subFolderName", "pageId"],
|
|
4806
|
+
requestType: utils_1.RequestType.PostWithArgs
|
|
4766
4807
|
},
|
|
4767
4808
|
canCreatePage: {},
|
|
4768
4809
|
canCreatePromotedPage: {},
|
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.00,
|
|
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/request.js
CHANGED
|
@@ -321,9 +321,16 @@ exports.Request = {
|
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
323
323
|
// Validate the data collection
|
|
324
|
-
exports.Request.validateDataCollectionResults(base).then(
|
|
324
|
+
exports.Request.validateDataCollectionResults(base).then(
|
|
325
|
+
// Success
|
|
326
|
+
function () {
|
|
325
327
|
// Execute the callback
|
|
326
328
|
callback ? callback(base, errorFl) : null;
|
|
329
|
+
},
|
|
330
|
+
// Error
|
|
331
|
+
function () {
|
|
332
|
+
// Execute the callback and set the error flag
|
|
333
|
+
callback ? callback(base, true) : null;
|
|
327
334
|
});
|
|
328
335
|
}
|
|
329
336
|
}
|
|
@@ -541,8 +548,16 @@ exports.Request = {
|
|
|
541
548
|
var request = function (xhr, resolve) {
|
|
542
549
|
// Validate the response
|
|
543
550
|
if (xhr && xhr.status < 400 && typeof (xhr.response) === "string" && xhr.response.length > 0) {
|
|
544
|
-
//
|
|
545
|
-
var data =
|
|
551
|
+
// Try to convert the response and ensure the data property exists
|
|
552
|
+
var data = null;
|
|
553
|
+
try {
|
|
554
|
+
data = JSON.parse(xhr.response);
|
|
555
|
+
}
|
|
556
|
+
// Reject the request
|
|
557
|
+
catch (_a) {
|
|
558
|
+
reject();
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
546
561
|
// Set the next item flag
|
|
547
562
|
base.nextFl = data.d && data.d.__next;
|
|
548
563
|
// See if there are more items to get
|
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
|
*/
|