gd-sprest 7.9.0 → 7.9.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.
@@ -32,7 +32,7 @@ exports.createContentType = function (ctInfo, parentInfo, webUrl, listName) {
32
32
  // Success
33
33
  function () {
34
34
  // Set the content type collection
35
- var cts = (listName ? lib_1.Web().Lists(listName) : lib_1.Web()).ContentTypes();
35
+ var cts = (listName ? lib_1.Web(webUrl).Lists(listName) : lib_1.Web(webUrl)).ContentTypes();
36
36
  // Find the content type
37
37
  cts.query({ Filter: "Name eq '" + ctInfo.Name + "'" }).execute(function (cts) {
38
38
  // Resolve the request
@@ -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
- // Set the request digest
1129
- setRequestDigest().then(function () {
1130
- // Log
1131
- console.log("[gd-sprest] Installing the web assets...");
1132
- // Get the web
1133
- var web = lib_1.Web(webUrl, { disableCache: true, requestDigest: _requestDigest });
1134
- // Create the site fields
1135
- var createSiteFields = function () {
1136
- // Return a promise
1137
- return new Promise(function (resolve, reject) {
1138
- // See if we are creating fields
1139
- if (cfg.Fields && cfg.Fields.length > 0) {
1140
- // Log
1141
- console.log("[gd-sprest][Fields] Starting the requests.");
1142
- // Get the fields
1143
- web.Fields().execute(function (fields) {
1144
- // Create the fields
1145
- createFields(fields, cfg.Fields).then(function () {
1146
- // Log
1147
- console.log("[gd-sprest][Fields] Completed the requests.");
1148
- // Resolve the promise
1149
- resolve(null);
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
- }, reject);
1152
- }
1153
- else {
1154
- // Resolve the promise
1155
- resolve(null);
1156
- }
1157
- });
1158
- };
1159
- // Create the site content types
1160
- var createSiteContentTypes = function () {
1161
- // Return a promise
1162
- return new Promise(function (resolve, reject) {
1163
- // See if we are creating the content types
1164
- if (cfg.ContentTypes && cfg.ContentTypes.length > 0) {
1165
- // Log
1166
- console.log("[gd-sprest][Content Types] Starting the requests.");
1167
- // Get the content types
1168
- web.ContentTypes().execute(function (contentTypes) {
1169
- // Create the content types
1170
- createContentTypes(contentTypes, cfg.ContentTypes).then(function () {
1171
- // Log
1172
- console.log("[gd-sprest][Content Types] Completed the requests.");
1173
- // Resolve the promise
1174
- resolve();
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
- }, reject);
1177
- }
1178
- else {
1179
- // Resolve the promise
1180
- resolve();
1181
- }
1182
- });
1183
- };
1184
- // Create the site lists
1185
- var createSiteLists = function () {
1186
- // Return a promise
1187
- return new Promise(function (resolve, reject) {
1188
- // See if we are creating the lists
1189
- if (cfg.ListCfg && cfg.ListCfg.length) {
1190
- // Log
1191
- console.log("[gd-sprest][Lists] Starting the requests.");
1192
- // Get the lists
1193
- web.Lists().execute(function (lists) {
1194
- // Create the lists
1195
- createLists(lists, cfg.ListCfg).then(function () {
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][Lists] Completed the requests.");
1233
+ console.log("[gd-sprest][WebParts] Completed the requests.");
1198
1234
  // Resolve the promise
1199
1235
  resolve();
1200
1236
  }, reject);
1201
- }, reject);
1202
- }
1203
- else {
1204
- // Resolve the promise
1205
- resolve();
1206
- }
1207
- });
1208
- };
1209
- // Create the site webparts
1210
- var createSiteWebParts = function () {
1211
- // Return a promise
1212
- return new Promise(function (resolve, reject) {
1213
- // See if we are creating the webparts
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][WebParts] Completed the requests.");
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
- }, reject);
1224
- }
1225
- else {
1226
- // Resolve the promise
1227
- resolve();
1228
- }
1229
- });
1230
- };
1231
- // Create the custom actions
1232
- var createSiteCollectionCustomActions = function () {
1233
- // Return a promise
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
- // Create the user custom actions
1244
- createUserCustomActions(customActions, cfg.CustomActionCfg.Site).then(function () {
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] The configuration script completed, but some requests may still be running.");
1297
- // Resolve the request
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
- }, reject);
1319
+ });
1306
1320
  });
1307
1321
  },
1308
1322
  // Method to update the web url to target
package/build/rest.js CHANGED
@@ -9,7 +9,7 @@ var sptypes_1 = require("./sptypes");
9
9
  * SharePoint REST Library
10
10
  */
11
11
  exports.$REST = {
12
- __ver: 7.90,
12
+ __ver: 7.92,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,