sp-js-provisioning 1.0.4 → 1.1.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.
Files changed (85) hide show
  1. package/.husky/commit-msg +4 -0
  2. package/README.md +11 -31
  3. package/lib/handlers/clientsidepages.d.ts +13 -13
  4. package/lib/handlers/clientsidepages.js +77 -60
  5. package/lib/handlers/clientsidepages.js.map +1 -0
  6. package/lib/handlers/composedlook.d.ts +6 -6
  7. package/lib/handlers/composedlook.js +24 -17
  8. package/lib/handlers/composedlook.js.map +1 -0
  9. package/lib/handlers/contenttypes.d.ts +20 -20
  10. package/lib/handlers/contenttypes.js +77 -59
  11. package/lib/handlers/contenttypes.js.map +1 -0
  12. package/lib/handlers/customactions.d.ts +7 -7
  13. package/lib/handlers/customactions.js +24 -17
  14. package/lib/handlers/customactions.js.map +1 -0
  15. package/lib/handlers/exports.d.ts +3 -3
  16. package/lib/handlers/exports.js +15 -11
  17. package/lib/handlers/exports.js.map +1 -0
  18. package/lib/handlers/features.d.ts +7 -7
  19. package/lib/handlers/features.js +24 -22
  20. package/lib/handlers/features.js.map +1 -0
  21. package/lib/handlers/files.d.ts +44 -44
  22. package/lib/handlers/files.js +229 -159
  23. package/lib/handlers/files.js.map +1 -0
  24. package/lib/handlers/handlerbase.d.ts +21 -11
  25. package/lib/handlers/handlerbase.js +51 -16
  26. package/lib/handlers/handlerbase.js.map +1 -0
  27. package/lib/handlers/hooks.d.ts +22 -0
  28. package/lib/handlers/hooks.js +230 -0
  29. package/lib/handlers/hooks.js.map +1 -0
  30. package/lib/handlers/lists.d.ts +45 -45
  31. package/lib/handlers/lists.js +184 -150
  32. package/lib/handlers/lists.js.map +1 -0
  33. package/lib/handlers/navigation.d.ts +10 -10
  34. package/lib/handlers/navigation.js +40 -31
  35. package/lib/handlers/navigation.js.map +1 -0
  36. package/lib/handlers/propertybagentries.d.ts +7 -7
  37. package/lib/handlers/propertybagentries.js +30 -25
  38. package/lib/handlers/propertybagentries.js.map +1 -0
  39. package/lib/handlers/sitefields.d.ts +11 -11
  40. package/lib/handlers/sitefields.js +40 -29
  41. package/lib/handlers/sitefields.js.map +1 -0
  42. package/lib/handlers/websettings.d.ts +7 -7
  43. package/lib/handlers/websettings.js +36 -33
  44. package/lib/handlers/websettings.js.map +1 -0
  45. package/lib/index.d.ts +3 -3
  46. package/lib/index.js +3 -2
  47. package/lib/index.js.map +1 -0
  48. package/lib/provisioningconfig.d.ts +2 -2
  49. package/lib/provisioningconfig.js +2 -0
  50. package/lib/provisioningconfig.js.map +1 -0
  51. package/lib/provisioningcontext.d.ts +1 -5
  52. package/lib/provisioningcontext.js +2 -4
  53. package/lib/provisioningcontext.js.map +1 -0
  54. package/lib/schema.d.ts +18 -4
  55. package/lib/schema.js +2 -0
  56. package/lib/schema.js.map +1 -0
  57. package/lib/util/index.d.ts +3 -6
  58. package/lib/util/index.js +20 -29
  59. package/lib/util/index.js.map +1 -0
  60. package/lib/util/tokenhelper.d.ts +3 -3
  61. package/lib/util/tokenhelper.js +30 -29
  62. package/lib/util/tokenhelper.js.map +1 -0
  63. package/lib/webprovisioner.d.ts +16 -16
  64. package/lib/webprovisioner.js +42 -29
  65. package/lib/webprovisioner.js.map +1 -0
  66. package/package.json +118 -36
  67. package/sample-schemas/all-simple.ts +85 -76
  68. package/AUTHORS +0 -3
  69. package/LICENSE +0 -25
  70. package/debug/debug.ts +0 -68
  71. package/debug/example.ts +0 -42
  72. package/gulptasks/@configuration.js +0 -58
  73. package/gulptasks/build.js +0 -84
  74. package/gulptasks/clean.js +0 -23
  75. package/gulptasks/docs.js +0 -11
  76. package/gulptasks/index.js +0 -8
  77. package/gulptasks/lint.js +0 -18
  78. package/gulptasks/package.js +0 -44
  79. package/gulptasks/publish.js +0 -232
  80. package/gulptasks/test.js +0 -40
  81. package/gulptasks/watch.js +0 -15
  82. package/jsdoc.json +0 -26
  83. package/pnpm-lock.yaml +0 -6582
  84. package/shrinkwrap.yaml +0 -6513
  85. package/webpack.config.js +0 -58
@@ -1,7 +1,7 @@
1
- import { HandlerBase } from "./handlerbase";
2
- import { INavigation } from "../schema";
3
- import { Web } from "@pnp/sp";
4
- import { IProvisioningConfig } from "../provisioningconfig";
1
+ import { HandlerBase } from './handlerbase';
2
+ import { INavigation } from '../schema';
3
+ import { Web } from '@pnp/sp';
4
+ import { IProvisioningConfig } from '../provisioningconfig';
5
5
  /**
6
6
  * Describes the Navigation Object Handler
7
7
  */
@@ -9,17 +9,17 @@ export declare class Navigation extends HandlerBase {
9
9
  /**
10
10
  * Creates a new instance of the Navigation class
11
11
  *
12
- * @param {IProvisioningConfig} config Provisioning config
12
+ * @param config - Provisioning config
13
13
  */
14
14
  constructor(config: IProvisioningConfig);
15
15
  /**
16
16
  * Provisioning navigation
17
17
  *
18
- * @param {Navigation} navigation The navigation to provision
18
+ * @param navigation - The navigation to provision
19
19
  */
20
20
  ProvisionObjects(web: Web, navigation: INavigation): Promise<void>;
21
- private processNavTree(target, nodes);
22
- private processNode(target, node, existingNodes);
23
- private deleteExistingNodes(target);
24
- private deleteNode(target, id);
21
+ private processNavTree;
22
+ private processNode;
23
+ private deleteExistingNodes;
24
+ private deleteNode;
25
25
  }
@@ -1,7 +1,10 @@
1
1
  var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = Object.setPrototypeOf ||
3
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
5
8
  return function (d, b) {
6
9
  extendStatics(d, b);
7
10
  function __() { this.constructor = d; }
@@ -9,10 +12,11 @@ var __extends = (this && this.__extends) || (function () {
9
12
  };
10
13
  })();
11
14
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
16
  return new (P || (P = Promise))(function (resolve, reject) {
13
17
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
18
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
17
21
  });
18
22
  };
@@ -23,8 +27,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
23
27
  function step(op) {
24
28
  if (f) throw new TypeError("Generator is already executing.");
25
29
  while (_) try {
26
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
27
- if (y = 0, t) op = [0, t.value];
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
28
32
  switch (op[0]) {
29
33
  case 0: case 1: t = op; break;
30
34
  case 4: _.label++; return { value: op[1], done: false };
@@ -43,30 +47,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
43
47
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
44
48
  }
45
49
  };
46
- import { HandlerBase } from "./handlerbase";
47
- import { isArray } from "@pnp/common";
48
- import { replaceUrlTokens } from "../util";
50
+ import { HandlerBase } from './handlerbase';
51
+ import { isArray } from '@pnp/common';
52
+ import { replaceUrlTokens } from '../util';
49
53
  /**
50
54
  * Describes the Navigation Object Handler
51
55
  */
52
- var Navigation = (function (_super) {
56
+ var Navigation = /** @class */ (function (_super) {
53
57
  __extends(Navigation, _super);
54
58
  /**
55
59
  * Creates a new instance of the Navigation class
56
60
  *
57
- * @param {IProvisioningConfig} config Provisioning config
61
+ * @param config - Provisioning config
58
62
  */
59
63
  function Navigation(config) {
60
- return _super.call(this, "Navigation", config) || this;
64
+ return _super.call(this, Navigation.name, config) || this;
61
65
  }
62
66
  /**
63
67
  * Provisioning navigation
64
68
  *
65
- * @param {Navigation} navigation The navigation to provision
69
+ * @param navigation - The navigation to provision
66
70
  */
67
71
  Navigation.prototype.ProvisionObjects = function (web, navigation) {
68
72
  return __awaiter(this, void 0, void 0, function () {
69
- var promises, err_1;
73
+ var promises, error_1;
70
74
  return __generator(this, function (_a) {
71
75
  switch (_a.label) {
72
76
  case 0:
@@ -87,9 +91,9 @@ var Navigation = (function (_super) {
87
91
  _super.prototype.scope_ended.call(this);
88
92
  return [3 /*break*/, 4];
89
93
  case 3:
90
- err_1 = _a.sent();
91
- _super.prototype.scope_ended.call(this);
92
- throw err_1;
94
+ error_1 = _a.sent();
95
+ _super.prototype.scope_ended.call(this, error_1);
96
+ throw error_1;
93
97
  case 4: return [2 /*return*/];
94
98
  }
95
99
  });
@@ -97,8 +101,8 @@ var Navigation = (function (_super) {
97
101
  };
98
102
  Navigation.prototype.processNavTree = function (target, nodes) {
99
103
  return __awaiter(this, void 0, void 0, function () {
104
+ var existingNodes_1, error_2;
100
105
  var _this = this;
101
- var existingNodes_1, err_2;
102
106
  return __generator(this, function (_a) {
103
107
  switch (_a.label) {
104
108
  case 0:
@@ -109,13 +113,15 @@ var Navigation = (function (_super) {
109
113
  return [4 /*yield*/, this.deleteExistingNodes(target)];
110
114
  case 2:
111
115
  _a.sent();
112
- return [4 /*yield*/, nodes.reduce(function (chain, node) { return chain.then(function () { return _this.processNode(target, node, existingNodes_1); }); }, Promise.resolve())];
116
+ return [4 /*yield*/, nodes.reduce(function (chain, node) {
117
+ return chain.then(function () { return _this.processNode(target, node, existingNodes_1); });
118
+ }, Promise.resolve())];
113
119
  case 3:
114
120
  _a.sent();
115
121
  return [3 /*break*/, 5];
116
122
  case 4:
117
- err_2 = _a.sent();
118
- throw err_2;
123
+ error_2 = _a.sent();
124
+ throw error_2;
119
125
  case 5: return [2 /*return*/];
120
126
  }
121
127
  });
@@ -123,7 +129,7 @@ var Navigation = (function (_super) {
123
129
  };
124
130
  Navigation.prototype.processNode = function (target, node, existingNodes) {
125
131
  return __awaiter(this, void 0, void 0, function () {
126
- var existingNode, result, err_3;
132
+ var existingNode, result, error_3;
127
133
  return __generator(this, function (_a) {
128
134
  switch (_a.label) {
129
135
  case 0:
@@ -144,8 +150,8 @@ var Navigation = (function (_super) {
144
150
  _a.label = 4;
145
151
  case 4: return [3 /*break*/, 6];
146
152
  case 5:
147
- err_3 = _a.sent();
148
- throw err_3;
153
+ error_3 = _a.sent();
154
+ throw error_3;
149
155
  case 6: return [2 /*return*/];
150
156
  }
151
157
  });
@@ -153,8 +159,8 @@ var Navigation = (function (_super) {
153
159
  };
154
160
  Navigation.prototype.deleteExistingNodes = function (target) {
155
161
  return __awaiter(this, void 0, void 0, function () {
162
+ var existingNodes, error_4;
156
163
  var _this = this;
157
- var existingNodes, err_4;
158
164
  return __generator(this, function (_a) {
159
165
  switch (_a.label) {
160
166
  case 0:
@@ -162,13 +168,15 @@ var Navigation = (function (_super) {
162
168
  return [4 /*yield*/, target.get()];
163
169
  case 1:
164
170
  existingNodes = _a.sent();
165
- return [4 /*yield*/, existingNodes.reduce(function (chain, n) { return chain.then(function () { return _this.deleteNode(target, n.Id); }); }, Promise.resolve())];
171
+ return [4 /*yield*/, existingNodes.reduce(function (chain, n) {
172
+ return chain.then(function () { return _this.deleteNode(target, n.Id); });
173
+ }, Promise.resolve())];
166
174
  case 2:
167
175
  _a.sent();
168
176
  return [3 /*break*/, 4];
169
177
  case 3:
170
- err_4 = _a.sent();
171
- throw err_4;
178
+ error_4 = _a.sent();
179
+ throw error_4;
172
180
  case 4: return [2 /*return*/];
173
181
  }
174
182
  });
@@ -176,7 +184,7 @@ var Navigation = (function (_super) {
176
184
  };
177
185
  Navigation.prototype.deleteNode = function (target, id) {
178
186
  return __awaiter(this, void 0, void 0, function () {
179
- var err_5;
187
+ var error_5;
180
188
  return __generator(this, function (_a) {
181
189
  switch (_a.label) {
182
190
  case 0:
@@ -186,8 +194,8 @@ var Navigation = (function (_super) {
186
194
  _a.sent();
187
195
  return [3 /*break*/, 3];
188
196
  case 2:
189
- err_5 = _a.sent();
190
- throw err_5;
197
+ error_5 = _a.sent();
198
+ throw error_5;
191
199
  case 3: return [2 /*return*/];
192
200
  }
193
201
  });
@@ -196,3 +204,4 @@ var Navigation = (function (_super) {
196
204
  return Navigation;
197
205
  }(HandlerBase));
198
206
  export { Navigation };
207
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/handlers/navigation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG1C;;GAEG;AACH;IAAgC,8BAAW;IACzC;;;;OAIG;IACH,oBAAY,MAA2B;eACrC,kBAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACU,qCAAgB,GAA7B,UACE,GAAQ,EACR,UAAuB;;;;;;wBAEvB,iBAAM,aAAa,WAAE,CAAA;wBACf,QAAQ,GAAG,EAAE,CAAA;wBACnB,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;4BACnC,QAAQ,CAAC,IAAI,CACX,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,CACxE,CAAA;yBACF;w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visioningConfig } from "../provisioningconfig";
1
+ import { HandlerBase } from './handlerbase';
2
+ import { IPropertyBagEntry } from '../schema';
3
+ import { Web } from '@pnp/sp';
4
+ import { IProvisioningConfig } from '../provisioningconfig';
5
5
  /**
6
6
  * Describes the PropertyBagEntries Object Handler
7
7
  */
@@ -9,14 +9,14 @@ export declare class PropertyBagEntries extends HandlerBase {
9
9
  /**
10
10
  * Creates a new instance of the PropertyBagEntries class
11
11
  *
12
- * @param {IProvisioningConfig} config Provisioning config
12
+ * @param config - Provisioning config
13
13
  */
14
14
  constructor(config: IProvisioningConfig);
15
15
  /**
16
16
  * Provisioning property bag entries
17
17
  *
18
- * @param {Web} web The web
19
- * @param {Array<IPropertyBagEntry>} entries The property bag entries to provision
18
+ * @param web - The web
19
+ * @param entries - The property bag entries to provision
20
20
  */
21
21
  ProvisionObjects(web: Web, entries: IPropertyBagEntry[]): Promise<void>;
22
22
  }
@@ -1,66 +1,70 @@
1
1
  var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = Object.setPrototypeOf ||
3
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
5
8
  return function (d, b) {
6
9
  extendStatics(d, b);
7
10
  function __() { this.constructor = d; }
8
11
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9
12
  };
10
13
  })();
11
- import { HandlerBase } from "./handlerbase";
12
- import * as Util from "../util";
13
- import { Logger } from "@pnp/logging";
14
+ import { HandlerBase } from './handlerbase';
15
+ import * as Util from '../util';
16
+ import { Logger } from '@pnp/logging';
14
17
  /**
15
18
  * Describes the PropertyBagEntries Object Handler
16
19
  */
17
- var PropertyBagEntries = (function (_super) {
20
+ var PropertyBagEntries = /** @class */ (function (_super) {
18
21
  __extends(PropertyBagEntries, _super);
19
22
  /**
20
23
  * Creates a new instance of the PropertyBagEntries class
21
24
  *
22
- * @param {IProvisioningConfig} config Provisioning config
25
+ * @param config - Provisioning config
23
26
  */
24
27
  function PropertyBagEntries(config) {
25
- return _super.call(this, "PropertyBagEntries", config) || this;
28
+ return _super.call(this, PropertyBagEntries.name, config) || this;
26
29
  }
27
30
  /**
28
31
  * Provisioning property bag entries
29
32
  *
30
- * @param {Web} web The web
31
- * @param {Array<IPropertyBagEntry>} entries The property bag entries to provision
33
+ * @param web - The web
34
+ * @param entries - The property bag entries to provision
32
35
  */
33
36
  PropertyBagEntries.prototype.ProvisionObjects = function (web, entries) {
34
37
  var _this = this;
35
38
  _super.prototype.scope_started.call(this);
36
39
  return new Promise(function (resolve, reject) {
37
40
  if (Util.isNode()) {
38
- Logger.write("PropertyBagEntries Handler not supported in Node.", 3 /* Error */);
41
+ Logger.write('PropertyBagEntries Handler not supported in Node.', 3 /* Error */);
39
42
  reject();
40
43
  }
41
44
  else if (_this.config.spfxContext) {
42
- Logger.write("PropertyBagEntries Handler not supported in SPFx.", 3 /* Error */);
45
+ Logger.write('PropertyBagEntries Handler not supported in SPFx.', 3 /* Error */);
43
46
  reject();
44
47
  }
45
48
  else {
46
49
  web.get().then(function (_a) {
47
50
  var ServerRelativeUrl = _a.ServerRelativeUrl;
48
- var ctx = new SP.ClientContext(ServerRelativeUrl), spWeb = ctx.get_web(), propBag = spWeb.get_allProperties(), idxProps = [];
49
- entries.filter(function (entry) { return entry.Overwrite; }).forEach(function (entry) {
50
- propBag.set_item(entry.Key, entry.Value);
51
+ var context = new SP.ClientContext(ServerRelativeUrl), spWeb = context.get_web(), propertyBag = spWeb.get_allProperties(), indexProps = [];
52
+ for (var _i = 0, _b = entries.filter(function (entry) { return entry.Overwrite; }); _i < _b.length; _i++) {
53
+ var entry = _b[_i];
54
+ propertyBag.set_item(entry.Key, entry.Value);
51
55
  if (entry.Indexed) {
52
- idxProps.push(Util.base64EncodeString(entry.Key));
56
+ indexProps.push(Util.base64EncodeString(entry.Key));
53
57
  }
54
- });
58
+ }
55
59
  spWeb.update();
56
- ctx.load(propBag);
57
- ctx.executeQueryAsync(function () {
58
- if (idxProps.length > 0) {
59
- propBag.set_item("vti_indexedpropertykeys", idxProps.join("|"));
60
+ context.load(propertyBag);
61
+ context.executeQueryAsync(function () {
62
+ if (indexProps.length > 0) {
63
+ propertyBag.set_item('vti_indexedpropertykeys', indexProps.join('|'));
60
64
  spWeb.update();
61
- ctx.executeQueryAsync(function () {
65
+ context.executeQueryAsync(function () {
62
66
  _super.prototype.scope_ended.call(_this);
63
- resolve();
67
+ resolve(true);
64
68
  }, function () {
65
69
  _super.prototype.scope_ended.call(_this);
66
70
  reject();
@@ -68,7 +72,7 @@ var PropertyBagEntries = (function (_super) {
68
72
  }
69
73
  else {
70
74
  _super.prototype.scope_ended.call(_this);
71
- resolve();
75
+ resolve(true);
72
76
  }
73
77
  }, function () {
74
78
  _super.prototype.scope_ended.call(_this);
@@ -81,3 +85,4 @@ var PropertyBagEntries = (function (_super) {
81
85
  return PropertyBagEntries;
82
86
  }(HandlerBase));
83
87
  export { PropertyBagEntries };
88
+ //# sourceMappingURL=propertybagentries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propertybagentries.js","sourceRoot":"","sources":["../../src/handlers/propertybagentries.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAY,MAAM,cAAc,CAAA;AAI/C;;GAEG;AACH;IAAwC,sCAAW;IACjD;;;;OAIG;IACH,4BAAY,MAA2B;eACrC,kBAAM,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;IACxC,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wBACE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;4BACzB,WAAW,CAAC,QAAQ,CAClB,yBAAyB,EACzB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CACrB,CAAA;4BACD,KAAK,CAAC,MAAM,EAAE,CAAA;4BACd,OAAO,CAAC,iBAAiB,CACvB;gCACE,iBAAM,WAAW,YAAE,CAAA;gCACnB,OAAO,CAAC,IAAI,CAAC,CAAA;4BACf,CAAC,EACD;gCACE,iBAAM,WAAW,YAAE,CAAA;gCACnB,MAAM,EAAE,CAAA;4BACV,CAAC,CACF,CAAA;yBACF;6BAAM;4BACL,iBAAM,WAAW,YAAE,CAAA;4BACnB,OAAO,CAAC,IAAI,CAAC,CAAA;yBACd;oBACH,CAAC,EACD;wBACE,iBAAM,WAAW,YAAE,CAAA;wBACnB,MAAM,EAAE,CAAA;oBACV,CAAC,CACF,CAAA;gBACH,CAAC,CAAC,CAAA;aACH;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AAhFD,CAAwC,WAAW,GAgFlD"}
@@ -1,7 +1,7 @@
1
- import { HandlerBase } from "./handlerbase";
2
- import { Web } from "@pnp/sp";
3
- import { ProvisioningContext } from "../provisioningcontext";
4
- import { IProvisioningConfig } from "../provisioningconfig";
1
+ import { HandlerBase } from './handlerbase';
2
+ import { Web } from '@pnp/sp';
3
+ import { ProvisioningContext } from '../provisioningcontext';
4
+ import { IProvisioningConfig } from '../provisioningconfig';
5
5
  /**
6
6
  * Describes the Site Fields Object Handler
7
7
  */
@@ -15,16 +15,16 @@ export declare class SiteFields extends HandlerBase {
15
15
  /**
16
16
  * Provisioning Client Side Pages
17
17
  *
18
- * @param {Web} web The web
19
- * @param {string[]} siteFields The site fields
20
- * @param {ProvisioningContext} context Provisioning context
18
+ * @param web - The web
19
+ * @param siteFields - The site fields
20
+ * @param context - Provisioning context
21
21
  */
22
- ProvisionObjects(web: Web, siteFields: string[], context: ProvisioningContext): Promise<void>;
22
+ ProvisionObjects(web: Web, siteFields: string[], context?: ProvisioningContext): Promise<void>;
23
23
  /**
24
24
  * Provision a site field
25
25
  *
26
- * @param {Web} web The web
27
- * @param {IClientSidePage} clientSidePage Cient side page
26
+ * @param web - The web
27
+ * @param clientSidePage - Cient side page
28
28
  */
29
- private processSiteField(web, schemaXml);
29
+ private processSiteField;
30
30
  }
@@ -1,7 +1,10 @@
1
1
  var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = Object.setPrototypeOf ||
3
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
5
8
  return function (d, b) {
6
9
  extendStatics(d, b);
7
10
  function __() { this.constructor = d; }
@@ -9,10 +12,11 @@ var __extends = (this && this.__extends) || (function () {
9
12
  };
10
13
  })();
11
14
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
16
  return new (P || (P = Promise))(function (resolve, reject) {
13
17
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
18
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
17
21
  });
18
22
  };
@@ -23,8 +27,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
23
27
  function step(op) {
24
28
  if (f) throw new TypeError("Generator is already executing.");
25
29
  while (_) try {
26
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
27
- if (y = 0, t) op = [0, t.value];
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
28
32
  switch (op[0]) {
29
33
  case 0: case 1: t = op; break;
30
34
  case 4: _.label++; return { value: op[1], done: false };
@@ -44,30 +48,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
44
48
  }
45
49
  };
46
50
  import * as xmljs from 'xml-js';
47
- import { HandlerBase } from "./handlerbase";
51
+ import { HandlerBase } from './handlerbase';
48
52
  import { TokenHelper } from '../util/tokenhelper';
49
53
  /**
50
54
  * Describes the Site Fields Object Handler
51
55
  */
52
- var SiteFields = (function (_super) {
56
+ var SiteFields = /** @class */ (function (_super) {
53
57
  __extends(SiteFields, _super);
54
58
  /**
55
59
  * Creates a new instance of the ObjectSiteFields class
56
60
  */
57
61
  function SiteFields(config) {
58
- return _super.call(this, "SiteFields", config) || this;
62
+ return _super.call(this, SiteFields.name, config) || this;
59
63
  }
60
64
  /**
61
65
  * Provisioning Client Side Pages
62
66
  *
63
- * @param {Web} web The web
64
- * @param {string[]} siteFields The site fields
65
- * @param {ProvisioningContext} context Provisioning context
67
+ * @param web - The web
68
+ * @param siteFields - The site fields
69
+ * @param context - Provisioning context
66
70
  */
67
71
  SiteFields.prototype.ProvisionObjects = function (web, siteFields, context) {
68
72
  return __awaiter(this, void 0, void 0, function () {
73
+ var _a, error_1;
69
74
  var _this = this;
70
- var _a, err_1;
71
75
  return __generator(this, function (_b) {
72
76
  switch (_b.label) {
73
77
  case 0:
@@ -78,20 +82,24 @@ var SiteFields = (function (_super) {
78
82
  case 1:
79
83
  _b.trys.push([1, 4, , 5]);
80
84
  _a = this.context;
81
- return [4 /*yield*/, web.fields.select('Id', 'InternalName').get()];
85
+ return [4 /*yield*/, web.fields
86
+ .select('Id', 'InternalName')
87
+ .get()];
82
88
  case 2:
83
- _a.siteFields = (_b.sent()).reduce(function (obj, l) {
84
- obj[l.InternalName] = l.Id;
85
- return obj;
89
+ _a.siteFields = (_b.sent()).reduce(function (object, l) {
90
+ object[l.InternalName] = l.Id;
91
+ return object;
86
92
  }, {});
87
- return [4 /*yield*/, siteFields.reduce(function (chain, schemaXml) { return chain.then(function () { return _this.processSiteField(web, schemaXml); }); }, Promise.resolve())];
93
+ return [4 /*yield*/, siteFields.reduce(function (chain, schemaXml) {
94
+ return chain.then(function () { return _this.processSiteField(web, schemaXml); });
95
+ }, Promise.resolve())];
88
96
  case 3:
89
97
  _b.sent();
90
98
  return [3 /*break*/, 5];
91
99
  case 4:
92
- err_1 = _b.sent();
93
- _super.prototype.scope_ended.call(this);
94
- throw err_1;
100
+ error_1 = _b.sent();
101
+ _super.prototype.scope_ended.call(this, error_1);
102
+ throw error_1;
95
103
  case 5: return [2 /*return*/];
96
104
  }
97
105
  });
@@ -100,12 +108,12 @@ var SiteFields = (function (_super) {
100
108
  /**
101
109
  * Provision a site field
102
110
  *
103
- * @param {Web} web The web
104
- * @param {IClientSidePage} clientSidePage Cient side page
111
+ * @param web - The web
112
+ * @param clientSidePage - Cient side page
105
113
  */
106
114
  SiteFields.prototype.processSiteField = function (web, schemaXml) {
107
115
  return __awaiter(this, void 0, void 0, function () {
108
- var schemaXmlJson, _a, DisplayName, Name, err_2;
116
+ var schemaXmlJson, _a, DisplayName, Name, error_2;
109
117
  return __generator(this, function (_b) {
110
118
  switch (_b.label) {
111
119
  case 0:
@@ -114,17 +122,19 @@ var SiteFields = (function (_super) {
114
122
  schemaXmlJson = JSON.parse(xmljs.xml2json(schemaXml));
115
123
  _a = schemaXmlJson.elements[0].attributes, DisplayName = _a.DisplayName, Name = _a.Name;
116
124
  if (!this.context.siteFields[Name]) return [3 /*break*/, 2];
117
- _super.prototype.log_info.call(this, "processSiteField", "Updating site field " + DisplayName);
118
- return [4 /*yield*/, web.fields.getByInternalNameOrTitle(Name).update({ SchemaXml: schemaXml })];
125
+ _super.prototype.log_info.call(this, 'processSiteField', "Updating site field " + DisplayName);
126
+ return [4 /*yield*/, web.fields
127
+ .getByInternalNameOrTitle(Name)
128
+ .update({ SchemaXml: schemaXml })];
119
129
  case 1: return [2 /*return*/, _b.sent()];
120
130
  case 2:
121
- _super.prototype.log_info.call(this, "processSiteField", "Adding site field " + DisplayName);
131
+ _super.prototype.log_info.call(this, 'processSiteField', "Adding site field " + DisplayName);
122
132
  return [4 /*yield*/, web.fields.createFieldAsXml(schemaXml)];
123
133
  case 3: return [2 /*return*/, _b.sent()];
124
134
  case 4: return [3 /*break*/, 6];
125
135
  case 5:
126
- err_2 = _b.sent();
127
- throw err_2;
136
+ error_2 = _b.sent();
137
+ throw error_2;
128
138
  case 6: return [2 /*return*/];
129
139
  }
130
140
  });
@@ -133,3 +143,4 @@ var SiteFields = (function (_super) {
133
143
  return SiteFields;
134
144
  }(HandlerBase));
135
145
  export { SiteFields };
146
+ //# sourceMappingURL=sitefields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sitefields.js","sourceRoot":"","sources":["../../src/handlers/sitefields.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD;;GAEG;AACH;IAAgC,8BAAW;IAIzC;;OAEG;IACH,oBAAY,MAA2B;eACrC,kBAAM,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACU,qCAAgB,GAA7B,UACE,GAAQ,EACR,UAAoB,EACpB,OAA6B;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AA,CAAyC;6BAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAA7B,wBAA6B;wBAC/B,iBAAM,QAAQ,YAAC,kBAAkB,EAAE,yBAAuB,WAAa,CAAC,CAAA;wBACjE,qBAAM,GAAG,CAAC,MAAM;iCACpB,wBAAwB,CAAC,IAAI,CAAC;iCAC9B,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAA;4BAFnC,sBAAO,SAE4B,EAAA;;wBAEnC,iBAAM,QAAQ,YAAC,kBAAkB,EAAE,uBAAqB,WAAa,CAAC,CAAA;wBAC/D,qBAAM,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAA;4BAAnD,sBAAO,SAA4C,EAAA;;;;wBAGrD,MAAM,OAAK,CAAA;;;;;KAEd;IACH,iBAAC;AAAD,CAAC,AAzED,CAAgC,WAAW,GAyE1C"}
@@ -1,7 +1,7 @@
1
- import { HandlerBase } from "./handlerbase";
2
- import { IWebSettings } from "../schema";
3
- import { Web } from "@pnp/sp";
4
- import { IProvisioningConfig } from "../provisioningconfig";
1
+ import { HandlerBase } from './handlerbase';
2
+ import { IWebSettings } from '../schema';
3
+ import { Web } from '@pnp/sp';
4
+ import { IProvisioningConfig } from '../provisioningconfig';
5
5
  /**
6
6
  * Describes the WebSettings Object Handler
7
7
  */
@@ -9,14 +9,14 @@ export declare class WebSettings extends HandlerBase {
9
9
  /**
10
10
  * Creates a new instance of the WebSettings class
11
11
  *
12
- * @param {IProvisioningConfig} config Provisioning config
12
+ * @param config - Provisioning config
13
13
  */
14
14
  constructor(config: IProvisioningConfig);
15
15
  /**
16
16
  * Provisioning WebSettings
17
17
  *
18
- * @param {Web} web The web
19
- * @param {IWebSettings} settings The settings
18
+ * @param web - The web
19
+ * @param settings - The settings
20
20
  */
21
21
  ProvisionObjects(web: Web, settings: IWebSettings): Promise<void>;
22
22
  }