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,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,62 +47,60 @@ 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 * as omit from "object.omit";
48
- import { replaceUrlTokens } from "../util";
50
+ import { HandlerBase } from './handlerbase';
51
+ import * as omit from 'object.omit';
52
+ import { replaceUrlTokens } from '../util';
49
53
  /**
50
54
  * Describes the WebSettings Object Handler
51
55
  */
52
- var WebSettings = (function (_super) {
56
+ var WebSettings = /** @class */ (function (_super) {
53
57
  __extends(WebSettings, _super);
54
58
  /**
55
59
  * Creates a new instance of the WebSettings class
56
60
  *
57
- * @param {IProvisioningConfig} config Provisioning config
61
+ * @param config - Provisioning config
58
62
  */
59
63
  function WebSettings(config) {
60
- return _super.call(this, "WebSettings", config) || this;
64
+ return _super.call(this, WebSettings.name, config) || this;
61
65
  }
62
66
  /**
63
67
  * Provisioning WebSettings
64
68
  *
65
- * @param {Web} web The web
66
- * @param {IWebSettings} settings The settings
69
+ * @param web - The web
70
+ * @param settings - The settings
67
71
  */
68
72
  WebSettings.prototype.ProvisionObjects = function (web, settings) {
69
73
  return __awaiter(this, void 0, void 0, function () {
70
- var _this = this;
71
- var err_1;
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
74
+ var _i, _a, key, value, error_1;
75
+ return __generator(this, function (_b) {
76
+ switch (_b.label) {
74
77
  case 0:
75
78
  _super.prototype.scope_started.call(this);
76
- Object.keys(settings)
77
- .filter(function (key) { return typeof (settings[key]) === "string"; })
78
- .forEach(function (key) {
79
- var value = replaceUrlTokens(settings[key], _this.config);
80
- _super.prototype.log_info.call(_this, "ProvisionObjects", "Setting value of " + key + " to " + value + ".");
79
+ for (_i = 0, _a = Object.keys(settings).filter(function (key) { return typeof settings[key] === 'string'; }); _i < _a.length; _i++) {
80
+ key = _a[_i];
81
+ value = replaceUrlTokens(settings[key], this.config);
82
+ _super.prototype.log_info.call(this, 'ProvisionObjects', "Setting value of " + key + " to " + value + ".");
81
83
  settings[key] = value;
82
- });
83
- _a.label = 1;
84
+ }
85
+ _b.label = 1;
84
86
  case 1:
85
- _a.trys.push([1, 4, , 5]);
87
+ _b.trys.push([1, 4, , 5]);
86
88
  if (!settings.WelcomePage) return [3 /*break*/, 3];
87
- _super.prototype.log_info.call(this, "ProvisionObjects", "Setting value of WelcomePage to " + settings.WelcomePage + ".");
89
+ _super.prototype.log_info.call(this, 'ProvisionObjects', "Setting value of WelcomePage to " + settings.WelcomePage + ".");
88
90
  return [4 /*yield*/, Promise.all([
89
91
  web.rootFolder.update({ WelcomePage: settings.WelcomePage }),
90
- web.update(omit(settings, "WelcomePage")),
92
+ web.update(omit(settings, 'WelcomePage'))
91
93
  ])];
92
94
  case 2:
93
- _a.sent();
94
- _a.label = 3;
95
+ _b.sent();
96
+ _b.label = 3;
95
97
  case 3:
96
98
  _super.prototype.scope_ended.call(this);
97
99
  return [3 /*break*/, 5];
98
100
  case 4:
99
- err_1 = _a.sent();
100
- _super.prototype.scope_ended.call(this);
101
- throw err_1;
101
+ error_1 = _b.sent();
102
+ _super.prototype.scope_ended.call(this, error_1);
103
+ throw error_1;
102
104
  case 5: return [2 /*return*/];
103
105
  }
104
106
  });
@@ -107,3 +109,4 @@ var WebSettings = (function (_super) {
107
109
  return WebSettings;
108
110
  }(HandlerBase));
109
111
  export { WebSettings };
112
+ //# sourceMappingURL=websettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websettings.js","sourceRoot":"","sources":["../../src/handlers/websettings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eA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,WAAW,YAAC,OAAK,CAAC,CAAA;wBACxB,MAAM,OAAK,CAAA;;;;;KAEd;IACH,kBAAC;AAAD,CAAC,AA7CD,CAAiC,WAAW,GA6C3C"}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { Schema } from "./schema";
2
- export { WebProvisioner } from "./webprovisioner";
3
- export { sp, Web } from "@pnp/sp";
1
+ export { Schema } from './schema';
2
+ export { WebProvisioner } from './webprovisioner';
3
+ export { sp, Web } from '@pnp/sp';
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { WebProvisioner } from "./webprovisioner";
2
- export { sp, Web } from "@pnp/sp";
1
+ export { WebProvisioner } from './webprovisioner';
2
+ export { sp, Web } from '@pnp/sp';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA"}
@@ -1,5 +1,5 @@
1
- import { LogLevel } from "@pnp/logging";
2
- import { SPConfiguration } from "@pnp/sp";
1
+ import { LogLevel } from '@pnp/logging';
2
+ import { SPConfiguration } from '@pnp/sp';
3
3
  export declare type ProvisioningParameters = {
4
4
  [key: string]: string;
5
5
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=provisioningconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provisioningconfig.js","sourceRoot":"","sources":["../src/provisioningconfig.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { IContentType } from "./schema";
1
+ import { IContentType } from './schema';
2
2
  /**
3
3
  * Describes the Provisioning Context
4
4
  */
@@ -16,8 +16,4 @@ export declare class ProvisioningContext {
16
16
  contentTypes: {
17
17
  [key: string]: IContentType;
18
18
  };
19
- /**
20
- * Creates a new instance of the ProvisioningContext class
21
- */
22
- constructor();
23
19
  }
@@ -1,10 +1,7 @@
1
1
  /**
2
2
  * Describes the Provisioning Context
3
3
  */
4
- var ProvisioningContext = (function () {
5
- /**
6
- * Creates a new instance of the ProvisioningContext class
7
- */
4
+ var ProvisioningContext = /** @class */ (function () {
8
5
  function ProvisioningContext() {
9
6
  this.web = null;
10
7
  this.lists = {};
@@ -15,3 +12,4 @@ var ProvisioningContext = (function () {
15
12
  return ProvisioningContext;
16
13
  }());
17
14
  export { ProvisioningContext };
15
+ //# sourceMappingURL=provisioningcontext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provisioningcontext.js","sourceRoot":"","sources":["../src/provisioningcontext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAAA;QACS,QAAG,GAAG,IAAI,CAAA;QACV,UAAK,GAA8B,EAAE,CAAA;QACrC,cAAS,GAA8B,EAAE,CAAA;QACzC,eAAU,GAA8B,EAAE,CAAA;QAC1C,iBAAY,GAAoC,EAAE,CAAA;IAC3D,CAAC;IAAD,0BAAC;AAAD,CAAC,AAND,IAMC"}
package/lib/schema.d.ts CHANGED
@@ -2,6 +2,7 @@ import { TypedHash } from '@pnp/common';
2
2
  export interface Schema {
3
3
  Parameters?: TypedHash<string>;
4
4
  Version?: string;
5
+ Hooks?: IHooks[];
5
6
  Navigation?: INavigation;
6
7
  CustomActions?: ICustomAction[];
7
8
  ComposedLook?: IComposedLook;
@@ -16,7 +17,7 @@ export interface Schema {
16
17
  [key: string]: any;
17
18
  }
18
19
  export default Schema;
19
- export interface IFieldRef {
20
+ export interface IFieldReference {
20
21
  ID: string;
21
22
  Name?: string;
22
23
  Required?: boolean;
@@ -27,13 +28,19 @@ export interface IContentType {
27
28
  Name: string;
28
29
  Description: string;
29
30
  Group: string;
30
- FieldRefs: IFieldRef[];
31
+ FieldRefs: IFieldReference[];
31
32
  }
32
33
  export interface IClientSideControl {
33
34
  Id: string;
34
35
  Properties: {
35
36
  [key: string]: any;
36
37
  };
38
+ ServerProcessedContent?: {
39
+ htmlStrings: TypedHash<string>;
40
+ searchablePlainTexts: TypedHash<string>;
41
+ imageSources: TypedHash<string>;
42
+ links: TypedHash<string>;
43
+ };
37
44
  }
38
45
  export interface IClientSidePageColumn {
39
46
  Factor: any;
@@ -110,6 +117,13 @@ export interface IWebSettings {
110
117
  SiteLogoUrl?: string;
111
118
  [key: string]: string | boolean;
112
119
  }
120
+ export interface IHooks {
121
+ Title?: string;
122
+ Url: string;
123
+ Method: string;
124
+ Headers?: Headers;
125
+ Body?: Body;
126
+ }
113
127
  export interface INavigation {
114
128
  QuickLaunch?: INavigationNode[];
115
129
  TopNavigationBar?: INavigationNode[];
@@ -138,7 +152,7 @@ export interface IList {
138
152
  RemoveExistingContentTypes?: boolean;
139
153
  ContentTypeBindings?: IContentTypeBinding[];
140
154
  Fields?: string[];
141
- FieldRefs?: IListInstanceFieldRef[];
155
+ FieldRefs?: IListInstanceFieldReference[];
142
156
  Views?: IListView[];
143
157
  Security?: IListSecurity;
144
158
  AdditionalSettings?: {
@@ -172,7 +186,7 @@ export interface IList {
172
186
  [key: string]: string | boolean | number;
173
187
  };
174
188
  }
175
- export interface IListInstanceFieldRef extends IFieldRef {
189
+ export interface IListInstanceFieldReference extends IFieldReference {
176
190
  DisplayName?: string;
177
191
  }
178
192
  export interface IContentTypeBinding {
package/lib/schema.js CHANGED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":""}
@@ -1,10 +1,7 @@
1
- import { IProvisioningConfig } from "../provisioningconfig";
1
+ import { IProvisioningConfig } from '../provisioningconfig';
2
2
  import { TypedHash } from '@pnp/common';
3
- export declare function replaceUrlTokens(str: string, config: IProvisioningConfig): string;
3
+ export declare function replaceUrlTokens(string: string, config: IProvisioningConfig): string;
4
4
  export declare function makeUrlRelative(absUrl: string): string;
5
- export declare function base64EncodeString(str: string): string;
5
+ export declare function base64EncodeString(string: string): string;
6
6
  export declare function isNode(): boolean;
7
7
  export declare function addFieldAttributes(schemaXml: string, attributes: TypedHash<any>): string;
8
- export declare function getFieldAttributes(schemaXml: string): TypedHash<any>;
9
- export declare function getFieldAttribute(schemaXml: string, attrName: string): any;
10
- export declare function delay(ms: number): Promise<void>;
package/lib/util/index.js CHANGED
@@ -1,24 +1,27 @@
1
- var __assign = (this && this.__assign) || Object.assign || function(t) {
2
- for (var s, i = 1, n = arguments.length; i < n; i++) {
3
- s = arguments[i];
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
5
- t[p] = s[p];
6
- }
7
- return t;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
8
11
  };
9
12
  import * as xmljs from 'xml-js';
10
- export function replaceUrlTokens(str, config) {
13
+ export function replaceUrlTokens(string, config) {
11
14
  var siteAbsoluteUrl = null;
12
15
  var siteRelativeUrl = null;
13
16
  if (config.spfxContext) {
14
17
  siteAbsoluteUrl = config.spfxContext.pageContext.site.absoluteUrl;
15
18
  siteRelativeUrl = config.spfxContext.pageContext.site.serverRelativeUrl;
16
19
  }
17
- else if (window.hasOwnProperty("_spPageContextInfo")) {
20
+ else if (window.hasOwnProperty('_spPageContextInfo')) {
18
21
  siteAbsoluteUrl = _spPageContextInfo.siteAbsoluteUrl;
19
22
  siteRelativeUrl = _spPageContextInfo.siteServerRelativeUrl;
20
23
  }
21
- return str
24
+ return string
22
25
  .replace(/{site}/g, siteRelativeUrl)
23
26
  .replace(/{sitecollection}/g, siteAbsoluteUrl)
24
27
  .replace(/{wpgallery}/g, siteAbsoluteUrl + "/_catalogs/wp")
@@ -26,35 +29,23 @@ export function replaceUrlTokens(str, config) {
26
29
  .replace(/{themegallery}/g, siteAbsoluteUrl + "/_catalogs/theme/15");
27
30
  }
28
31
  export function makeUrlRelative(absUrl) {
29
- return absUrl.replace(document.location.protocol + "//" + document.location.hostname, "");
32
+ return absUrl.replace(document.location.protocol + "//" + document.location.hostname, '');
30
33
  }
31
- export function base64EncodeString(str) {
34
+ export function base64EncodeString(string) {
32
35
  var bytes = [];
33
- for (var i = 0; i < str.length; ++i) {
34
- bytes.push(str.charCodeAt(i));
35
- bytes.push(0);
36
+ for (var index = 0; index < string.length; ++index) {
37
+ bytes.push(string.charCodeAt(index), 0);
36
38
  }
37
39
  var b64encoded = window.btoa(String.fromCharCode.apply(null, bytes));
38
40
  return b64encoded;
39
41
  }
40
42
  export function isNode() {
41
- return typeof window === "undefined";
43
+ return typeof window === 'undefined';
42
44
  }
43
45
  export function addFieldAttributes(schemaXml, attributes) {
44
46
  var fieldXmlJson = JSON.parse(xmljs.xml2json(schemaXml));
45
- fieldXmlJson.elements[0].attributes = __assign({}, fieldXmlJson.elements[0].attributes, attributes);
47
+ fieldXmlJson.elements[0].attributes = __assign(__assign({}, fieldXmlJson.elements[0].attributes), attributes);
46
48
  schemaXml = xmljs.json2xml(fieldXmlJson);
47
49
  return schemaXml;
48
50
  }
49
- export function getFieldAttributes(schemaXml) {
50
- var fieldXmlJson = JSON.parse(xmljs.xml2json(schemaXml));
51
- return fieldXmlJson.elements[0].attributes;
52
- }
53
- export function getFieldAttribute(schemaXml, attrName) {
54
- return getFieldAttributes(schemaXml)[attrName];
55
- }
56
- export function delay(ms) {
57
- return new Promise(function (resolve) {
58
- window.setTimeout(resolve, ms);
59
- });
60
- }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAA;AAG/B,MAAM,UAAU,gBAAgB,CAC9B,MAA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E,CAAC,CAAC,CAAA;KACxC;IACD,IAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IACtE,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,UAA0B;IAE1B,IAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;IAC1D,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,yBAC9B,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,GACnC,UAAU,CACd,CAAA;IACD,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IACxC,OAAO,SAAS,CAAA;AAClB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ProvisioningContext } from "../provisioningcontext";
2
- import { IProvisioningConfig } from "../provisioningconfig";
1
+ import { ProvisioningContext } from '../provisioningcontext';
2
+ import { IProvisioningConfig } from '../provisioningconfig';
3
3
  /**
4
4
  * Describes the Token Helper
5
5
  */
@@ -11,5 +11,5 @@ export declare class TokenHelper {
11
11
  * Creates a new instance of the TokenHelper class
12
12
  */
13
13
  constructor(context: ProvisioningContext, config: IProvisioningConfig);
14
- replaceTokens(str: string): string;
14
+ replaceTokens(string: string): string;
15
15
  }
@@ -1,75 +1,76 @@
1
1
  /**
2
2
  * Describes the Token Helper
3
3
  */
4
- var TokenHelper = (function () {
4
+ var TokenHelper = /** @class */ (function () {
5
5
  /**
6
6
  * Creates a new instance of the TokenHelper class
7
7
  */
8
8
  function TokenHelper(context, config) {
9
9
  this.context = context;
10
10
  this.config = config;
11
- this.tokenRegex = /{[a-z]*:[ÆØÅæøåA-za-z| ]*}/g;
11
+ this.tokenRegex = /{[a-z]*:[ A-z|ÅÆØåæø]*}/g;
12
12
  }
13
- TokenHelper.prototype.replaceTokens = function (str) {
14
- var _this = this;
13
+ TokenHelper.prototype.replaceTokens = function (string) {
15
14
  var m;
16
- while ((m = this.tokenRegex.exec(str)) !== null) {
15
+ while ((m = this.tokenRegex.exec(string)) !== null) {
17
16
  if (m.index === this.tokenRegex.lastIndex) {
18
17
  this.tokenRegex.lastIndex++;
19
18
  }
20
- m.forEach(function (match) {
21
- var _a = match.replace(/[\{\}]/g, "").split(":"), tokenKey = _a[0], tokenValue = _a[1];
19
+ for (var _i = 0, m_1 = m; _i < m_1.length; _i++) {
20
+ var match = m_1[_i];
21
+ var _a = match.replace(/[{}]/g, '').split(':'), tokenKey = _a[0], tokenValue = _a[1];
22
22
  switch (tokenKey) {
23
- case "listid":
23
+ case 'listid':
24
24
  {
25
- if (_this.context.lists[tokenValue]) {
26
- str = str.replace(match, _this.context.lists[tokenValue]);
25
+ if (this.context.lists[tokenValue]) {
26
+ string = string.replace(match, this.context.lists[tokenValue]);
27
27
  }
28
28
  }
29
29
  break;
30
- case "listviewid":
30
+ case 'listviewid':
31
31
  {
32
- if (_this.context.listViews[tokenValue]) {
33
- str = str.replace(match, _this.context.listViews[tokenValue]);
32
+ if (this.context.listViews[tokenValue]) {
33
+ string = string.replace(match, this.context.listViews[tokenValue]);
34
34
  }
35
35
  }
36
36
  break;
37
- case "webid":
37
+ case 'webid':
38
38
  {
39
- if (_this.context.web.Id) {
40
- str = str.replace(match, _this.context.web.Id);
39
+ if (this.context.web.Id) {
40
+ string = string.replace(match, this.context.web.Id);
41
41
  }
42
42
  }
43
43
  break;
44
- case "siteid":
44
+ case 'siteid':
45
45
  {
46
- if (_this.context.web.Id) {
47
- str = str.replace(match, _this.context.web.Id);
46
+ if (this.context.web.Id) {
47
+ string = string.replace(match, this.context.web.Id);
48
48
  }
49
49
  }
50
50
  break;
51
- case "sitecollectionid":
51
+ case 'sitecollectionid':
52
52
  {
53
- if (_this.context.web.Id) {
54
- str = str.replace(match, _this.context.web.Id);
53
+ if (this.context.web.Id) {
54
+ string = string.replace(match, this.context.web.Id);
55
55
  }
56
56
  }
57
57
  break;
58
- case "parameter":
58
+ case 'parameter':
59
59
  {
60
- if (_this.config.parameters) {
61
- var paramValue = _this.config.parameters[tokenValue];
62
- if (paramValue) {
63
- str = str.replace(match, paramValue);
60
+ if (this.config.parameters) {
61
+ var parameterValue = this.config.parameters[tokenValue];
62
+ if (parameterValue) {
63
+ string = string.replace(match, parameterValue);
64
64
  }
65
65
  }
66
66
  }
67
67
  break;
68
68
  }
69
- });
69
+ }
70
70
  }
71
- return str;
71
+ return string;
72
72
  };
73
73
  return TokenHelper;
74
74
  }());
75
75
  export { TokenHelper };
76
+ //# sourceMappingURL=tokenhelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenhelper.js","sourceRoot":"","sources":["../../src/util/tokenhelper.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH;IAGE;;OAEG;IACH,qBACS,OAA4B,EAC5B,MAA2B;QAD3B,YAAO,GAAP,OAAO,CAAqB;QAC5B,WAAM,GAAN,MAAM,CAAqB;QAP5B,eAAU,GAAG,0BAA0B,CAAA;IAQ5C,CAAC;IAEG,mCAAa,GAApB,UAAqB,MAAc;QACjC,IAAI,CAAkB,CAAA;QACtB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE;YAClD,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;gBACzC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAA;aAC5B;YACD,KAAoB,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC,EAAE;gBAAlB,IAAM,KAAK,UAAA;gBACR,IAAA,KAAyB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAA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BACP,KAAK,WAAW;wBACd;4BACE,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;gCAC1B,IAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;gCACzD,IAAI,cAAc,EAAE;oCAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;iCAC/C;6BACF;yBACF;wBACD,MAAK;iBACR;aACF;SACF;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IACH,kBAAC;AAAD,CAAC,AAzED,IAyEC"}
@@ -1,8 +1,8 @@
1
- import { Schema } from "./schema";
2
- import { HandlerBase } from "./handlers/handlerbase";
3
- import { Web } from "@pnp/sp";
4
- import { TypedHash } from "@pnp/common";
5
- import { IProvisioningConfig } from "./provisioningconfig";
1
+ import { Schema } from './schema';
2
+ import { HandlerBase } from './handlers/handlerbase';
3
+ import { Web } from '@pnp/sp';
4
+ import { TypedHash } from '@pnp/common';
5
+ import { IProvisioningConfig } from './provisioningconfig';
6
6
  /**
7
7
  * Root class of Provisioning
8
8
  */
@@ -15,23 +15,23 @@ export declare class WebProvisioner {
15
15
  /**
16
16
  * Creates a new instance of the Provisioner class
17
17
  *
18
- * @param {Web} web The Web instance to which we want to apply templates
19
- * @param {TypedHash<HandlerBase>} handlermap A set of handlers we want to apply. The keys of the map need to match the property names in the template
18
+ * @param web - The Web instance to which we want to apply templates
19
+ * @param handlermap - A set of handlers we want to apply. The keys of the map need to match the property names in the template
20
20
  */
21
21
  constructor(web: Web, handlerSort?: TypedHash<number>);
22
- private onSetup();
22
+ private onSetup;
23
23
  /**
24
24
  * Applies the supplied template to the web used to create this Provisioner instance
25
25
  *
26
- * @param {Schema} template The template to apply
27
- * @param {string[]} handlers A set of handlers we want to apply
28
- * @param {Function} progressCallback Callback for progress updates
26
+ * @param template - The template to apply
27
+ * @param handlers - A set of handlers we want to apply
28
+ * @param progressCallback - Callback for progress updates
29
29
  */
30
- applyTemplate(template: Schema, handlers?: string[], progressCallback?: (msg: string) => void): Promise<any>;
30
+ applyTemplate(template: Schema, handlers?: string[], progressCallback?: (message: string) => void): Promise<any>;
31
31
  /**
32
- * Sets up the web provisioner
33
- *
34
- * @param {IProvisioningConfig} config Provisioning config
35
- */
32
+ * Sets up the web provisioner
33
+ *
34
+ * @param config - Provisioning config
35
+ */
36
36
  setup(config: IProvisioningConfig): WebProvisioner;
37
37
  }