Skip to content

Commit

Permalink
Merge pull request #202 from gunjandatta/gdatta
Browse files Browse the repository at this point in the history
Major Update - Intellisense
  • Loading branch information
gunjandatta authored Feb 3, 2019
2 parents 6d9a86f + 761d600 commit b3de0fb
Show file tree
Hide file tree
Showing 104 changed files with 977 additions and 10,376 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ The SharePoint REST Framework was designed for SharePoint 2013, but works in bot

## References

- [gd-sprest](https://gunjandatta.github.io/api) - An easy way to execute requests against the SharePoint 2013/Online REST api
- [gd-sprest-bs](https://gunjandatta.github.io/extras/bs) - Extends the [Bootstrap Framework](https://getbootstrap.com) with components designed for SharePoint 2013/Online.
- [gd-sprest-def](https://github.com/gunjandatta/sprest-def) - Generates TypeScript definition files from the $metadata SharePoint REST endpoint. This allows any project to reference the intellisense in any JavaScript/TypeScript project.
- [gd-sprest-react](https://gunjandatta.github.io/extras/react) - Extends the [Office Fabric React Framework](https://dev.office.com/fabric) with components designed for SharePoint 2013/Online.
- [gd-sprest](api) - An easy way to execute requests against the SharePoint 2013/Online REST api
- [gd-sprest-bs](extras/bs) - Extends the [Bootstrap Framework](https://getbootstrap.com) with components designed for SharePoint 2013/Online.
- [gd-sprest-def](https://github.com/gunjandatta/sprest-def) - Generates TypeScript definition files from the $metadata SharePoint REST endpoint, for this library.
- [gd-sprest-react](extras/react) - Extends the [Office Fabric React Framework](https://dev.office.com/fabric) with components designed for SharePoint 2013/Online.

## Core Library

Expand All @@ -25,35 +25,37 @@ The gd-sprest library is similar to the pnp-js-core, with the main difference be

[Click Here](https://github.com/gunjandatta/sprest/issues) to report any bugs, request any new features or if need help with code examples. Pull requests are welcomed for anyone interested in submitting them. Feel free to [email](mailto:[email protected]) for other questions.

### [Caching](https://gunjandatta.github.io//topics/caching)
### [Caching](/topics/caching)

The library has been designed to create the SharePoint object based on the response from the SharePoint REST API. This will allow us to easily stringify the request's target information and the SharePoint REST API's response to the local or storage session. A built-in stringify and parse method has been included in the library. Based on this design, SharePoint object will also contain all of its built-in methods.

### Intellisense

The intellisense for this library is included as part of the npm installation. It should work with both JavaScript/TypeScript.
The SharePoint REST API has a $metadata endpoint which contains the intellisense for its objects. This library's intellisense is generated from this data to ensure the latest functions/methods are made available for OnPremise and Online.

### [Helpers](https://gunjandatta.github.io//helpers)
The intellisense for this library is included as part of the npm installation. It supports both JavaScript and TypeScript. The nuget installation includes the bundled definition file as part of the library.

### [Helpers](/helpers)

The library contains various helpers to help with the various ways to develop against SharePoint 2013/Online

### Modern Experience in SharePoint 2013

One of the key reasons of creating this libray, was to give an easy way to develop using the modern web stack in SharePoint 2013 environments.

#### [Bootstrap](https://gunjandatta.github.io/extras/bs)
#### [Bootstrap](extras/bs)

The [gd-sprest-bs](https://gunjandatta.github.io/extras/bs) library extends the [Bootstrap](https://getbootstrap.com) framework to create modern web components for SharePoint 2013/Online.
The [gd-sprest-bs](extras/bs) library extends the [Bootstrap](https://getbootstrap.com) framework to create modern web components for SharePoint 2013/Online.

### User Adoption
Since these components are designed using same framework creating the new Office 365 modern experience, this gives the ability to introduce the new Office 365 experience within SharePoint 2013. This will be an important part for the SharePoint 2013 user adoption to the new modern experience. Most SharePoint 2010/2013 environments are undergoing upgrades to 2016, Hybrid 2016/O365, O365 and private O365-Gov environments.

### [Automation of SharePoint Assets](https://gunjandatta.github.io//topics/automation)
### [Automation of SharePoint Assets](/topics/automation)
The SharePoint Configuration automation feature allows the develoepr to easily create built-in scripts to install/uninstall SharePoint assets. This feature is designed to work in both SharePoint 2013 and Online.

### Conversions

#### [Server-Side to Client-Side Conversion Guide](https://gunjandatta.github.io/development/serverside-conversion-guide)
#### [Server-Side to Client-Side Conversion Guide](development/serverside-conversion-guide)

The execution method was designed to give a server-side like experience, similar to SharePoint 2010/2013 solutions. This will help convert existing server-side solutions to client-side solutions.

Expand All @@ -64,4 +66,4 @@ The javascript, typescript, react/angular/react/etc solutions developed for Shar
Refer to the [documentation](https://gunjandatta.github.io/development/spfx) for steps on configuring this library in a SPFX project.

### Security
The REST api execute requests based on the user's permissions. There is no way to elevate priviledges requests against the SharePoint REST.
The REST api execute requests based on the user's permissions. There is no way to elevate priviledges requests against the SharePoint REST.
2 changes: 1 addition & 1 deletion build/helper/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.App = {
// See if the file exists
if (file.Exists) {
// Check out the file, and resolve the promise
file.checkout().execute(resolve);
file.checkOut().execute(resolve);
}
else {
// Resolve the promise
Expand Down
2 changes: 1 addition & 1 deletion build/helper/listFormField.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports.ListFormField = {
case __1.SPTypes.FieldType.Choice:
case __1.SPTypes.FieldType.MultiChoice:
var choices = _fieldInfo.field.Choices;
_fieldInfo.choices = (choices ? choices.results : null) || [];
_fieldInfo.choices = (choices ? choices["results"] : null) || [];
_fieldInfo.multi = _fieldInfo.type == __1.SPTypes.FieldType.MultiChoice;
break;
// Date/Time
Expand Down
16 changes: 8 additions & 8 deletions build/helper/spCfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./spCfgTypes"));
var lib_1 = require("../lib");
var __1 = require("..");
var _1 = require(".");
__export(require("./spCfgTypes"));
/**
* SharePoint Configuration
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ exports.SPConfig = function (cfg, webUrl) {
// Add the available content type
contentTypes.addAvailableContentType(parent.results[0].Id.StringValue).execute(function (ct) {
// See if it was successful
if (ct.existsFl) {
if (ct.Name) {
// Update the name
(function () {
return new Promise(function (resolve, reject) {
Expand Down Expand Up @@ -110,7 +110,7 @@ exports.SPConfig = function (cfg, webUrl) {
Name: cfgContentType.Name
}).execute(function (ct) {
// See if it was successful
if (ct.existsFl) {
if (ct.Name) {
// Log
console.log("[gd-sprest][Content Type] The content type '" + cfgContentType.Name + "' was created successfully.");
// Update the configuration
Expand Down Expand Up @@ -235,7 +235,7 @@ exports.SPConfig = function (cfg, webUrl) {
// The field created event
var onFieldCreated_1 = function (field) {
// See if it was successful
if (field.existsFl) {
if (field.InternalName) {
// Log
console.log("[gd-sprest][Field] The field '" + field.InternalName + "' was created successfully.");
// Trigger the event
Expand Down Expand Up @@ -302,9 +302,9 @@ exports.SPConfig = function (cfg, webUrl) {
// Restore the list name in the configuration
listInfo_1.Title = listName_1;
// See if the request was successful
if (list.existsFl) {
if (list.Id) {
// See if we need to update the list
if (list.existsFl && list.Title != listName_1) {
if (list.Title != listName_1) {
// Update the list
list.update({ Title: listName_1 }).execute(function () {
// Log
Expand Down Expand Up @@ -496,7 +496,7 @@ exports.SPConfig = function (cfg, webUrl) {
};
// See if this webpart exists
var file = isInCollection("Name", cfgWebPart.FileName, folder.Files.results);
if (file.existsFl) {
if (file.Name) {
// Log
console.log("[gd-sprest][WebPart] The webpart '" + cfgWebPart.FileName + "' already exists.");
// Trigger the event
Expand All @@ -514,7 +514,7 @@ exports.SPConfig = function (cfg, webUrl) {
bufferView[j] = xml.charCodeAt(j);
}
// Create the webpart, but execute the requests one at a time
folder.Files.add(true, cfgWebPart.FileName, buffer).execute(function (file) {
folder.Files.add(cfgWebPart.FileName, true, buffer).execute(function (file) {
// See if group exists
if (cfgWebPart.Group) {
// Set the target to the root web
Expand Down
11 changes: 1 addition & 10 deletions build/lib/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,11 @@ exports.Search = (function (url, targetInfo) {
requestType: utils_1.RequestType.GetReplace
}, exports.Search.getQuery(settings));
};
/** The search suggest method */
search["suggest"] = function (settings /*SearchSuggestion*/) {
// Execute the request
return search.executeMethod("query", {
argNames: ["query"],
name: "suggest?[[query]]",
requestType: utils_1.RequestType.GetReplace
}, exports.Search.getQuery(settings));
};
// Return the search
return search;
});
// Static method to compute the query
exports.Search.getQuery = function (parameters /* | Types.ComplexTypes.SearchSuggestion*/) {
exports.Search.getQuery = function (parameters) {
var query = "";
// Parse the parameters
for (var key in parameters) {
Expand Down
50 changes: 26 additions & 24 deletions build/lib/socialFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,32 @@ exports.SocialFeed = (function (targetInfo) {
base.targetInfo.endpoint = "social.feed";
// Add the methods
utils_1.Request.addMethods(socialFeed, { __metadata: { type: "socialfeed" } });
// Method to post to another user's feed
socialFeed.postToFeed = function (accountName, creationData) {
var postInfo = { ID: null, creationData: creationData };
// Set the post metadata
postInfo["__metadata"] = { type: "SP.Social.SocialRestPostCreationData" };
postInfo.creationData["__metadata"] = { type: "SP.Social.SocialPostCreationData" };
return socialFeed.executeMethod("postToMyFeed", {
argNames: ["restCreationData"],
name: "actor(item=@v)/feed?@v='" + encodeURIComponent(accountName) + "'",
requestType: utils_1.RequestType.PostWithArgsInBody
}, [postInfo]);
};
// Method to post to the current user's feed
socialFeed.postToMyFeed = function (creationData) {
var postInfo = { ID: null, creationData: creationData };
// Set the post metadata
postInfo["__metadata"] = { type: "SP.Social.SocialRestPostCreationData" };
postInfo.creationData["__metadata"] = { type: "SP.Social.SocialPostCreationData" };
return socialFeed.executeMethod("postToMyFeed", {
argNames: ["restCreationData"],
name: "my/feed/post",
requestType: utils_1.RequestType.PostWithArgsInBody
}, [postInfo]);
};
// Return the social feed
return socialFeed;
});
// Method to post to another user's feed
exports.SocialFeed.postToFeed = function (accountName, creationData) {
var postInfo = { ID: null, creationData: creationData };
// Set the post metadata
postInfo["__metadata"] = { type: "SP.Social.SocialRestPostCreationData" };
postInfo.creationData["__metadata"] = { type: "SP.Social.SocialPostCreationData" };
// Execute the request
return exports.SocialFeed().executeMethod("postToMyFeed", {
argNames: ["restCreationData"],
name: "actor(item=@v)/feed?@v='" + encodeURIComponent(accountName) + "'",
requestType: utils_1.RequestType.PostWithArgsInBody
}, [postInfo]);
};
// Method to post to the current user's feed
exports.SocialFeed.postToMyFeed = function (creationData) {
var postInfo = { ID: null, creationData: creationData };
// Set the post metadata
postInfo["__metadata"] = { type: "SP.Social.SocialRestPostCreationData" };
postInfo.creationData["__metadata"] = { type: "SP.Social.SocialPostCreationData" };
// Execute the request
return exports.SocialFeed().executeMethod("postToMyFeed", {
argNames: ["restCreationData"],
name: "my/feed/post",
requestType: utils_1.RequestType.PostWithArgsInBody
}, [postInfo]);
};
2 changes: 1 addition & 1 deletion build/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var Mapper = require("./mapper");
* SharePoint REST Library
*/
exports.$REST = {
__ver: 4.52,
__ver: 4.59,
AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
ContextInfo: Lib.ContextInfo,
DefaultRequestToHostFl: false,
Expand Down
Loading

0 comments on commit b3de0fb

Please sign in to comment.