@pnp/cli-microsoft365 6.8.0-beta.74dea8a → 6.8.0-beta.85a1ca9
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/dist/Command.js +6 -0
- package/dist/chili/chili.js +298 -0
- package/dist/chili/index.js +20 -0
- package/dist/cli/Cli.js +2 -2
- package/dist/m365/app/commands/permission/permission-add.js +279 -0
- package/dist/m365/app/commands.js +1 -0
- package/dist/m365/commands/commands.js +1 -0
- package/dist/m365/commands/setup.js +180 -0
- package/dist/m365/commands/setupPresets.js +25 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +2 -0
- package/dist/m365/spfx/commands/spfx-doctor.js +14 -30
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +146 -0
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +308 -0
- package/dist/m365/spo/commands/page/page-section-add.js +2 -3
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +30 -39
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +47 -0
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +151 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +152 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +203 -0
- package/dist/m365/spo/commands.js +6 -0
- package/dist/utils/formatting.js +35 -11
- package/dist/utils/pid.js +5 -0
- package/docs/docs/cmd/app/permission/permission-add.md +53 -0
- package/docs/docs/cmd/flow/environment/environment-list.md +18 -0
- package/docs/docs/cmd/flow/flow-get.md +20 -0
- package/docs/docs/cmd/flow/flow-list.md +17 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +1 -1
- package/docs/docs/cmd/planner/plan/plan-list.md +1 -1
- package/docs/docs/cmd/planner/roster/roster-add.md +2 -1
- package/docs/docs/cmd/planner/roster/roster-get.md +1 -1
- package/docs/docs/cmd/planner/roster/roster-remove.md +2 -1
- package/docs/docs/cmd/planner/task/task-set.md +1 -1
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +6 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +6 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +4 -4
- package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +4 -4
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +11 -11
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +10 -10
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -12
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +8 -9
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +8 -9
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +8 -8
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +8 -8
- package/docs/docs/cmd/setup.md +86 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +1 -1
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.md +77 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-set.md +2 -2
- package/docs/docs/cmd/spo/customaction/customaction-add.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-set.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-copy.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-batch-set.md +67 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.md +103 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-remove.md +49 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-remove.md +49 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.md +57 -0
- package/docs/docs/cmd/teams/tab/tab-remove.md +1 -1
- package/docs/docs/cmd/version.md +1 -1
- package/docs/docs/cmd/yammer/group/group-list.md +42 -0
- package/docs/docs/cmd/yammer/message/message-add.md +32 -0
- package/docs/docs/cmd/yammer/message/message-get.md +32 -0
- package/docs/docs/cmd/yammer/message/message-list.md +34 -0
- package/docs/docs/cmd/yammer/network/network-list.md +70 -0
- package/docs/docs/cmd/yammer/report/report-activitycounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-activityusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-activityuserdetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusagedistributionusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusageusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusageuserdetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitycounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitydetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitygroupcounts.md +7 -0
- package/docs/docs/cmd/yammer/user/user-get.md +55 -0
- package/docs/docs/cmd/yammer/user/user-list.md +55 -0
- package/docs/docs/cmd/yammer/yammer-search.md +15 -3
- package/package.json +2 -1
|
@@ -0,0 +1,180 @@
|
|
|
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 _SetupCommand_instances, _SetupCommand_initTelemetry, _SetupCommand_initOptions, _SetupCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chalk = require("chalk");
|
|
19
|
+
const os = require("os");
|
|
20
|
+
const Cli_1 = require("../../cli/Cli");
|
|
21
|
+
const formatting_1 = require("../../utils/formatting");
|
|
22
|
+
const pid_1 = require("../../utils/pid");
|
|
23
|
+
const AnonymousCommand_1 = require("../base/AnonymousCommand");
|
|
24
|
+
const commands_1 = require("./commands");
|
|
25
|
+
const setupPresets_1 = require("./setupPresets");
|
|
26
|
+
class SetupCommand extends AnonymousCommand_1.default {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands_1.default.SETUP;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Sets up CLI for Microsoft 365 based on your preferences';
|
|
32
|
+
}
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
_SetupCommand_instances.add(this);
|
|
36
|
+
// used for injecting answers from tests
|
|
37
|
+
this.answers = {};
|
|
38
|
+
__classPrivateFieldGet(this, _SetupCommand_instances, "m", _SetupCommand_initTelemetry).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _SetupCommand_instances, "m", _SetupCommand_initOptions).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _SetupCommand_instances, "m", _SetupCommand_initValidators).call(this);
|
|
41
|
+
}
|
|
42
|
+
commandAction(logger, args) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
let settings;
|
|
45
|
+
if (args.options.interactive || args.options.scripting) {
|
|
46
|
+
settings = {};
|
|
47
|
+
if (args.options.interactive) {
|
|
48
|
+
Object.assign(settings, setupPresets_1.interactivePreset);
|
|
49
|
+
}
|
|
50
|
+
else if (args.options.scripting) {
|
|
51
|
+
Object.assign(settings, setupPresets_1.scriptingPreset);
|
|
52
|
+
}
|
|
53
|
+
if (pid_1.pid.isPowerShell()) {
|
|
54
|
+
Object.assign(settings, setupPresets_1.powerShellPreset);
|
|
55
|
+
}
|
|
56
|
+
this.configureSettings(settings, true, logger);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
logger.logToStderr(`Welcome to the CLI for Microsoft 365 setup!`);
|
|
60
|
+
logger.logToStderr(`This command will guide you through the process of configuring the CLI for your needs.`);
|
|
61
|
+
logger.logToStderr(`Please, answer the following questions and we'll define a set of settings to best match how you intend to use the CLI.`);
|
|
62
|
+
logger.logToStderr('');
|
|
63
|
+
const preferences = yield Cli_1.Cli.prompt([
|
|
64
|
+
{
|
|
65
|
+
type: 'list',
|
|
66
|
+
name: 'usageMode',
|
|
67
|
+
message: 'How do you plan to use the CLI?',
|
|
68
|
+
choices: [
|
|
69
|
+
'Interactively',
|
|
70
|
+
'Scripting'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: 'usedInPowerShell',
|
|
76
|
+
message: 'Are you going to use the CLI in PowerShell?',
|
|
77
|
+
when: (answers) => answers.usageMode === 'Scripting',
|
|
78
|
+
default: pid_1.pid.isPowerShell()
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'list',
|
|
82
|
+
name: 'experience',
|
|
83
|
+
message: 'How experienced are you in using the CLI?',
|
|
84
|
+
choices: [
|
|
85
|
+
'Beginner',
|
|
86
|
+
'Proficient'
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'confirm',
|
|
91
|
+
name: 'summary',
|
|
92
|
+
// invoked by inquirer
|
|
93
|
+
/* c8 ignore next 4 */
|
|
94
|
+
message: (answers) => {
|
|
95
|
+
settings = this.getSettings(answers);
|
|
96
|
+
return this.getSummaryMessage(settings);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
], this.answers);
|
|
100
|
+
if (preferences.summary) {
|
|
101
|
+
// used only for testing. Normally, we'd get the settings from the answers
|
|
102
|
+
/* c8 ignore next 3 */
|
|
103
|
+
if (!settings) {
|
|
104
|
+
settings = this.getSettings(preferences);
|
|
105
|
+
}
|
|
106
|
+
logger.logToStderr('');
|
|
107
|
+
logger.logToStderr('Configuring settings...');
|
|
108
|
+
logger.logToStderr('');
|
|
109
|
+
this.configureSettings(settings, false, logger);
|
|
110
|
+
if (!this.verbose) {
|
|
111
|
+
logger.logToStderr('');
|
|
112
|
+
logger.logToStderr(chalk.green('DONE'));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
getSummaryMessage(settings) {
|
|
118
|
+
const messageLines = [`Based on your preferences, we'll configure the following settings:`];
|
|
119
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
120
|
+
messageLines.push(`- ${key}: ${value}`);
|
|
121
|
+
}
|
|
122
|
+
messageLines.push('', 'You can change any of these settings later using the `m365 cli config set` command or reset them to default using `m365 cli config reset`.', '', 'Do you want to apply these settings now?');
|
|
123
|
+
return messageLines.join(os.EOL);
|
|
124
|
+
}
|
|
125
|
+
getSettings(answers) {
|
|
126
|
+
const settings = {};
|
|
127
|
+
switch (answers.usageMode) {
|
|
128
|
+
case 'Interactively':
|
|
129
|
+
Object.assign(settings, setupPresets_1.interactivePreset);
|
|
130
|
+
break;
|
|
131
|
+
case 'Scripting':
|
|
132
|
+
Object.assign(settings, setupPresets_1.scriptingPreset);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (answers.usedInPowerShell === true) {
|
|
136
|
+
Object.assign(settings, setupPresets_1.powerShellPreset);
|
|
137
|
+
}
|
|
138
|
+
switch (answers.experience) {
|
|
139
|
+
case 'Beginner':
|
|
140
|
+
settings.helpMode = 'full';
|
|
141
|
+
break;
|
|
142
|
+
case 'Proficient':
|
|
143
|
+
settings.helpMode = 'options';
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
return settings;
|
|
147
|
+
}
|
|
148
|
+
configureSettings(settings, silent, logger) {
|
|
149
|
+
if (this.debug) {
|
|
150
|
+
logger.logToStderr('Configuring settings...');
|
|
151
|
+
logger.logToStderr(JSON.stringify(settings, null, 2));
|
|
152
|
+
}
|
|
153
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
154
|
+
Cli_1.Cli.getInstance().config.set(key, value);
|
|
155
|
+
if (!silent) {
|
|
156
|
+
logger.logToStderr(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `${key}: ${value}`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
_SetupCommand_instances = new WeakSet(), _SetupCommand_initTelemetry = function _SetupCommand_initTelemetry() {
|
|
162
|
+
this.telemetry.push((args) => {
|
|
163
|
+
const properties = {
|
|
164
|
+
interactive: args.options.interactive,
|
|
165
|
+
scripting: args.options.scripting
|
|
166
|
+
};
|
|
167
|
+
Object.assign(this.telemetryProperties, properties);
|
|
168
|
+
});
|
|
169
|
+
}, _SetupCommand_initOptions = function _SetupCommand_initOptions() {
|
|
170
|
+
this.options.unshift({ option: '--interactive' }, { option: '--scripting' });
|
|
171
|
+
}, _SetupCommand_initValidators = function _SetupCommand_initValidators() {
|
|
172
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
if (args.options.interactive && args.options.scripting) {
|
|
174
|
+
return 'Specify either interactive or scripting but not both';
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
module.exports = new SetupCommand();
|
|
180
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.powerShellPreset = exports.scriptingPreset = exports.interactivePreset = void 0;
|
|
4
|
+
exports.interactivePreset = {
|
|
5
|
+
autoOpenLinksInBrowser: true,
|
|
6
|
+
copyDeviceCodeToClipboard: true,
|
|
7
|
+
output: 'text',
|
|
8
|
+
printErrorsAsPlainText: true,
|
|
9
|
+
prompt: true,
|
|
10
|
+
showHelpOnFailure: true,
|
|
11
|
+
showSpinner: true
|
|
12
|
+
};
|
|
13
|
+
exports.scriptingPreset = {
|
|
14
|
+
autoOpenLinksInBrowser: false,
|
|
15
|
+
copyDeviceCodeToClipboard: false,
|
|
16
|
+
output: 'json',
|
|
17
|
+
printErrorsAsPlainText: false,
|
|
18
|
+
prompt: false,
|
|
19
|
+
showHelpOnFailure: false,
|
|
20
|
+
showSpinner: false
|
|
21
|
+
};
|
|
22
|
+
exports.powerShellPreset = {
|
|
23
|
+
errorOutput: 'stdout'
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=setupPresets.js.map
|
|
@@ -22,6 +22,7 @@ const FN001032_DEP_microsoft_sp_page_context_1 = require("./rules/FN001032_DEP_m
|
|
|
22
22
|
const FN001034_DEP_microsoft_sp_adaptive_card_extension_base_1 = require("./rules/FN001034_DEP_microsoft_sp_adaptive_card_extension_base");
|
|
23
23
|
const FN002001_DEVDEP_microsoft_sp_build_web_1 = require("./rules/FN002001_DEVDEP_microsoft_sp_build_web");
|
|
24
24
|
const FN002002_DEVDEP_microsoft_sp_module_interfaces_1 = require("./rules/FN002002_DEVDEP_microsoft_sp_module_interfaces");
|
|
25
|
+
const FN002019_DEVDEP_spfx_fast_serve_helpers_1 = require("./rules/FN002019_DEVDEP_spfx_fast_serve_helpers");
|
|
25
26
|
const FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1 = require("./rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx");
|
|
26
27
|
const FN002023_DEVDEP_microsoft_eslint_config_spfx_1 = require("./rules/FN002023_DEVDEP_microsoft_eslint_config_spfx");
|
|
27
28
|
const FN002026_DEVDEP_typescript_1 = require("./rules/FN002026_DEVDEP_typescript");
|
|
@@ -54,6 +55,7 @@ module.exports = [
|
|
|
54
55
|
new FN002023_DEVDEP_microsoft_eslint_config_spfx_1.FN002023_DEVDEP_microsoft_eslint_config_spfx('1.15.2'),
|
|
55
56
|
new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.15.2'),
|
|
56
57
|
new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.15.2'),
|
|
58
|
+
new FN002019_DEVDEP_spfx_fast_serve_helpers_1.FN002019_DEVDEP_spfx_fast_serve_helpers('1.15.4'),
|
|
57
59
|
new FN002026_DEVDEP_typescript_1.FN002026_DEVDEP_typescript('4.5.5'),
|
|
58
60
|
new FN010001_YORC_version_1.FN010001_YORC_version('1.15.2'),
|
|
59
61
|
new FN012020_TSC_noImplicitAny_1.FN012020_TSC_noImplicitAny(true),
|
|
@@ -15,19 +15,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chalk = require("chalk");
|
|
19
18
|
const child_process = require("child_process");
|
|
20
19
|
const semver_1 = require("semver");
|
|
20
|
+
const formatting_1 = require("../../../utils/formatting");
|
|
21
21
|
const commands_1 = require("../commands");
|
|
22
22
|
const base_project_command_1 = require("./project/base-project-command");
|
|
23
|
-
/**
|
|
24
|
-
* Has the particular check passed or failed
|
|
25
|
-
*/
|
|
26
|
-
var CheckStatus;
|
|
27
|
-
(function (CheckStatus) {
|
|
28
|
-
CheckStatus[CheckStatus["Success"] = 0] = "Success";
|
|
29
|
-
CheckStatus[CheckStatus["Failure"] = 1] = "Failure";
|
|
30
|
-
})(CheckStatus || (CheckStatus = {}));
|
|
31
23
|
/**
|
|
32
24
|
* Where to search for the particular npm package: only in the current project,
|
|
33
25
|
* in global packages or both
|
|
@@ -520,12 +512,12 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
520
512
|
try {
|
|
521
513
|
spfxVersion = (_a = args.options.spfxVersion) !== null && _a !== void 0 ? _a : yield this.getSharePointFrameworkVersion(logger);
|
|
522
514
|
if (!spfxVersion) {
|
|
523
|
-
logger.log(
|
|
515
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework`));
|
|
524
516
|
throw `SharePoint Framework not found`;
|
|
525
517
|
}
|
|
526
518
|
prerequisites = this.versions[spfxVersion];
|
|
527
519
|
if (!prerequisites) {
|
|
528
|
-
logger.log(
|
|
520
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
|
|
529
521
|
throw `spfx doctor doesn't support SPFx v${spfxVersion} at this moment`;
|
|
530
522
|
}
|
|
531
523
|
if (args.options.spfxVersion) {
|
|
@@ -533,7 +525,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
533
525
|
}
|
|
534
526
|
else {
|
|
535
527
|
// spfx was detected and if we are here, it means that we support it
|
|
536
|
-
logger.log(
|
|
528
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
|
|
537
529
|
}
|
|
538
530
|
yield this.checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger);
|
|
539
531
|
yield this.checkNodeVersion(prerequisites, fixes, logger);
|
|
@@ -566,11 +558,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
566
558
|
if (args.options.env) {
|
|
567
559
|
const sp = this.spVersionStringToEnum(args.options.env);
|
|
568
560
|
if ((prerequisites.sp & sp) === sp) {
|
|
569
|
-
logger.log(
|
|
561
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
|
|
570
562
|
resolve();
|
|
571
563
|
}
|
|
572
564
|
else {
|
|
573
|
-
logger.log(
|
|
565
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
|
|
574
566
|
fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
|
|
575
567
|
reject(`SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`);
|
|
576
568
|
}
|
|
@@ -601,7 +593,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
601
593
|
this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck, OptionalOrRequired.Required, fixes, logger);
|
|
602
594
|
}
|
|
603
595
|
else {
|
|
604
|
-
logger.log(
|
|
596
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersionRequested} not found`));
|
|
605
597
|
fixes.push(versionCheck.fix);
|
|
606
598
|
}
|
|
607
599
|
});
|
|
@@ -614,7 +606,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
614
606
|
this.checkStatus('yo', yoVersion, prerequisites.yo, OptionalOrRequired.Required, fixes, logger);
|
|
615
607
|
}
|
|
616
608
|
else {
|
|
617
|
-
logger.log(
|
|
609
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `yo not found`));
|
|
618
610
|
fixes.push(prerequisites.yo.fix);
|
|
619
611
|
}
|
|
620
612
|
});
|
|
@@ -627,7 +619,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
627
619
|
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli, OptionalOrRequired.Required, fixes, logger);
|
|
628
620
|
}
|
|
629
621
|
else {
|
|
630
|
-
logger.log(
|
|
622
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp-cli not found`));
|
|
631
623
|
fixes.push(prerequisites.gulpCli.fix);
|
|
632
624
|
}
|
|
633
625
|
});
|
|
@@ -637,7 +629,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
637
629
|
.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
|
|
638
630
|
.then((gulpVersion) => {
|
|
639
631
|
if (gulpVersion) {
|
|
640
|
-
logger.log(
|
|
632
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp should be removed`));
|
|
641
633
|
fixes.push('npm un -g gulp');
|
|
642
634
|
}
|
|
643
635
|
});
|
|
@@ -647,11 +639,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
647
639
|
.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger)
|
|
648
640
|
.then((typeScriptVersion) => {
|
|
649
641
|
if (typeScriptVersion) {
|
|
650
|
-
logger.log(
|
|
642
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
|
|
651
643
|
fixes.push('npm un typescript');
|
|
652
644
|
}
|
|
653
645
|
else {
|
|
654
|
-
logger.log(
|
|
646
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `bundled typescript used`));
|
|
655
647
|
}
|
|
656
648
|
});
|
|
657
649
|
}
|
|
@@ -775,22 +767,14 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
775
767
|
checkStatus(what, versionFound, versionCheck, optionalOrRequired, fixes, logger) {
|
|
776
768
|
if (versionFound) {
|
|
777
769
|
if ((0, semver_1.satisfies)(versionFound, versionCheck.range)) {
|
|
778
|
-
logger.log(
|
|
770
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `${what} v${versionFound}`));
|
|
779
771
|
}
|
|
780
772
|
else {
|
|
781
|
-
logger.log(
|
|
773
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `${what} v${versionFound} found, v${versionCheck.range} required`));
|
|
782
774
|
fixes.push(versionCheck.fix);
|
|
783
775
|
}
|
|
784
776
|
}
|
|
785
777
|
}
|
|
786
|
-
getStatus(result, message) {
|
|
787
|
-
const primarySupported = process.platform !== 'win32' ||
|
|
788
|
-
process.env.CI === 'true' ||
|
|
789
|
-
process.env.TERM === 'xterm-256color';
|
|
790
|
-
const success = primarySupported ? '✔' : '√';
|
|
791
|
-
const failure = primarySupported ? '✖' : '×';
|
|
792
|
-
return `${result === CheckStatus.Success ? chalk.green(success) : chalk.red(failure)} ${message}`;
|
|
793
|
-
}
|
|
794
778
|
}
|
|
795
779
|
_SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry = function _SpfxDoctorCommand_initTelemetry() {
|
|
796
780
|
this.telemetry.push((args) => {
|
|
@@ -0,0 +1,146 @@
|
|
|
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 _SpoApplicationCustomizerRemoveCommand_instances, _SpoApplicationCustomizerRemoveCommand_initOptions, _SpoApplicationCustomizerRemoveCommand_initTelemetry, _SpoApplicationCustomizerRemoveCommand_initValidators, _SpoApplicationCustomizerRemoveCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const spo_1 = require("../../../../utils/spo");
|
|
24
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
25
|
+
const os = require("os");
|
|
26
|
+
class SpoApplicationCustomizerRemoveCommand extends SpoCommand_1.default {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands_1.default.APPLICATIONCUSTOMIZER_REMOVE;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Removes an application customizer that is added to a site';
|
|
32
|
+
}
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
_SpoApplicationCustomizerRemoveCommand_instances.add(this);
|
|
36
|
+
this.allowedScopes = ['Site', 'Web', 'All'];
|
|
37
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initTelemetry).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptions).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initValidators).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptionSets).call(this);
|
|
41
|
+
}
|
|
42
|
+
commandAction(logger, args) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
try {
|
|
45
|
+
if (args.options.confirm) {
|
|
46
|
+
return yield this.removeApplicationCustomizer(logger, args.options);
|
|
47
|
+
}
|
|
48
|
+
const result = yield Cli_1.Cli.prompt({
|
|
49
|
+
type: 'confirm',
|
|
50
|
+
name: 'continue',
|
|
51
|
+
default: false,
|
|
52
|
+
message: `Are you sure you want to remove the application customizer '${args.options.clientSideComponentId || args.options.title || args.options.id}'?`
|
|
53
|
+
});
|
|
54
|
+
if (result.continue) {
|
|
55
|
+
yield this.removeApplicationCustomizer(logger, args.options);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
removeApplicationCustomizer(logger, options) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const applicationCustomizer = yield this.getApplicationCustomizer(options);
|
|
66
|
+
if (this.verbose) {
|
|
67
|
+
logger.logToStderr(`Removing application customizer '${options.clientSideComponentId || options.title || options.id}' from the site '${options.webUrl}'...`);
|
|
68
|
+
}
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: `${options.webUrl}/_api/${applicationCustomizer.Scope.toString() === '2' ? 'Site' : 'Web'}/UserCustomActions('${applicationCustomizer.Id}')`,
|
|
71
|
+
headers: {
|
|
72
|
+
accept: 'application/json;odata=nometadata'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
yield request_1.default.delete(requestOptions);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
getApplicationCustomizer(options) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const resolvedScope = options.scope || 'All';
|
|
82
|
+
let appCustomizers = [];
|
|
83
|
+
if (options.id) {
|
|
84
|
+
const appCustomizer = yield spo_1.spo.getCustomActionById(options.webUrl, options.id, resolvedScope);
|
|
85
|
+
if (appCustomizer) {
|
|
86
|
+
appCustomizers.push(appCustomizer);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (options.title) {
|
|
90
|
+
appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(ClientSideComponentId eq guid'${options.clientSideComponentId}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
94
|
+
}
|
|
95
|
+
if (appCustomizers.length === 0) {
|
|
96
|
+
throw `No application customizer with ${options.title && `title '${options.title}'` || options.clientSideComponentId && `ClientSideComponentId '${options.clientSideComponentId}'` || options.id && `id '${options.id}'`} found`;
|
|
97
|
+
}
|
|
98
|
+
if (appCustomizers.length > 1) {
|
|
99
|
+
throw `Multiple application customizer with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${appCustomizers.map(a => `- ${a.Id}`).join(os.EOL)}`;
|
|
100
|
+
}
|
|
101
|
+
return appCustomizers[0];
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_SpoApplicationCustomizerRemoveCommand_instances = new WeakSet(), _SpoApplicationCustomizerRemoveCommand_initOptions = function _SpoApplicationCustomizerRemoveCommand_initOptions() {
|
|
106
|
+
this.options.unshift({
|
|
107
|
+
option: '-u, --webUrl <webUrl>'
|
|
108
|
+
}, {
|
|
109
|
+
option: '-t, --title [title]'
|
|
110
|
+
}, {
|
|
111
|
+
option: '-i, --id [id]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
114
|
+
}, {
|
|
115
|
+
option: '-s, --scope [scope]', autocomplete: this.allowedScopes
|
|
116
|
+
}, {
|
|
117
|
+
option: '--confirm'
|
|
118
|
+
});
|
|
119
|
+
}, _SpoApplicationCustomizerRemoveCommand_initTelemetry = function _SpoApplicationCustomizerRemoveCommand_initTelemetry() {
|
|
120
|
+
this.telemetry.push((args) => {
|
|
121
|
+
Object.assign(this.telemetryProperties, {
|
|
122
|
+
title: typeof args.options.title !== 'undefined',
|
|
123
|
+
id: typeof args.options.id !== 'undefined',
|
|
124
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
125
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
126
|
+
confirm: !!args.options.confirm
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}, _SpoApplicationCustomizerRemoveCommand_initValidators = function _SpoApplicationCustomizerRemoveCommand_initValidators() {
|
|
130
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
132
|
+
return `${args.options.id} is not a valid GUID`;
|
|
133
|
+
}
|
|
134
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
135
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
136
|
+
}
|
|
137
|
+
if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
|
|
138
|
+
return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
|
|
139
|
+
}
|
|
140
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
141
|
+
}));
|
|
142
|
+
}, _SpoApplicationCustomizerRemoveCommand_initOptionSets = function _SpoApplicationCustomizerRemoveCommand_initOptionSets() {
|
|
143
|
+
this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
|
|
144
|
+
};
|
|
145
|
+
module.exports = new SpoApplicationCustomizerRemoveCommand();
|
|
146
|
+
//# sourceMappingURL=applicationcustomizer-remove.js.map
|