gd-sprest 7.8.9 → 7.9.1
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/README.md +5 -6
- package/build/helper/spCfg.js +174 -160
- package/build/rest.js +1 -1
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
The SharePoint REST Framework was designed for SharePoint 2013, but works in both SharePoint 2013/Online (Classic/Modern) pages. This framework is designed to remove the overhead required for SharePoint development, allowing the developer to focus on the client requirements.
|
|
9
9
|
|
|
10
|
-
<center><img alt="intellisense" src="
|
|
10
|
+
<center><img alt="intellisense" src="assets/images/intellisense.gif" style="max-height: 500px;" /></center>
|
|
11
11
|
|
|
12
12
|
### References
|
|
13
13
|
|
|
14
|
-
- [gd-sprest](api) - An easy way to execute requests against the SharePoint 2013/Online REST
|
|
15
|
-
- [gd-sprest-bs](extras/bs) - Extends the [Bootstrap Framework](https://getbootstrap.com) with components designed for SharePoint 2013/Online.
|
|
16
|
-
- [gd-sprest-bs-vue](extras/bs) - Extends the [gd-sprest-bs](extras/bs) library for use with vue projects.
|
|
14
|
+
- [gd-sprest](api) - An easy way to execute requests against the SharePoint 2013/Online REST API
|
|
17
15
|
- [gd-sprest-def](https://github.com/gunjandatta/sprest-def) - Generates TypeScript definition files from the $metadata SharePoint REST endpoint, for this library.
|
|
18
|
-
- [gd-sprest-
|
|
16
|
+
- [gd-sprest-bs](bs) - Extends the [Bootstrap Framework](https://getbootstrap.com) with components designed for SharePoint 2013/Online.
|
|
19
17
|
|
|
20
18
|
### Core Library
|
|
21
19
|
|
|
@@ -26,6 +24,7 @@ The gd-sprest library is similar to the pnp-js, with the main difference being t
|
|
|
26
24
|
- Ability to create reusable scripts/solutions
|
|
27
25
|
- Intellisense is available for JavaScript/TypeScript
|
|
28
26
|
- Ability to execute live requests from the browser console, helps to debug issues in production
|
|
27
|
+
- Ability to use pure JavaScript if NodeJS is not available to be installed for TypeScript/WebPack/Babel
|
|
29
28
|
|
|
30
29
|
### Bugs/Issues/Missing Functionality
|
|
31
30
|
|
|
@@ -47,4 +46,4 @@ Follow the [documentation](https://gunjandatta.github.io/dev/spfx) for steps on
|
|
|
47
46
|
|
|
48
47
|
### Security
|
|
49
48
|
|
|
50
|
-
The REST api execute requests based on the user's permissions. There is no way to elevate privileges requests against the SharePoint REST.
|
|
49
|
+
The REST api execute requests based on the user's permissions. There is no way to elevate privileges requests against the SharePoint REST.
|
package/build/helper/spCfg.js
CHANGED
|
@@ -1123,186 +1123,200 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1123
1123
|
getWebUrl: function () { return webUrl; },
|
|
1124
1124
|
// Method to install the configuration
|
|
1125
1125
|
install: function () {
|
|
1126
|
+
var initSPLib = function () {
|
|
1127
|
+
return new Promise(function (resolve) {
|
|
1128
|
+
// See if the SP lib exists
|
|
1129
|
+
if (window["SP"]) {
|
|
1130
|
+
resolve(null);
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
// Load the core lib
|
|
1134
|
+
_1.loadSPCore().then(function () { resolve(null); });
|
|
1135
|
+
});
|
|
1136
|
+
};
|
|
1126
1137
|
// Return a promise
|
|
1127
1138
|
return new Promise(function (resolve, reject) {
|
|
1128
|
-
//
|
|
1129
|
-
|
|
1130
|
-
//
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
//
|
|
1137
|
-
|
|
1138
|
-
//
|
|
1139
|
-
|
|
1140
|
-
//
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
//
|
|
1145
|
-
|
|
1146
|
-
//
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1139
|
+
// Ensure the SP core lib exists
|
|
1140
|
+
initSPLib().then(function () {
|
|
1141
|
+
// Set the request digest
|
|
1142
|
+
setRequestDigest().then(function () {
|
|
1143
|
+
// Log
|
|
1144
|
+
console.log("[gd-sprest] Installing the web assets...");
|
|
1145
|
+
// Get the web
|
|
1146
|
+
var web = lib_1.Web(webUrl, { disableCache: true, requestDigest: _requestDigest });
|
|
1147
|
+
// Create the site fields
|
|
1148
|
+
var createSiteFields = function () {
|
|
1149
|
+
// Return a promise
|
|
1150
|
+
return new Promise(function (resolve, reject) {
|
|
1151
|
+
// See if we are creating fields
|
|
1152
|
+
if (cfg.Fields && cfg.Fields.length > 0) {
|
|
1153
|
+
// Log
|
|
1154
|
+
console.log("[gd-sprest][Fields] Starting the requests.");
|
|
1155
|
+
// Get the fields
|
|
1156
|
+
web.Fields().execute(function (fields) {
|
|
1157
|
+
// Create the fields
|
|
1158
|
+
createFields(fields, cfg.Fields).then(function () {
|
|
1159
|
+
// Log
|
|
1160
|
+
console.log("[gd-sprest][Fields] Completed the requests.");
|
|
1161
|
+
// Resolve the promise
|
|
1162
|
+
resolve(null);
|
|
1163
|
+
}, reject);
|
|
1150
1164
|
}, reject);
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1165
|
+
}
|
|
1166
|
+
else {
|
|
1167
|
+
// Resolve the promise
|
|
1168
|
+
resolve(null);
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
};
|
|
1172
|
+
// Create the site content types
|
|
1173
|
+
var createSiteContentTypes = function () {
|
|
1174
|
+
// Return a promise
|
|
1175
|
+
return new Promise(function (resolve, reject) {
|
|
1176
|
+
// See if we are creating the content types
|
|
1177
|
+
if (cfg.ContentTypes && cfg.ContentTypes.length > 0) {
|
|
1178
|
+
// Log
|
|
1179
|
+
console.log("[gd-sprest][Content Types] Starting the requests.");
|
|
1180
|
+
// Get the content types
|
|
1181
|
+
web.ContentTypes().execute(function (contentTypes) {
|
|
1182
|
+
// Create the content types
|
|
1183
|
+
createContentTypes(contentTypes, cfg.ContentTypes).then(function () {
|
|
1184
|
+
// Log
|
|
1185
|
+
console.log("[gd-sprest][Content Types] Completed the requests.");
|
|
1186
|
+
// Resolve the promise
|
|
1187
|
+
resolve();
|
|
1188
|
+
}, reject);
|
|
1175
1189
|
}, reject);
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
// Resolve the promise
|
|
1193
|
+
resolve();
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
};
|
|
1197
|
+
// Create the site lists
|
|
1198
|
+
var createSiteLists = function () {
|
|
1199
|
+
// Return a promise
|
|
1200
|
+
return new Promise(function (resolve, reject) {
|
|
1201
|
+
// See if we are creating the lists
|
|
1202
|
+
if (cfg.ListCfg && cfg.ListCfg.length) {
|
|
1203
|
+
// Log
|
|
1204
|
+
console.log("[gd-sprest][Lists] Starting the requests.");
|
|
1205
|
+
// Get the lists
|
|
1206
|
+
web.Lists().execute(function (lists) {
|
|
1207
|
+
// Create the lists
|
|
1208
|
+
createLists(lists, cfg.ListCfg).then(function () {
|
|
1209
|
+
// Log
|
|
1210
|
+
console.log("[gd-sprest][Lists] Completed the requests.");
|
|
1211
|
+
// Resolve the promise
|
|
1212
|
+
resolve();
|
|
1213
|
+
}, reject);
|
|
1214
|
+
}, reject);
|
|
1215
|
+
}
|
|
1216
|
+
else {
|
|
1217
|
+
// Resolve the promise
|
|
1218
|
+
resolve();
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
};
|
|
1222
|
+
// Create the site webparts
|
|
1223
|
+
var createSiteWebParts = function () {
|
|
1224
|
+
// Return a promise
|
|
1225
|
+
return new Promise(function (resolve, reject) {
|
|
1226
|
+
// See if we are creating the webparts
|
|
1227
|
+
if (cfg.WebPartCfg && cfg.WebPartCfg.length > 0) {
|
|
1228
|
+
// Log
|
|
1229
|
+
console.log("[gd-sprest][WebParts] Starting the requests.");
|
|
1230
|
+
// Create the webparts
|
|
1231
|
+
createWebParts().then(function () {
|
|
1196
1232
|
// Log
|
|
1197
|
-
console.log("[gd-sprest][
|
|
1233
|
+
console.log("[gd-sprest][WebParts] Completed the requests.");
|
|
1198
1234
|
// Resolve the promise
|
|
1199
1235
|
resolve();
|
|
1200
1236
|
}, reject);
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
if (cfg.WebPartCfg && cfg.WebPartCfg.length > 0) {
|
|
1215
|
-
// Log
|
|
1216
|
-
console.log("[gd-sprest][WebParts] Starting the requests.");
|
|
1217
|
-
// Create the webparts
|
|
1218
|
-
createWebParts().then(function () {
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
// Resolve the promise
|
|
1240
|
+
resolve();
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
// Create the custom actions
|
|
1245
|
+
var createSiteCollectionCustomActions = function () {
|
|
1246
|
+
// Return a promise
|
|
1247
|
+
return new Promise(function (resolve, reject) {
|
|
1248
|
+
// See if we are targeting the site collection
|
|
1249
|
+
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Site) {
|
|
1219
1250
|
// Log
|
|
1220
|
-
console.log("[gd-sprest][
|
|
1251
|
+
console.log("[gd-sprest][Site Custom Actions] Starting the requests.");
|
|
1252
|
+
// Get the site
|
|
1253
|
+
lib_1.Site(webUrl, { disableCache: true, requestDigest: _requestDigest })
|
|
1254
|
+
// Get the user custom actions
|
|
1255
|
+
.UserCustomActions().execute(function (customActions) {
|
|
1256
|
+
// Create the user custom actions
|
|
1257
|
+
createUserCustomActions(customActions, cfg.CustomActionCfg.Site).then(function () {
|
|
1258
|
+
// Log
|
|
1259
|
+
console.log("[gd-sprest][Site Custom Actions] Completed the requests.");
|
|
1260
|
+
// Resolve the promise
|
|
1261
|
+
resolve();
|
|
1262
|
+
}, reject);
|
|
1263
|
+
}, reject);
|
|
1264
|
+
}
|
|
1265
|
+
else {
|
|
1221
1266
|
// Resolve the promise
|
|
1222
1267
|
resolve();
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
return new Promise(function (resolve, reject) {
|
|
1235
|
-
// See if we are targeting the site collection
|
|
1236
|
-
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Site) {
|
|
1237
|
-
// Log
|
|
1238
|
-
console.log("[gd-sprest][Site Custom Actions] Starting the requests.");
|
|
1239
|
-
// Get the site
|
|
1240
|
-
lib_1.Site(webUrl, { disableCache: true, requestDigest: _requestDigest })
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
};
|
|
1271
|
+
// Create the custom actions
|
|
1272
|
+
var createSiteCustomActions = function () {
|
|
1273
|
+
// Return a promise
|
|
1274
|
+
return new Promise(function (resolve, reject) {
|
|
1275
|
+
// See if we are targeting the web
|
|
1276
|
+
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Web) {
|
|
1277
|
+
// Log
|
|
1278
|
+
console.log("[gd-sprest][Web Custom Actions] Starting the requests.");
|
|
1241
1279
|
// Get the user custom actions
|
|
1242
|
-
.UserCustomActions().execute(function (customActions) {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
// Log
|
|
1246
|
-
console.log("[gd-sprest][Site Custom Actions] Completed the requests.");
|
|
1247
|
-
// Resolve the promise
|
|
1248
|
-
resolve();
|
|
1249
|
-
}, reject);
|
|
1250
|
-
}, reject);
|
|
1251
|
-
}
|
|
1252
|
-
else {
|
|
1253
|
-
// Resolve the promise
|
|
1254
|
-
resolve();
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1257
|
-
};
|
|
1258
|
-
// Create the custom actions
|
|
1259
|
-
var createSiteCustomActions = function () {
|
|
1260
|
-
// Return a promise
|
|
1261
|
-
return new Promise(function (resolve, reject) {
|
|
1262
|
-
// See if we are targeting the web
|
|
1263
|
-
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Web) {
|
|
1264
|
-
// Log
|
|
1265
|
-
console.log("[gd-sprest][Web Custom Actions] Starting the requests.");
|
|
1266
|
-
// Get the user custom actions
|
|
1267
|
-
web.UserCustomActions().execute(function (customActions) {
|
|
1268
|
-
// Create the user custom actions
|
|
1269
|
-
createUserCustomActions(customActions, cfg.CustomActionCfg.Web).then(function () {
|
|
1270
|
-
// Log
|
|
1271
|
-
console.log("[gd-sprest][Web Custom Actions] Completed the requests.");
|
|
1272
|
-
// Resolve the promise
|
|
1273
|
-
resolve();
|
|
1274
|
-
});
|
|
1275
|
-
}, reject);
|
|
1276
|
-
}
|
|
1277
|
-
else {
|
|
1278
|
-
// Resolve the promise
|
|
1279
|
-
resolve();
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
};
|
|
1283
|
-
// Create the site fields
|
|
1284
|
-
createSiteFields().then(function () {
|
|
1285
|
-
// Create the site content types
|
|
1286
|
-
createSiteContentTypes().then(function () {
|
|
1287
|
-
// Create the site lists
|
|
1288
|
-
createSiteLists().then(function () {
|
|
1289
|
-
// Create the webparts
|
|
1290
|
-
createSiteWebParts().then(function () {
|
|
1291
|
-
// Create the site collection custom actions
|
|
1292
|
-
createSiteCollectionCustomActions().then(function () {
|
|
1293
|
-
// Create the site custom actions
|
|
1294
|
-
createSiteCustomActions().then(function () {
|
|
1280
|
+
web.UserCustomActions().execute(function (customActions) {
|
|
1281
|
+
// Create the user custom actions
|
|
1282
|
+
createUserCustomActions(customActions, cfg.CustomActionCfg.Web).then(function () {
|
|
1295
1283
|
// Log
|
|
1296
|
-
console.log("[gd-sprest]
|
|
1297
|
-
// Resolve the
|
|
1284
|
+
console.log("[gd-sprest][Web Custom Actions] Completed the requests.");
|
|
1285
|
+
// Resolve the promise
|
|
1298
1286
|
resolve();
|
|
1287
|
+
});
|
|
1288
|
+
}, reject);
|
|
1289
|
+
}
|
|
1290
|
+
else {
|
|
1291
|
+
// Resolve the promise
|
|
1292
|
+
resolve();
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
};
|
|
1296
|
+
// Create the site fields
|
|
1297
|
+
createSiteFields().then(function () {
|
|
1298
|
+
// Create the site content types
|
|
1299
|
+
createSiteContentTypes().then(function () {
|
|
1300
|
+
// Create the site lists
|
|
1301
|
+
createSiteLists().then(function () {
|
|
1302
|
+
// Create the webparts
|
|
1303
|
+
createSiteWebParts().then(function () {
|
|
1304
|
+
// Create the site collection custom actions
|
|
1305
|
+
createSiteCollectionCustomActions().then(function () {
|
|
1306
|
+
// Create the site custom actions
|
|
1307
|
+
createSiteCustomActions().then(function () {
|
|
1308
|
+
// Log
|
|
1309
|
+
console.log("[gd-sprest] The configuration script completed, but some requests may still be running.");
|
|
1310
|
+
// Resolve the request
|
|
1311
|
+
resolve();
|
|
1312
|
+
}, reject);
|
|
1299
1313
|
}, reject);
|
|
1300
1314
|
}, reject);
|
|
1301
1315
|
}, reject);
|
|
1302
1316
|
}, reject);
|
|
1303
1317
|
}, reject);
|
|
1304
1318
|
}, reject);
|
|
1305
|
-
}
|
|
1319
|
+
});
|
|
1306
1320
|
});
|
|
1307
1321
|
},
|
|
1308
1322
|
// Method to update the web url to target
|
package/build/rest.js
CHANGED