@pnp/cli-microsoft365 6.3.0-beta.64eb7da → 6.3.0-beta.ac7b232
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/.eslintrc.js
CHANGED
|
@@ -7,6 +7,7 @@ const dictionary = [
|
|
|
7
7
|
'adaptive',
|
|
8
8
|
'ai',
|
|
9
9
|
'app',
|
|
10
|
+
'application',
|
|
10
11
|
'apply',
|
|
11
12
|
'approve',
|
|
12
13
|
'assets',
|
|
@@ -20,6 +21,7 @@ const dictionary = [
|
|
|
20
21
|
'content',
|
|
21
22
|
'conversation',
|
|
22
23
|
'custom',
|
|
24
|
+
'customizer',
|
|
23
25
|
'dataverse',
|
|
24
26
|
'default',
|
|
25
27
|
'external',
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoApplicationCustomizerAddCommand_instances, _SpoApplicationCustomizerAddCommand_initOptions, _SpoApplicationCustomizerAddCommand_initTelemetry, _SpoApplicationCustomizerAddCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
const spoCustomActionAddCommand = require("../customaction/customaction-add");
|
|
23
|
+
class SpoApplicationCustomizerAddCommand extends SpoCommand_1.default {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands_1.default.APPLICATIONCUSTOMIZER_ADD;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Add an application customizer to a site.';
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
_SpoApplicationCustomizerAddCommand_instances.add(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initTelemetry).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initOptions).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initValidators).call(this);
|
|
36
|
+
}
|
|
37
|
+
commandAction(logger, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (this.verbose) {
|
|
40
|
+
logger.logToStderr(`Adding application customizer with title '${args.options.title}' and clientSideComponentId '${args.options.clientSideComponentId}' to the site`);
|
|
41
|
+
}
|
|
42
|
+
const options = {
|
|
43
|
+
webUrl: args.options.webUrl,
|
|
44
|
+
name: args.options.title,
|
|
45
|
+
title: args.options.title,
|
|
46
|
+
clientSideComponentId: args.options.clientSideComponentId,
|
|
47
|
+
clientSideComponentProperties: args.options.clientSideComponentProperties || '',
|
|
48
|
+
location: 'ClientSideExtension.ApplicationCustomizer',
|
|
49
|
+
debug: this.debug,
|
|
50
|
+
verbose: this.verbose
|
|
51
|
+
};
|
|
52
|
+
yield Cli_1.Cli.executeCommand(spoCustomActionAddCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_SpoApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoApplicationCustomizerAddCommand_initOptions = function _SpoApplicationCustomizerAddCommand_initOptions() {
|
|
57
|
+
this.options.unshift({
|
|
58
|
+
option: '-t, --title <title>'
|
|
59
|
+
}, {
|
|
60
|
+
option: '-u, --webUrl <webUrl>'
|
|
61
|
+
}, {
|
|
62
|
+
option: '-i, --clientSideComponentId <clientSideComponentId>'
|
|
63
|
+
}, {
|
|
64
|
+
option: '--clientSideComponentProperties [clientSideComponentProperties]'
|
|
65
|
+
});
|
|
66
|
+
}, _SpoApplicationCustomizerAddCommand_initTelemetry = function _SpoApplicationCustomizerAddCommand_initTelemetry() {
|
|
67
|
+
this.telemetry.push((args) => {
|
|
68
|
+
Object.assign(this.telemetryProperties, {
|
|
69
|
+
clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined'
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}, _SpoApplicationCustomizerAddCommand_initValidators = function _SpoApplicationCustomizerAddCommand_initValidators() {
|
|
73
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (args.options.webUrl) {
|
|
75
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
76
|
+
if (isValidSharePointUrl !== true) {
|
|
77
|
+
return isValidSharePointUrl;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
81
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
82
|
+
}
|
|
83
|
+
if (args.options.clientSideComponentProperties) {
|
|
84
|
+
try {
|
|
85
|
+
JSON.parse(args.options.clientSideComponentProperties);
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
module.exports = new SpoApplicationCustomizerAddCommand();
|
|
95
|
+
//# sourceMappingURL=applicationcustomizer-add.js.map
|
|
@@ -13,6 +13,7 @@ exports.default = {
|
|
|
13
13
|
APP_TEAMSPACKAGE_DOWNLOAD: `${prefix} app teamspackage download`,
|
|
14
14
|
APP_UNINSTALL: `${prefix} app uninstall`,
|
|
15
15
|
APP_UPGRADE: `${prefix} app upgrade`,
|
|
16
|
+
APPLICATIONCUSTOMIZER_ADD: `${prefix} applicationcustomizer add`,
|
|
16
17
|
APPPAGE_ADD: `${prefix} apppage add`,
|
|
17
18
|
APPPAGE_SET: `${prefix} apppage set`,
|
|
18
19
|
CDN_GET: `${prefix} cdn get`,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# spo applicationcustomizer add
|
|
2
|
+
|
|
3
|
+
Add an application customizer to a site.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo applicationcustomizer add [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-t, --title <title>`
|
|
14
|
+
: The title of the application customizer.
|
|
15
|
+
|
|
16
|
+
`-u, --webUrl <webUrl>`
|
|
17
|
+
: URL of the site.
|
|
18
|
+
|
|
19
|
+
`-i, --clientSideComponentId <clientSideComponentId>`
|
|
20
|
+
: Client-side component ID of the application customizer (GUID).
|
|
21
|
+
|
|
22
|
+
`--clientSideComponentProperties [clientSideComponentProperties]`
|
|
23
|
+
: JSON string with application customizer properties
|
|
24
|
+
|
|
25
|
+
--8<-- "docs/cmd/_global.md"
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
Running this command from the Windows Command Shell (cmd.exe) or PowerShell for Windows OS XP, 7, 8, 8.1 without bash installed might require additional formatting for command options that have JSON, XML or JavaScript values because the command shell treat quotes differently. For example, this is how an application customizer can be created from the Windows cmd.exe:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
m365 spo applicationcustomizer add --webUrl https://contoso.sharepoint.com/sites/test --title "YourAppCustomizer" --clientSideComponentId b41916e7-e69d-467f-b37f-ff8ecf8f99f2 --clientSideComponentProperties '{\"testMessage\":\"Test message\"}'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Note, how the clientSideComponentProperties option has escaped double quotes `'{\"testMessage\":\"Test message\"}'` compared to execution from bash `'{"testMessage":"Test message"}'`.
|
|
36
|
+
|
|
37
|
+
!!! warning "Escaping JSON in PowerShell"
|
|
38
|
+
When using the `--clientSideComponentProperties` option it's possible to enter a JSON string. In PowerShell 5 to 7.2 [specific escaping rules](./../../../user-guide/using-cli.md#escaping-double-quotes-in-powershell) apply due to an issue. Remember that you can also use [file tokens](./../../../user-guide/using-cli.md#passing-complex-content-into-cli-options) instead.
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
Adds an application customizer to the sales site.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
m365 spo applicationcustomizer add --title 'Some customizer' --clientSideComponentId 799883f5-7962-4384-a10a-105adaec6ffc --webUrl https://contoso.sharepoint.com/sites/sales
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Adds an application customizer to the sales site with some properties.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
m365 spo applicationcustomizer add --title 'Some customizer' --clientSideComponentId 799883f5-7962-4384-a10a-105adaec6ffc --clientSideComponentProperties '{ "someProperty": "Some value" }' --webUrl https://contoso.sharepoint.com/sites/sales
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Response
|
|
55
|
+
|
|
56
|
+
The command won't return a response on success.
|
package/package.json
CHANGED