gd-sprest 8.0.4 → 8.0.6
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/helper/spCfg.d.ts +4 -1
- package/build/helper/spCfg.js +78 -62
- package/build/rest.js +1 -1
- package/build/utils/batch.js +2 -1
- package/build/utils/request.js +1 -1
- package/dist/gd-sprest.d.ts +3 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
package/@types/helper/spCfg.d.ts
CHANGED
|
@@ -428,7 +428,7 @@ export interface ISPCfgViewInfo {
|
|
|
428
428
|
|
|
429
429
|
/** The row limit property. */
|
|
430
430
|
RowLimit?: number;
|
|
431
|
-
|
|
431
|
+
|
|
432
432
|
/** Flag to enable the tabular view option. */
|
|
433
433
|
Tabular?: boolean;
|
|
434
434
|
|
|
@@ -519,6 +519,9 @@ export interface ISPConfigProps {
|
|
|
519
519
|
/** The list configuration. */
|
|
520
520
|
ListCfg?: Array<ISPCfgListInfo>;
|
|
521
521
|
|
|
522
|
+
/** Event for the logging of the configuration. */
|
|
523
|
+
onLogMessage?: (msg: string) => void;
|
|
524
|
+
|
|
522
525
|
/** The web part configuration. */
|
|
523
526
|
WebPartCfg?: Array<ISPCfgWebPartInfo>;
|
|
524
527
|
}
|
package/build/helper/spCfg.js
CHANGED
|
@@ -25,6 +25,22 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
25
25
|
var _requestDigest = null;
|
|
26
26
|
// The target name to install/uninstall
|
|
27
27
|
var _targetName;
|
|
28
|
+
/**
|
|
29
|
+
* Logging
|
|
30
|
+
*/
|
|
31
|
+
var logMessage = function (message, isError) {
|
|
32
|
+
if (isError === void 0) { isError = false; }
|
|
33
|
+
// See if this is an error
|
|
34
|
+
if (isError) {
|
|
35
|
+
// Log the error
|
|
36
|
+
console.error(message);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
console.log(message);
|
|
40
|
+
}
|
|
41
|
+
// Call the event
|
|
42
|
+
cfg.onLogMessage ? cfg.onLogMessage(message) : null;
|
|
43
|
+
};
|
|
28
44
|
/**
|
|
29
45
|
* Methods
|
|
30
46
|
*/
|
|
@@ -77,7 +93,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
77
93
|
var ct = isInCollection("Name", cfg.Name, contentTypes.results);
|
|
78
94
|
if (ct) {
|
|
79
95
|
// Log
|
|
80
|
-
|
|
96
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The content type '" + cfg.Name + "' already exists.");
|
|
81
97
|
// Update the configuration
|
|
82
98
|
cfg.ContentType = ct;
|
|
83
99
|
// Resolve the promise and return
|
|
@@ -85,7 +101,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
85
101
|
return;
|
|
86
102
|
}
|
|
87
103
|
// Log
|
|
88
|
-
|
|
104
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] Creating the '" + cfg.Name + "' content type.");
|
|
89
105
|
// See if the parent name exists
|
|
90
106
|
if (cfg.ParentName) {
|
|
91
107
|
getParentCT(cfg.ParentName, cfg.ParentWebUrl || webUrl).then(
|
|
@@ -100,7 +116,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
100
116
|
// Success
|
|
101
117
|
function (ct) {
|
|
102
118
|
// Log
|
|
103
|
-
|
|
119
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The content type '" + cfg.Name + "' was created successfully.");
|
|
104
120
|
// Update the configuration
|
|
105
121
|
cfg.ContentType = ct;
|
|
106
122
|
// Trigger the event
|
|
@@ -111,7 +127,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
111
127
|
// Error
|
|
112
128
|
function (error) {
|
|
113
129
|
// Log
|
|
114
|
-
|
|
130
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The content type '" + cfg.Name + "' failed to be created.", error);
|
|
115
131
|
// Reject the promise
|
|
116
132
|
reject(error);
|
|
117
133
|
});
|
|
@@ -119,7 +135,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
119
135
|
// Error
|
|
120
136
|
function () {
|
|
121
137
|
// Log
|
|
122
|
-
|
|
138
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The parent content type '" + cfg.ParentName + "' was not found.");
|
|
123
139
|
// Reject the promise
|
|
124
140
|
reject(ct.response);
|
|
125
141
|
});
|
|
@@ -140,7 +156,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
140
156
|
// Success
|
|
141
157
|
function (ct) {
|
|
142
158
|
// Log
|
|
143
|
-
|
|
159
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The content type '" + cfg.Name + "' was created successfully.");
|
|
144
160
|
// Update the configuration
|
|
145
161
|
cfg.ContentType = ct;
|
|
146
162
|
// Trigger the event
|
|
@@ -151,8 +167,8 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
151
167
|
// Error
|
|
152
168
|
function (error) {
|
|
153
169
|
// Log
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] The content type '" + cfg.Name + "' failed to be created.");
|
|
171
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] Error: " + error.response, true);
|
|
156
172
|
// Reject the promise
|
|
157
173
|
reject(error.response);
|
|
158
174
|
});
|
|
@@ -172,7 +188,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
172
188
|
return;
|
|
173
189
|
}
|
|
174
190
|
// Log
|
|
175
|
-
|
|
191
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type] Updating the field references for: " + cfgContentType.Name);
|
|
176
192
|
// Create the field refs
|
|
177
193
|
_1.setContentTypeFields({
|
|
178
194
|
fields: cfgContentType.FieldRefs,
|
|
@@ -214,11 +230,11 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
214
230
|
// See if an update is needed
|
|
215
231
|
if (updateFl) {
|
|
216
232
|
// Log
|
|
217
|
-
|
|
233
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type][" + cfgContentType.ContentType.Name + "] Updating the content type.");
|
|
218
234
|
// Update the content type
|
|
219
235
|
cfgContentType.ContentType.update(cfgUpdate).execute(function () {
|
|
220
236
|
// Log
|
|
221
|
-
|
|
237
|
+
logMessage("[gd-sprest]" + (list ? "[" + list.Title + " List]" : "") + "[Content Type][" + cfgContentType.ContentType.Name + "] Update request completed.");
|
|
222
238
|
// Trigger the event
|
|
223
239
|
cfgContentType.onUpdated ? cfgContentType.onUpdated(cfgContentType.ContentType) : null;
|
|
224
240
|
// Resolve this request
|
|
@@ -255,7 +271,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
255
271
|
var field = isInCollection("InternalName", cfg.name, fields.results);
|
|
256
272
|
if (field) {
|
|
257
273
|
// Log
|
|
258
|
-
|
|
274
|
+
logMessage("[gd-sprest][Field] The field '" + cfg.name + "' already exists.");
|
|
259
275
|
// Trigger the event
|
|
260
276
|
cfg.onUpdated ? cfg.onUpdated(field, list) : null;
|
|
261
277
|
// Resolve the promise
|
|
@@ -263,7 +279,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
263
279
|
}
|
|
264
280
|
else {
|
|
265
281
|
// Log
|
|
266
|
-
|
|
282
|
+
logMessage("[gd-sprest][Field] Creating the '" + cfg.name + "' field.");
|
|
267
283
|
// See if this is an associated lookup field
|
|
268
284
|
var cfgLookup = cfg;
|
|
269
285
|
if (cfgLookup.type == _1.SPCfgFieldType.Lookup && cfgLookup.fieldRef) {
|
|
@@ -285,7 +301,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
285
301
|
// See if it was successful
|
|
286
302
|
if (field.InternalName) {
|
|
287
303
|
// Log
|
|
288
|
-
|
|
304
|
+
logMessage("[gd-sprest][Field] The field '" + field.InternalName + "' was created successfully.");
|
|
289
305
|
// Save a reference to the field
|
|
290
306
|
newFields.push(field);
|
|
291
307
|
// Trigger the event
|
|
@@ -295,8 +311,8 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
295
311
|
}
|
|
296
312
|
else {
|
|
297
313
|
// Log
|
|
298
|
-
|
|
299
|
-
|
|
314
|
+
logMessage("[gd-sprest][Field] The field '" + cfg.name + "' failed to be created.");
|
|
315
|
+
logMessage("[gd-sprest][Field] Error: " + field.response, true);
|
|
300
316
|
// Reject the promise
|
|
301
317
|
reject();
|
|
302
318
|
}
|
|
@@ -329,13 +345,13 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
329
345
|
var list = isInCollection("Title", cfgList.ListInformation.Title, lists.results);
|
|
330
346
|
if (list) {
|
|
331
347
|
// Log
|
|
332
|
-
|
|
348
|
+
logMessage("[gd-sprest][List] The list '" + cfgList.ListInformation.Title + "' already exists.");
|
|
333
349
|
// Resolve the promise and do nothing
|
|
334
350
|
resolve(null);
|
|
335
351
|
return;
|
|
336
352
|
}
|
|
337
353
|
// Log
|
|
338
|
-
|
|
354
|
+
logMessage("[gd-sprest][List] Creating the '" + cfgList.ListInformation.Title + "' list.");
|
|
339
355
|
// Update the list name and remove spaces
|
|
340
356
|
var listInfo = cfgList.ListInformation;
|
|
341
357
|
var listName = listInfo.Title;
|
|
@@ -354,14 +370,14 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
354
370
|
// Update the list
|
|
355
371
|
list.update({ Title: listName }).execute(function () {
|
|
356
372
|
// Log
|
|
357
|
-
|
|
373
|
+
logMessage("[gd-sprest][List] The list '" + list.Title + "' was created successfully.");
|
|
358
374
|
// Resolve the promise
|
|
359
375
|
resolve(null);
|
|
360
376
|
});
|
|
361
377
|
}
|
|
362
378
|
else {
|
|
363
379
|
// Log
|
|
364
|
-
|
|
380
|
+
logMessage("[gd-sprest][List] The list '" + list.Title + "' was created successfully.");
|
|
365
381
|
// Resolve the promise
|
|
366
382
|
resolve(null);
|
|
367
383
|
}
|
|
@@ -370,8 +386,8 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
370
386
|
}
|
|
371
387
|
else {
|
|
372
388
|
// Log
|
|
373
|
-
|
|
374
|
-
|
|
389
|
+
logMessage("[gd-sprest][List] The list '" + listInfo.Title + "' failed to be created.");
|
|
390
|
+
logMessage("[gd-sprest][List] Error: '" + list.response);
|
|
375
391
|
// Resolve the promise
|
|
376
392
|
resolve(null);
|
|
377
393
|
}
|
|
@@ -425,7 +441,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
425
441
|
// See if this custom action already exists
|
|
426
442
|
if (isInCollection("Name", cfg.Name, customActions.results)) {
|
|
427
443
|
// Log
|
|
428
|
-
|
|
444
|
+
logMessage("[gd-sprest][Custom Action] The custom action '" + cfg.Name + "' already exists.");
|
|
429
445
|
}
|
|
430
446
|
else {
|
|
431
447
|
// See if rights exist
|
|
@@ -438,12 +454,12 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
438
454
|
// Ensure it exists
|
|
439
455
|
if (ca.existsFl) {
|
|
440
456
|
// Log
|
|
441
|
-
|
|
457
|
+
logMessage("[gd-sprest][Custom Action] The custom action '" + ca.Name + "' was created successfully.");
|
|
442
458
|
}
|
|
443
459
|
else {
|
|
444
460
|
// Log
|
|
445
|
-
|
|
446
|
-
|
|
461
|
+
logMessage("[gd-sprest][Custom Action] The custom action '" + ca.Name + "' failed to be created.");
|
|
462
|
+
logMessage("[gd-sprest][Custom Action] Error: " + ca.response);
|
|
447
463
|
}
|
|
448
464
|
}, reject, true);
|
|
449
465
|
}
|
|
@@ -466,7 +482,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
466
482
|
var view = isInCollection("Title", cfg.ViewName, views.results);
|
|
467
483
|
if (view) {
|
|
468
484
|
// Log
|
|
469
|
-
|
|
485
|
+
logMessage("[gd-sprest][View] The view '" + cfg.ViewName + "' already exists.");
|
|
470
486
|
}
|
|
471
487
|
else {
|
|
472
488
|
// Add the view
|
|
@@ -483,14 +499,14 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
483
499
|
// Ensure it exists
|
|
484
500
|
if (view.existsFl) {
|
|
485
501
|
// Log
|
|
486
|
-
|
|
502
|
+
logMessage("[gd-sprest][View] The view '" + cfg.ViewName + "' was created successfully.");
|
|
487
503
|
// Trigger the event
|
|
488
504
|
cfg.onCreated ? cfg.onCreated(view, list) : null;
|
|
489
505
|
}
|
|
490
506
|
else {
|
|
491
507
|
// Log
|
|
492
|
-
|
|
493
|
-
|
|
508
|
+
logMessage("[gd-sprest][View] The view '" + cfg.ViewName + "' failed to be created.");
|
|
509
|
+
logMessage("[gd-sprest][View] Error: " + view.response);
|
|
494
510
|
}
|
|
495
511
|
}, reject, true);
|
|
496
512
|
}
|
|
@@ -515,7 +531,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
515
531
|
return;
|
|
516
532
|
}
|
|
517
533
|
// Log
|
|
518
|
-
|
|
534
|
+
logMessage("[gd-sprest][WebPart] Creating the web parts.");
|
|
519
535
|
// Get the web
|
|
520
536
|
lib_1.Web(webUrl, { disableCache: true, requestDigest: _requestDigest })
|
|
521
537
|
// Get the web part catalog
|
|
@@ -550,7 +566,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
550
566
|
var file = isInCollection("Name", cfgWebPart.FileName, folder.Files.results);
|
|
551
567
|
if (file.Name) {
|
|
552
568
|
// Log
|
|
553
|
-
|
|
569
|
+
logMessage("[gd-sprest][WebPart] The webpart '" + cfgWebPart.FileName + "' already exists.");
|
|
554
570
|
// Trigger the event
|
|
555
571
|
cfgWebPart.onUpdated ? cfgWebPart.onUpdated(file) : null;
|
|
556
572
|
// Execute the post event
|
|
@@ -590,14 +606,14 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
590
606
|
});
|
|
591
607
|
}
|
|
592
608
|
// Log
|
|
593
|
-
|
|
609
|
+
logMessage("[gd-sprest][WebPart] The '" + file.Name + "' webpart file was uploaded successfully.");
|
|
594
610
|
// Trigger the event
|
|
595
611
|
cfgWebPart.onCreated ? cfgWebPart.onCreated(file) : null;
|
|
596
612
|
},
|
|
597
613
|
// Error
|
|
598
614
|
function () {
|
|
599
615
|
// Log
|
|
600
|
-
|
|
616
|
+
logMessage("[gd-sprest][WebPart] The '" + file.Name + "' webpart file upload failed.");
|
|
601
617
|
// Skip this webpart
|
|
602
618
|
resolve();
|
|
603
619
|
});
|
|
@@ -647,7 +663,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
647
663
|
// Remove the field
|
|
648
664
|
ct.delete().execute(function () {
|
|
649
665
|
// Log
|
|
650
|
-
|
|
666
|
+
logMessage("[gd-sprest][Content Type] The content type '" + ct.Name + "' was removed.");
|
|
651
667
|
}, reject, true);
|
|
652
668
|
}
|
|
653
669
|
}).then(resolve);
|
|
@@ -671,7 +687,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
671
687
|
// Remove the field
|
|
672
688
|
field.delete().execute(function () {
|
|
673
689
|
// Log
|
|
674
|
-
|
|
690
|
+
logMessage("[gd-sprest][Field] The field '" + field.InternalName + "' was removed.");
|
|
675
691
|
}, reject, true);
|
|
676
692
|
}
|
|
677
693
|
}).then(resolve);
|
|
@@ -712,7 +728,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
712
728
|
// Remove the list
|
|
713
729
|
list.delete().execute(function () {
|
|
714
730
|
// Log
|
|
715
|
-
|
|
731
|
+
logMessage("[gd-sprest][List] The list '" + list.Title + "' was removed.");
|
|
716
732
|
}, reject, true);
|
|
717
733
|
}
|
|
718
734
|
}).then(resolve);
|
|
@@ -754,7 +770,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
754
770
|
// Remove the custom action
|
|
755
771
|
ca.delete().execute(function () {
|
|
756
772
|
// Log
|
|
757
|
-
|
|
773
|
+
logMessage("[gd-sprest][Custom Action] The custom action '" + ca.Name + "' was removed.");
|
|
758
774
|
}, reject, true);
|
|
759
775
|
}
|
|
760
776
|
}).then(resolve);
|
|
@@ -781,7 +797,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
781
797
|
return;
|
|
782
798
|
}
|
|
783
799
|
// Log
|
|
784
|
-
|
|
800
|
+
logMessage("[gd-sprest][WebPart] Removing the web parts.");
|
|
785
801
|
// Get the webpart gallery from the root web
|
|
786
802
|
site.RootWeb().getCatalog(__1.SPTypes.ListTemplateType.WebPartCatalog)
|
|
787
803
|
// Get the root folder
|
|
@@ -805,7 +821,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
805
821
|
// Remove the file
|
|
806
822
|
file.delete().execute(function () {
|
|
807
823
|
// Log
|
|
808
|
-
|
|
824
|
+
logMessage("[gd-sprest][WebPart] The webpart '" + file.Name + "' file was removed.");
|
|
809
825
|
}, true);
|
|
810
826
|
}
|
|
811
827
|
};
|
|
@@ -981,8 +997,8 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
981
997
|
// Update the field name
|
|
982
998
|
list.Fields.getByInternalNameOrTitle("Title").update(values).execute(function () {
|
|
983
999
|
// Log
|
|
984
|
-
cfgList.TitleFieldDisplayName ?
|
|
985
|
-
cfgList.TitleFieldIndexed ?
|
|
1000
|
+
cfgList.TitleFieldDisplayName ? logMessage("[gd-sprest][List] The 'Title' field's display name was updated to '" + cfgList.TitleFieldDisplayName + "'.") : null;
|
|
1001
|
+
cfgList.TitleFieldIndexed ? logMessage("[gd-sprest][List] The 'Title' field's has been indexed.") : null;
|
|
986
1002
|
// Resolve the promise
|
|
987
1003
|
resolve();
|
|
988
1004
|
}, reject);
|
|
@@ -1006,7 +1022,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1006
1022
|
// See if the view fields are defined
|
|
1007
1023
|
if (cfg.ViewFields && cfg.ViewFields.length > 0) {
|
|
1008
1024
|
// Log
|
|
1009
|
-
|
|
1025
|
+
logMessage("[gd-sprest][View] Updating the view fields for the '" + cfg.ViewName + "' view.");
|
|
1010
1026
|
// Clear the view fields
|
|
1011
1027
|
view.ViewFields().removeAllViewFields().execute(true);
|
|
1012
1028
|
// Parse the view fields
|
|
@@ -1021,7 +1037,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1021
1037
|
typeof (cfg.Tabular) === "boolean" || cfg.JSLink || cfg.RowLimit > 0 || cfg.ViewQuery) {
|
|
1022
1038
|
var props = {};
|
|
1023
1039
|
// Log
|
|
1024
|
-
|
|
1040
|
+
logMessage("[gd-sprest][View] Updating the view properties for the '" + cfg.ViewName + "' view.");
|
|
1025
1041
|
// Set the properties
|
|
1026
1042
|
typeof (cfg.Default) === "boolean" ? props["DefaultView"] = cfg.Default : null;
|
|
1027
1043
|
typeof (cfg.Hidden) === "boolean" ? props["Hidden"] = cfg.Hidden : null;
|
|
@@ -1041,7 +1057,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1041
1057
|
args[_i] = arguments[_i];
|
|
1042
1058
|
}
|
|
1043
1059
|
// Log
|
|
1044
|
-
|
|
1060
|
+
logMessage("[gd-sprest][View] The updates for the '" + cfg.ViewName + "' view has completed.");
|
|
1045
1061
|
// Trigger the event
|
|
1046
1062
|
cfg.onUpdated ? cfg.onUpdated(view, list) : null;
|
|
1047
1063
|
// Resolve the promise
|
|
@@ -1058,7 +1074,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1058
1074
|
// Ensure we need to complete this request
|
|
1059
1075
|
if ((cfg.CustomActionCfg != null && cfg.CustomActionCfg.Site != null) || cfg.WebPartCfg != null) {
|
|
1060
1076
|
// Log
|
|
1061
|
-
|
|
1077
|
+
logMessage("[gd-sprest][uninstall] Loading the site information...");
|
|
1062
1078
|
// Get the site
|
|
1063
1079
|
lib_1.Site(webUrl, { disableCache: true, requestDigest: _requestDigest })
|
|
1064
1080
|
// Expand the user custom actions
|
|
@@ -1089,7 +1105,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1089
1105
|
return new Promise(function (resolve, reject) {
|
|
1090
1106
|
var Expand = [];
|
|
1091
1107
|
// Log
|
|
1092
|
-
|
|
1108
|
+
logMessage("[gd-sprest][uninstall] Loading the web information...");
|
|
1093
1109
|
// Set the query
|
|
1094
1110
|
if (cfg.ContentTypes) {
|
|
1095
1111
|
Expand.push("ContentTypes");
|
|
@@ -1152,7 +1168,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1152
1168
|
// Set the request digest
|
|
1153
1169
|
setRequestDigest().then(function () {
|
|
1154
1170
|
// Log
|
|
1155
|
-
|
|
1171
|
+
logMessage("[gd-sprest] Installing the web assets...");
|
|
1156
1172
|
// Get the web
|
|
1157
1173
|
var web = lib_1.Web(webUrl, { disableCache: true, requestDigest: _requestDigest });
|
|
1158
1174
|
// Create the site fields
|
|
@@ -1162,13 +1178,13 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1162
1178
|
// See if we are creating fields
|
|
1163
1179
|
if (cfg.Fields && cfg.Fields.length > 0) {
|
|
1164
1180
|
// Log
|
|
1165
|
-
|
|
1181
|
+
logMessage("[gd-sprest][Fields] Starting the requests.");
|
|
1166
1182
|
// Get the fields
|
|
1167
1183
|
web.Fields().execute(function (fields) {
|
|
1168
1184
|
// Create the fields
|
|
1169
1185
|
createFields(fields, cfg.Fields).then(function () {
|
|
1170
1186
|
// Log
|
|
1171
|
-
|
|
1187
|
+
logMessage("[gd-sprest][Fields] Completed the requests.");
|
|
1172
1188
|
// Resolve the promise
|
|
1173
1189
|
resolve(null);
|
|
1174
1190
|
}, reject);
|
|
@@ -1187,13 +1203,13 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1187
1203
|
// See if we are creating the content types
|
|
1188
1204
|
if (cfg.ContentTypes && cfg.ContentTypes.length > 0) {
|
|
1189
1205
|
// Log
|
|
1190
|
-
|
|
1206
|
+
logMessage("[gd-sprest][Content Types] Starting the requests.");
|
|
1191
1207
|
// Get the content types
|
|
1192
1208
|
web.ContentTypes().execute(function (contentTypes) {
|
|
1193
1209
|
// Create the content types
|
|
1194
1210
|
createContentTypes(contentTypes, cfg.ContentTypes).then(function () {
|
|
1195
1211
|
// Log
|
|
1196
|
-
|
|
1212
|
+
logMessage("[gd-sprest][Content Types] Completed the requests.");
|
|
1197
1213
|
// Resolve the promise
|
|
1198
1214
|
resolve();
|
|
1199
1215
|
}, reject);
|
|
@@ -1212,13 +1228,13 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1212
1228
|
// See if we are creating the lists
|
|
1213
1229
|
if (cfg.ListCfg && cfg.ListCfg.length) {
|
|
1214
1230
|
// Log
|
|
1215
|
-
|
|
1231
|
+
logMessage("[gd-sprest][Lists] Starting the requests.");
|
|
1216
1232
|
// Get the lists
|
|
1217
1233
|
web.Lists().execute(function (lists) {
|
|
1218
1234
|
// Create the lists
|
|
1219
1235
|
createLists(lists, cfg.ListCfg).then(function () {
|
|
1220
1236
|
// Log
|
|
1221
|
-
|
|
1237
|
+
logMessage("[gd-sprest][Lists] Completed the requests.");
|
|
1222
1238
|
// Resolve the promise
|
|
1223
1239
|
resolve();
|
|
1224
1240
|
}, reject);
|
|
@@ -1237,11 +1253,11 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1237
1253
|
// See if we are creating the webparts
|
|
1238
1254
|
if (cfg.WebPartCfg && cfg.WebPartCfg.length > 0) {
|
|
1239
1255
|
// Log
|
|
1240
|
-
|
|
1256
|
+
logMessage("[gd-sprest][WebParts] Starting the requests.");
|
|
1241
1257
|
// Create the webparts
|
|
1242
1258
|
createWebParts().then(function () {
|
|
1243
1259
|
// Log
|
|
1244
|
-
|
|
1260
|
+
logMessage("[gd-sprest][WebParts] Completed the requests.");
|
|
1245
1261
|
// Resolve the promise
|
|
1246
1262
|
resolve();
|
|
1247
1263
|
}, reject);
|
|
@@ -1259,7 +1275,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1259
1275
|
// See if we are targeting the site collection
|
|
1260
1276
|
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Site) {
|
|
1261
1277
|
// Log
|
|
1262
|
-
|
|
1278
|
+
logMessage("[gd-sprest][Site Custom Actions] Starting the requests.");
|
|
1263
1279
|
// Get the site
|
|
1264
1280
|
lib_1.Site(webUrl, { disableCache: true, requestDigest: _requestDigest })
|
|
1265
1281
|
// Get the user custom actions
|
|
@@ -1267,7 +1283,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1267
1283
|
// Create the user custom actions
|
|
1268
1284
|
createUserCustomActions(customActions, cfg.CustomActionCfg.Site).then(function () {
|
|
1269
1285
|
// Log
|
|
1270
|
-
|
|
1286
|
+
logMessage("[gd-sprest][Site Custom Actions] Completed the requests.");
|
|
1271
1287
|
// Resolve the promise
|
|
1272
1288
|
resolve();
|
|
1273
1289
|
}, reject);
|
|
@@ -1286,13 +1302,13 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1286
1302
|
// See if we are targeting the web
|
|
1287
1303
|
if (cfg.CustomActionCfg && cfg.CustomActionCfg.Web) {
|
|
1288
1304
|
// Log
|
|
1289
|
-
|
|
1305
|
+
logMessage("[gd-sprest][Web Custom Actions] Starting the requests.");
|
|
1290
1306
|
// Get the user custom actions
|
|
1291
1307
|
web.UserCustomActions().execute(function (customActions) {
|
|
1292
1308
|
// Create the user custom actions
|
|
1293
1309
|
createUserCustomActions(customActions, cfg.CustomActionCfg.Web).then(function () {
|
|
1294
1310
|
// Log
|
|
1295
|
-
|
|
1311
|
+
logMessage("[gd-sprest][Web Custom Actions] Completed the requests.");
|
|
1296
1312
|
// Resolve the promise
|
|
1297
1313
|
resolve();
|
|
1298
1314
|
});
|
|
@@ -1317,7 +1333,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1317
1333
|
// Create the site custom actions
|
|
1318
1334
|
createSiteCustomActions().then(function () {
|
|
1319
1335
|
// Log
|
|
1320
|
-
|
|
1336
|
+
logMessage("[gd-sprest] The configuration script completed, but some requests may still be running.");
|
|
1321
1337
|
// Resolve the request
|
|
1322
1338
|
resolve();
|
|
1323
1339
|
}, reject);
|
|
@@ -1343,7 +1359,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1343
1359
|
// Uninstall the site components
|
|
1344
1360
|
uninstallSite().then(function () {
|
|
1345
1361
|
// Log
|
|
1346
|
-
|
|
1362
|
+
logMessage("[gd-sprest] The configuration script completed, but some requests may still be running.");
|
|
1347
1363
|
// Resolve the promise
|
|
1348
1364
|
resolve();
|
|
1349
1365
|
}, reject);
|
package/build/rest.js
CHANGED
package/build/utils/batch.js
CHANGED
|
@@ -53,7 +53,7 @@ var Batch = /** @class */ (function () {
|
|
|
53
53
|
return base;
|
|
54
54
|
};
|
|
55
55
|
// Method to generate a batch request
|
|
56
|
-
Batch.getTargetInfo = function (url, requests) {
|
|
56
|
+
Batch.getTargetInfo = function (url, requests, requestDigest) {
|
|
57
57
|
var batchId = "batch_" + lib_1.ContextInfo.generateGUID();
|
|
58
58
|
var batchRequests = [];
|
|
59
59
|
// Create the batch request
|
|
@@ -66,6 +66,7 @@ var Batch = /** @class */ (function () {
|
|
|
66
66
|
endpoint: "$batch",
|
|
67
67
|
method: "POST",
|
|
68
68
|
data: batchRequests.join("\r\n"),
|
|
69
|
+
requestDigest: requestDigest,
|
|
69
70
|
requestHeader: {
|
|
70
71
|
"Content-Type": 'multipart/mixed; boundary="' + batchId + '"'
|
|
71
72
|
}
|
package/build/utils/request.js
CHANGED
|
@@ -415,7 +415,7 @@ exports.Request = {
|
|
|
415
415
|
// Return a promise
|
|
416
416
|
return new Promise(function (resolve) {
|
|
417
417
|
// Execute the request
|
|
418
|
-
execute(batch_1.Batch.getTargetInfo(base.targetInfo.url, batchRequest), batchIdx_1++, function () {
|
|
418
|
+
execute(batch_1.Batch.getTargetInfo(base.targetInfo.url, batchRequest, base.targetInfo.requestDigest), batchIdx_1++, function () {
|
|
419
419
|
// Resolve the request
|
|
420
420
|
resolve(null);
|
|
421
421
|
});
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -3996,6 +3996,9 @@ declare module 'gd-sprest/helper/spCfg' {
|
|
|
3996
3996
|
/** The list configuration. */
|
|
3997
3997
|
ListCfg?: Array<ISPCfgListInfo>;
|
|
3998
3998
|
|
|
3999
|
+
/** Event for the logging of the configuration. */
|
|
4000
|
+
onLogMessage?: (msg: string) => void;
|
|
4001
|
+
|
|
3999
4002
|
/** The web part configuration. */
|
|
4000
4003
|
WebPartCfg?: Array<ISPCfgWebPartInfo>;
|
|
4001
4004
|
}
|