@pnp/cli-microsoft365 7.8.0-beta.3152fc7 → 7.8.0-beta.5ca5055
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +16 -1
- package/dist/m365/cli/commands/config/config-set.js +4 -0
- package/dist/m365/flow/commands/run/run-list.js +25 -0
- package/dist/m365/spo/commands/site/site-add.js +17 -26
- package/dist/m365/spo/commands/site/site-remove.js +17 -26
- package/dist/m365/spo/commands/site/site-set.js +9 -13
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +9 -13
- package/dist/settingsNames.js +1 -0
- package/dist/utils/spo.js +209 -278
- package/docs/docs/_clisettings.mdx +1 -0
- package/docs/docs/cmd/flow/run/run-list.mdx +74 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -17,6 +17,7 @@ import { md } from '../utils/md.js';
|
|
|
17
17
|
import { validation } from '../utils/validation.js';
|
|
18
18
|
import { prompt } from '../utils/prompt.js';
|
|
19
19
|
import { timings } from './timings.js';
|
|
20
|
+
import { browserUtil } from '../utils/browserUtil.js';
|
|
20
21
|
import chalk from 'chalk';
|
|
21
22
|
const require = createRequire(import.meta.url);
|
|
22
23
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
@@ -35,7 +36,9 @@ let commandToExecute;
|
|
|
35
36
|
let currentCommandName;
|
|
36
37
|
let optionsFromArgs;
|
|
37
38
|
const defaultHelpMode = 'options';
|
|
39
|
+
const defaultHelpTarget = 'console';
|
|
38
40
|
const helpModes = ['options', 'examples', 'remarks', 'response', 'full'];
|
|
41
|
+
const helpTargets = ['console', 'web'];
|
|
39
42
|
function getConfig() {
|
|
40
43
|
if (!_config) {
|
|
41
44
|
_config = new Configstore(config.configstoreName);
|
|
@@ -551,7 +554,13 @@ async function printHelp(helpMode, exitCode = 0) {
|
|
|
551
554
|
const properties = {};
|
|
552
555
|
if (cli.commandToExecute) {
|
|
553
556
|
properties.command = cli.commandToExecute.name;
|
|
554
|
-
|
|
557
|
+
const helpTarget = getSettingWithDefaultValue(settingsNames.helpTarget, defaultHelpTarget);
|
|
558
|
+
if (helpTarget === 'web') {
|
|
559
|
+
await openHelpInBrowser();
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
printCommandHelp(helpMode);
|
|
563
|
+
}
|
|
555
564
|
}
|
|
556
565
|
else {
|
|
557
566
|
if (cli.currentCommandName && !cli.commands.some(command => command.name.startsWith(cli.currentCommandName))) {
|
|
@@ -567,6 +576,11 @@ async function printHelp(helpMode, exitCode = 0) {
|
|
|
567
576
|
telemetry.trackEvent('help', properties);
|
|
568
577
|
process.exit(exitCode);
|
|
569
578
|
}
|
|
579
|
+
async function openHelpInBrowser() {
|
|
580
|
+
const pathChunks = cli.commandToExecute.help?.replace(/\\/g, '/').replace(/\.[^/.]+$/, '');
|
|
581
|
+
const onlineUrl = `https://pnp.github.io/cli-microsoft365/cmd/${pathChunks}`;
|
|
582
|
+
await browserUtil.open(onlineUrl);
|
|
583
|
+
}
|
|
570
584
|
function printCommandHelp(helpMode) {
|
|
571
585
|
const docsRootDir = path.join(__dirname, '..', '..', 'docs');
|
|
572
586
|
const helpFilePath = path.join(docsRootDir, 'docs', 'cmd', cli.commandToExecute.help);
|
|
@@ -865,6 +879,7 @@ export const cli = {
|
|
|
865
879
|
getSettingWithDefaultValue,
|
|
866
880
|
handleMultipleResultsFound,
|
|
867
881
|
helpModes,
|
|
882
|
+
helpTargets,
|
|
868
883
|
loadAllCommandsInfo,
|
|
869
884
|
loadCommandFromArgs,
|
|
870
885
|
loadCommandFromFile,
|
|
@@ -87,6 +87,10 @@ _a = CliConfigSetCommand, _CliConfigSetCommand_instances = new WeakSet(), _CliCo
|
|
|
87
87
|
allowedAuthTypes.indexOf(args.options.value) === -1) {
|
|
88
88
|
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${allowedAuthTypes.join(', ')}`;
|
|
89
89
|
}
|
|
90
|
+
if (args.options.key === settingsNames.helpTarget &&
|
|
91
|
+
!cli.helpTargets.includes(args.options.value)) {
|
|
92
|
+
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${cli.helpTargets.join(', ')}`;
|
|
93
|
+
}
|
|
90
94
|
return true;
|
|
91
95
|
});
|
|
92
96
|
};
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _FlowRunListCommand_instances, _FlowRunListCommand_initTelemetry, _FlowRunListCommand_initOptions, _FlowRunListCommand_initValidators;
|
|
7
|
+
import request from '../../../../request.js';
|
|
7
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
9
|
import { odata } from '../../../../utils/odata.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -38,6 +39,9 @@ class FlowRunListCommand extends PowerAutomateCommand {
|
|
|
38
39
|
}
|
|
39
40
|
try {
|
|
40
41
|
const items = await odata.getAllItems(url);
|
|
42
|
+
if (args.options.withTrigger) {
|
|
43
|
+
await this.retrieveTriggerInformation(items);
|
|
44
|
+
}
|
|
41
45
|
if (args.options.output !== 'json' && items.length > 0) {
|
|
42
46
|
items.forEach(i => {
|
|
43
47
|
i.startTime = i.properties.startTime;
|
|
@@ -63,6 +67,21 @@ class FlowRunListCommand extends PowerAutomateCommand {
|
|
|
63
67
|
}
|
|
64
68
|
return filters;
|
|
65
69
|
}
|
|
70
|
+
async retrieveTriggerInformation(items) {
|
|
71
|
+
const tasks = items.map(async (item) => {
|
|
72
|
+
const requestOptions = {
|
|
73
|
+
url: item.properties.trigger.outputsLink.uri,
|
|
74
|
+
headers: {
|
|
75
|
+
accept: 'application/json',
|
|
76
|
+
'x-anonymous': true
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
const response = await request.get(requestOptions);
|
|
81
|
+
item.triggerInformation = response.body;
|
|
82
|
+
});
|
|
83
|
+
await Promise.all(tasks);
|
|
84
|
+
}
|
|
66
85
|
}
|
|
67
86
|
_FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry = function _FlowRunListCommand_initTelemetry() {
|
|
68
87
|
this.telemetry.push((args) => {
|
|
@@ -70,6 +89,7 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
70
89
|
status: typeof args.options.status !== 'undefined',
|
|
71
90
|
triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
|
|
72
91
|
triggerEndTime: typeof args.options.triggerEndTime !== 'undefined',
|
|
92
|
+
withTrigger: !!args.options.withTrigger,
|
|
73
93
|
asAdmin: !!args.options.asAdmin
|
|
74
94
|
});
|
|
75
95
|
});
|
|
@@ -85,6 +105,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
85
105
|
option: '--triggerStartTime [triggerStartTime]'
|
|
86
106
|
}, {
|
|
87
107
|
option: '--triggerEndTime [triggerEndTime]'
|
|
108
|
+
}, {
|
|
109
|
+
option: '--withTrigger'
|
|
88
110
|
}, {
|
|
89
111
|
option: '--asAdmin'
|
|
90
112
|
});
|
|
@@ -102,6 +124,9 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
102
124
|
if (args.options.triggerEndTime && !validation.isValidISODateTime(args.options.triggerEndTime)) {
|
|
103
125
|
return `'${args.options.triggerEndTime}' is not a valid datetime.`;
|
|
104
126
|
}
|
|
127
|
+
if (args.options.output !== 'json' && args.options.withTrigger) {
|
|
128
|
+
return 'The --withTrigger option is only available when output is set to json';
|
|
129
|
+
}
|
|
105
130
|
return true;
|
|
106
131
|
});
|
|
107
132
|
};
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoSiteAddCommand_instances, _SpoSiteAddCommand_initTelemetry, _SpoSiteAddCommand_initOptions, _SpoSiteAddCommand_initValidators;
|
|
7
|
+
import { setTimeout } from 'timers/promises';
|
|
7
8
|
import config from '../../../../config.js';
|
|
8
9
|
import request from '../../../../request.js';
|
|
9
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -198,19 +199,14 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
198
199
|
if ((!args.options.wait && !args.options.withAppCatalog) || isComplete) {
|
|
199
200
|
return args.options.url;
|
|
200
201
|
}
|
|
201
|
-
await
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
currentContext: this.context,
|
|
210
|
-
verbose: this.verbose,
|
|
211
|
-
debug: this.debug
|
|
212
|
-
});
|
|
213
|
-
}, operation.PollingInterval);
|
|
202
|
+
await setTimeout(operation.PollingInterval);
|
|
203
|
+
await spo.waitUntilFinished({
|
|
204
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
205
|
+
siteUrl: this.spoAdminUrl,
|
|
206
|
+
logger,
|
|
207
|
+
currentContext: this.context,
|
|
208
|
+
verbose: this.verbose,
|
|
209
|
+
debug: this.debug
|
|
214
210
|
});
|
|
215
211
|
return args.options.url;
|
|
216
212
|
}
|
|
@@ -291,19 +287,14 @@ class SpoSiteAddCommand extends SpoCommand {
|
|
|
291
287
|
if (!wait || isComplete) {
|
|
292
288
|
return;
|
|
293
289
|
}
|
|
294
|
-
await
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
currentContext: this.context,
|
|
303
|
-
verbose: this.verbose,
|
|
304
|
-
debug: this.debug
|
|
305
|
-
});
|
|
306
|
-
}, operation.PollingInterval);
|
|
290
|
+
await setTimeout(operation.PollingInterval);
|
|
291
|
+
await spo.waitUntilFinished({
|
|
292
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
293
|
+
siteUrl: this.spoAdminUrl,
|
|
294
|
+
logger,
|
|
295
|
+
currentContext: this.context,
|
|
296
|
+
verbose: this.verbose,
|
|
297
|
+
debug: this.debug
|
|
307
298
|
});
|
|
308
299
|
}
|
|
309
300
|
async addAppCatalog(url, logger) {
|
|
@@ -14,6 +14,7 @@ import { spo } from '../../../../utils/spo.js';
|
|
|
14
14
|
import { validation } from '../../../../utils/validation.js';
|
|
15
15
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
16
16
|
import commands from '../../commands.js';
|
|
17
|
+
import { setTimeout } from 'timers/promises';
|
|
17
18
|
class SpoSiteRemoveCommand extends SpoCommand {
|
|
18
19
|
get name() {
|
|
19
20
|
return commands.SITE_REMOVE;
|
|
@@ -153,19 +154,14 @@ class SpoSiteRemoveCommand extends SpoCommand {
|
|
|
153
154
|
if (!wait || isComplete) {
|
|
154
155
|
return;
|
|
155
156
|
}
|
|
156
|
-
await
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
currentContext: this.context,
|
|
165
|
-
debug: this.debug,
|
|
166
|
-
verbose: this.verbose
|
|
167
|
-
});
|
|
168
|
-
}, operation.PollingInterval);
|
|
157
|
+
await setTimeout(operation.PollingInterval);
|
|
158
|
+
await spo.waitUntilFinished({
|
|
159
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
160
|
+
siteUrl: this.spoAdminUrl,
|
|
161
|
+
logger,
|
|
162
|
+
currentContext: this.context,
|
|
163
|
+
debug: this.debug,
|
|
164
|
+
verbose: this.verbose
|
|
169
165
|
});
|
|
170
166
|
}
|
|
171
167
|
async deleteSiteFromTheRecycleBin(url, wait, logger) {
|
|
@@ -188,19 +184,14 @@ class SpoSiteRemoveCommand extends SpoCommand {
|
|
|
188
184
|
if (!wait || isComplete) {
|
|
189
185
|
return;
|
|
190
186
|
}
|
|
191
|
-
await
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
currentContext: this.context,
|
|
200
|
-
debug: this.debug,
|
|
201
|
-
verbose: this.verbose
|
|
202
|
-
});
|
|
203
|
-
}, operation.PollingInterval);
|
|
187
|
+
await setTimeout(operation.PollingInterval);
|
|
188
|
+
await spo.waitUntilFinished({
|
|
189
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
190
|
+
siteUrl: this.spoAdminUrl,
|
|
191
|
+
logger,
|
|
192
|
+
currentContext: this.context,
|
|
193
|
+
debug: this.debug,
|
|
194
|
+
verbose: this.verbose
|
|
204
195
|
});
|
|
205
196
|
}
|
|
206
197
|
async getSiteGroupId(url, logger) {
|
|
@@ -18,6 +18,7 @@ import commands from '../../commands.js';
|
|
|
18
18
|
import { SharingCapabilities } from '../site/SharingCapabilities.js';
|
|
19
19
|
import spoSiteDesignApplyCommand from '../sitedesign/sitedesign-apply.js';
|
|
20
20
|
import { FlowsPolicy } from './FlowsPolicy.js';
|
|
21
|
+
import { setTimeout } from 'timers/promises';
|
|
21
22
|
class SpoSiteSetCommand extends SpoCommand {
|
|
22
23
|
get name() {
|
|
23
24
|
return commands.SITE_SET;
|
|
@@ -128,19 +129,14 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
128
129
|
if (!args.options.wait || isComplete) {
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
await
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
currentContext: this.context,
|
|
140
|
-
debug: this.debug,
|
|
141
|
-
verbose: this.verbose
|
|
142
|
-
});
|
|
143
|
-
}, operation.PollingInterval);
|
|
132
|
+
await setTimeout(operation.PollingInterval);
|
|
133
|
+
await spo.waitUntilFinished({
|
|
134
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
135
|
+
siteUrl: this.spoAdminUrl,
|
|
136
|
+
logger,
|
|
137
|
+
currentContext: this.context,
|
|
138
|
+
debug: this.debug,
|
|
139
|
+
verbose: this.verbose
|
|
144
140
|
});
|
|
145
141
|
}
|
|
146
142
|
async updateSiteOwners(logger, args) {
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoTenantRecycleBinItemRemoveCommand_instances, _SpoTenantRecycleBinItemRemoveCommand_initTelemetry, _SpoTenantRecycleBinItemRemoveCommand_initOptions, _SpoTenantRecycleBinItemRemoveCommand_initValidators;
|
|
7
|
+
import { setTimeout } from 'timers/promises';
|
|
7
8
|
import { cli } from '../../../../cli/cli.js';
|
|
8
9
|
import config from '../../../../config.js';
|
|
9
10
|
import request from '../../../../request.js';
|
|
@@ -62,19 +63,14 @@ class SpoTenantRecycleBinItemRemoveCommand extends SpoCommand {
|
|
|
62
63
|
if (!args.options.wait || isComplete) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
|
-
await
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
currentContext: this.context,
|
|
74
|
-
debug: this.debug,
|
|
75
|
-
verbose: this.verbose
|
|
76
|
-
});
|
|
77
|
-
}, operation.PollingInterval);
|
|
66
|
+
await setTimeout(operation.PollingInterval);
|
|
67
|
+
await spo.waitUntilFinished({
|
|
68
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
69
|
+
siteUrl: spoAdminUrl,
|
|
70
|
+
logger,
|
|
71
|
+
currentContext: this.context,
|
|
72
|
+
debug: this.debug,
|
|
73
|
+
verbose: this.verbose
|
|
78
74
|
});
|
|
79
75
|
}
|
|
80
76
|
catch (err) {
|
package/dist/settingsNames.js
CHANGED