@pnp/cli-microsoft365 6.9.0-beta.d8f8efb → 6.9.0-beta.ef7c408
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/.devcontainer/Dockerfile +12 -19
- package/.devcontainer/devcontainer.json +24 -17
- package/Dockerfile +3 -1
- package/dist/Auth.js +2 -8
- package/dist/AuthServer.js +2 -4
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +23 -24
- package/dist/m365/aad/commands/o365group/o365group-set.js +15 -20
- package/dist/m365/aad/commands/sp/sp-list.js +78 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/app/commands/app-open.js +4 -14
- package/dist/m365/cli/commands/cli-issue.js +4 -10
- package/dist/m365/cli/commands/cli-reconsent.js +2 -8
- package/dist/m365/commands/docs.js +2 -8
- package/dist/m365/commands/setupPresets.js +2 -0
- package/dist/m365/flow/commands/flow-list.js +30 -12
- package/dist/m365/flow/commands/flow-remove.js +2 -3
- package/dist/m365/flow/commands/run/run-resubmit.js +11 -10
- package/dist/m365/outlook/commands/message/message-list.js +18 -23
- package/dist/m365/outlook/commands/message/message-move.js +15 -20
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +19 -20
- package/dist/m365/spo/commands/file/file-checkout-undo.js +119 -0
- package/dist/m365/spo/commands/list/list-add.js +1 -1
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -7
- package/dist/utils/browserUtil.js +23 -0
- package/docs/docs/cmd/aad/sp/sp-list.mdx +162 -0
- package/docs/docs/cmd/flow/flow-list.mdx +15 -0
- package/docs/docs/cmd/setup.mdx +2 -0
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +55 -0
- package/docs/docs/cmd/util/accesstoken/accesstoken-get.mdx +12 -2
- package/npm-shrinkwrap.json +299 -272
- package/package.json +17 -17
package/.devcontainer/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM mcr.microsoft.com/powershell:
|
|
1
|
+
FROM mcr.microsoft.com/powershell:alpine-3.17
|
|
2
2
|
|
|
3
3
|
LABEL name="CLI for Microsoft 365 Development" \
|
|
4
4
|
description="Development container for contributing to CLI for Microsoft 365" \
|
|
@@ -17,22 +17,15 @@ LABEL name="CLI for Microsoft 365 Development" \
|
|
|
17
17
|
ENV NPM_CONFIG_PREFIX=/home/cli-microsoft365-dev/.npm-global \
|
|
18
18
|
PATH=$PATH:/home/cli-microsoft365-dev/.npm-global/bin
|
|
19
19
|
|
|
20
|
-
RUN
|
|
20
|
+
RUN apk add --no-cache \
|
|
21
21
|
git \
|
|
22
22
|
curl \
|
|
23
23
|
sudo \
|
|
24
|
+
shadow \
|
|
24
25
|
zsh \
|
|
25
26
|
jq \
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
python3-pip \
|
|
29
|
-
&& curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - \
|
|
30
|
-
&& apt-get install nodejs -y \
|
|
31
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
32
|
-
|
|
33
|
-
COPY ../docs/pip_requirements.txt .
|
|
34
|
-
|
|
35
|
-
RUN pip install -r pip_requirements.txt
|
|
27
|
+
nodejs \
|
|
28
|
+
npm
|
|
36
29
|
|
|
37
30
|
RUN useradd \
|
|
38
31
|
--user-group \
|
|
@@ -45,15 +38,15 @@ USER cli-microsoft365-dev
|
|
|
45
38
|
|
|
46
39
|
WORKDIR /home/cli-microsoft365
|
|
47
40
|
|
|
48
|
-
RUN
|
|
49
|
-
&&
|
|
50
|
-
&&
|
|
51
|
-
&&
|
|
52
|
-
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting \
|
|
53
|
-
&& git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions \
|
|
41
|
+
RUN git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh \
|
|
42
|
+
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
|
|
43
|
+
&& git clone https://github.com/denysdovhan/spaceship-prompt.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt --depth=1 \
|
|
44
|
+
&& ln -s ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt/spaceship.zsh-theme ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship.zsh-theme \
|
|
54
45
|
&& sed -i "11s/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"spaceship\"/" ~/.zshrc \
|
|
55
|
-
&&
|
|
46
|
+
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
|
|
47
|
+
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
|
|
56
48
|
&& sed -i "73s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/" ~/.zshrc \
|
|
49
|
+
&& sed -i "27s/# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/" ~/.zshrc \
|
|
57
50
|
&& sed -i "50s/# COMPLETION_WAITING_DOTS/COMPLETION_WAITING_DOTS/" ~/.zshrc
|
|
58
51
|
|
|
59
52
|
CMD [ "/bin/zsh", "-l" ]
|
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
"name": "CLI for Microsoft 365",
|
|
3
3
|
"dockerFile": "Dockerfile",
|
|
4
4
|
"context": "..",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"path": "/bin/zsh",
|
|
9
|
-
"args": [
|
|
10
|
-
"-l"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"terminal.integrated.defaultProfile.linux": "zsh"
|
|
5
|
+
"postCreateCommand": {
|
|
6
|
+
"cli": "npm i && npm run clean && npm run build && npm link",
|
|
7
|
+
"docs": "cd docs && npm i"
|
|
15
8
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
"customizations": {
|
|
10
|
+
"vscode": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
"dbaeumer.vscode-eslint",
|
|
13
|
+
"hbenl.vscode-test-explorer",
|
|
14
|
+
"hbenl.vscode-mocha-test-adapter",
|
|
15
|
+
"eamodio.gitlens"
|
|
16
|
+
],
|
|
17
|
+
"settings": {
|
|
18
|
+
"terminal.integrated.profiles.linux": {
|
|
19
|
+
"zsh": {
|
|
20
|
+
"path": "/bin/zsh",
|
|
21
|
+
"args": [
|
|
22
|
+
"-l"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"terminal.integrated.defaultProfile.linux": "zsh"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
23
30
|
}
|
package/Dockerfile
CHANGED
|
@@ -43,10 +43,12 @@ RUN bash -c 'echo "export PATH=$PATH:/home/cli-microsoft365/.npm-global/bin:/hom
|
|
|
43
43
|
&& bash -c 'echo "export CLIMICROSOFT365_ENV=\"docker\"" >> ~/.bash_profile' \
|
|
44
44
|
&& bash -c 'npm i -g @pnp/cli-microsoft365@${CLI_VERSION} --production --quiet --no-progress' \
|
|
45
45
|
&& bash -c 'echo "source /etc/profile.d/bash_completion.sh" >> ~/.bash_profile' \
|
|
46
|
+
&& bash -c 'echo "alias \"m365?\"=\"m365_chili\"" >> ~/.bash_profile' \
|
|
46
47
|
&& bash -c 'echo ". .bashrc" >> ~/.bash_profile' \
|
|
47
48
|
&& bash -c 'npm cache clean --force' \
|
|
48
49
|
&& bash -c 'm365 cli completion sh setup' \
|
|
49
|
-
&& pwsh -c 'm365 cli completion pwsh setup --profile $profile'
|
|
50
|
+
&& pwsh -c 'm365 cli completion pwsh setup --profile $profile' \
|
|
51
|
+
&& pwsh -c 'Add-Content -Path $PROFILE -Value "`r`Set-Alias -Name m365? -Value m365_chili"'
|
|
50
52
|
|
|
51
53
|
RUN pip install setuptools==58
|
|
52
54
|
RUN pip install jmespath-terminal
|
package/dist/Auth.js
CHANGED
|
@@ -18,6 +18,7 @@ const Command_1 = require("./Command");
|
|
|
18
18
|
const config_1 = require("./config");
|
|
19
19
|
const request_1 = require("./request");
|
|
20
20
|
const settingsNames_1 = require("./settingsNames");
|
|
21
|
+
const browserUtil_1 = require("./utils/browserUtil");
|
|
21
22
|
var CloudType;
|
|
22
23
|
(function (CloudType) {
|
|
23
24
|
CloudType[CloudType["Public"] = 0] = "Public";
|
|
@@ -361,14 +362,7 @@ class Auth {
|
|
|
361
362
|
}
|
|
362
363
|
logger.log(response.message);
|
|
363
364
|
if (Cli_1.Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.autoOpenLinksInBrowser, false)) {
|
|
364
|
-
|
|
365
|
-
// is implemented so that we can support lazy loading
|
|
366
|
-
// but also stub it for testing
|
|
367
|
-
/* c8 ignore next 3 */
|
|
368
|
-
if (!this._open) {
|
|
369
|
-
this._open = require('open');
|
|
370
|
-
}
|
|
371
|
-
this._open(response.verificationUri);
|
|
365
|
+
browserUtil_1.browserUtil.open(response.verificationUri);
|
|
372
366
|
}
|
|
373
367
|
if (Cli_1.Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.copyDeviceCodeToClipboard, false)) {
|
|
374
368
|
// _clipboardy is never set before hitting this line, but this check
|
package/dist/AuthServer.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthServer = void 0;
|
|
4
4
|
const http = require("http");
|
|
5
|
-
const open = require("open");
|
|
6
5
|
const url = require("url");
|
|
7
6
|
const Auth_1 = require("./Auth");
|
|
7
|
+
const browserUtil_1 = require("./utils/browserUtil");
|
|
8
8
|
class AuthServer {
|
|
9
9
|
constructor() {
|
|
10
|
-
this.open = open;
|
|
11
10
|
this.debug = false;
|
|
12
11
|
this.resource = "";
|
|
13
12
|
this.generatedServerUrl = "";
|
|
@@ -85,8 +84,7 @@ class AuthServer {
|
|
|
85
84
|
return this.httpServer;
|
|
86
85
|
}
|
|
87
86
|
openUrl(url) {
|
|
88
|
-
|
|
89
|
-
.open(url)
|
|
87
|
+
browserUtil_1.browserUtil.open(url)
|
|
90
88
|
.then(_ => {
|
|
91
89
|
this.logger.logToStderr("To sign in, use the web browser that just has been opened. Please sign-in there.");
|
|
92
90
|
})
|
|
@@ -58,35 +58,34 @@ class AadO365GroupRecycleBinItemRestoreCommand extends GraphCommand_1.default {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
getGroupId(options) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.get(requestOptions)
|
|
81
|
-
.then((response) => {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const { id, displayName, mailNickname } = options;
|
|
63
|
+
if (id) {
|
|
64
|
+
return id;
|
|
65
|
+
}
|
|
66
|
+
let filterValue = '';
|
|
67
|
+
if (displayName) {
|
|
68
|
+
filterValue = `displayName eq '${formatting_1.formatting.encodeQueryParameter(displayName)}'`;
|
|
69
|
+
}
|
|
70
|
+
if (mailNickname) {
|
|
71
|
+
filterValue = `mailNickname eq '${formatting_1.formatting.encodeQueryParameter(mailNickname)}'`;
|
|
72
|
+
}
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
url: `${this.resource}/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=${filterValue}`,
|
|
75
|
+
headers: {
|
|
76
|
+
accept: 'application/json;odata.metadata=none'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
const response = yield request_1.default.get(requestOptions);
|
|
82
81
|
const groups = response.value;
|
|
83
82
|
if (groups.length === 0) {
|
|
84
|
-
|
|
83
|
+
throw `The specified group '${displayName || mailNickname}' does not exist.`;
|
|
85
84
|
}
|
|
86
85
|
if (groups.length > 1) {
|
|
87
|
-
|
|
86
|
+
throw `Multiple groups with name '${displayName || mailNickname}' found: ${groups.map(x => x.id).join(',')}.`;
|
|
88
87
|
}
|
|
89
|
-
return
|
|
88
|
+
return groups[0].id;
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -21,6 +21,7 @@ const request_1 = require("../../../../request");
|
|
|
21
21
|
const validation_1 = require("../../../../utils/validation");
|
|
22
22
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
23
23
|
const commands_1 = require("../../commands");
|
|
24
|
+
const promises_1 = require("timers/promises");
|
|
24
25
|
class AadO365GroupSetCommand extends GraphCommand_1.default {
|
|
25
26
|
get name() {
|
|
26
27
|
return commands_1.default.O365GROUP_SET;
|
|
@@ -31,6 +32,7 @@ class AadO365GroupSetCommand extends GraphCommand_1.default {
|
|
|
31
32
|
constructor() {
|
|
32
33
|
super();
|
|
33
34
|
_AadO365GroupSetCommand_instances.add(this);
|
|
35
|
+
this.pollingInterval = 500;
|
|
34
36
|
__classPrivateFieldGet(this, _AadO365GroupSetCommand_instances, "m", _AadO365GroupSetCommand_initTelemetry).call(this);
|
|
35
37
|
__classPrivateFieldGet(this, _AadO365GroupSetCommand_instances, "m", _AadO365GroupSetCommand_initOptions).call(this);
|
|
36
38
|
__classPrivateFieldGet(this, _AadO365GroupSetCommand_instances, "m", _AadO365GroupSetCommand_initTypes).call(this);
|
|
@@ -75,9 +77,7 @@ class AadO365GroupSetCommand extends GraphCommand_1.default {
|
|
|
75
77
|
},
|
|
76
78
|
data: fs.readFileSync(fullPath)
|
|
77
79
|
};
|
|
78
|
-
yield
|
|
79
|
-
this.setGroupLogo(requestOptions, AadO365GroupSetCommand.numRepeat, resolve, reject, logger);
|
|
80
|
-
});
|
|
80
|
+
yield this.setGroupLogo(requestOptions, AadO365GroupSetCommand.numRepeat, logger);
|
|
81
81
|
}
|
|
82
82
|
else if (this.debug) {
|
|
83
83
|
logger.logToStderr('logoPath not set. Skipping');
|
|
@@ -142,24 +142,19 @@ class AadO365GroupSetCommand extends GraphCommand_1.default {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
-
setGroupLogo(requestOptions, retryLeft,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (this.debug) {
|
|
150
|
-
logger.logToStderr('Response:');
|
|
151
|
-
logger.logToStderr(res);
|
|
152
|
-
logger.logToStderr('');
|
|
153
|
-
}
|
|
154
|
-
resolve();
|
|
155
|
-
}, (err) => {
|
|
156
|
-
if (--retryLeft > 0) {
|
|
157
|
-
setTimeout(() => {
|
|
158
|
-
this.setGroupLogo(requestOptions, retryLeft, resolve, reject, logger);
|
|
159
|
-
}, 500 * (AadO365GroupSetCommand.numRepeat - retryLeft));
|
|
145
|
+
setGroupLogo(requestOptions, retryLeft, logger) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
try {
|
|
148
|
+
yield request_1.default.put(requestOptions);
|
|
160
149
|
}
|
|
161
|
-
|
|
162
|
-
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (--retryLeft > 0) {
|
|
152
|
+
yield (0, promises_1.setTimeout)(this.pollingInterval * (AadO365GroupSetCommand.numRepeat - retryLeft));
|
|
153
|
+
yield this.setGroupLogo(requestOptions, retryLeft, logger);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
163
158
|
}
|
|
164
159
|
});
|
|
165
160
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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 _AadSpListCommand_instances, _AadSpListCommand_initTelemetry, _AadSpListCommand_initOptions;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const odata_1 = require("../../../../utils/odata");
|
|
19
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
class AadSpListCommand extends GraphCommand_1.default {
|
|
22
|
+
get name() {
|
|
23
|
+
return commands_1.default.SP_LIST;
|
|
24
|
+
}
|
|
25
|
+
defaultProperties() {
|
|
26
|
+
return ['appId', 'displayName', 'tag'];
|
|
27
|
+
}
|
|
28
|
+
get description() {
|
|
29
|
+
return 'Lists the service principals in the directory';
|
|
30
|
+
}
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
_AadSpListCommand_instances.add(this);
|
|
34
|
+
__classPrivateFieldGet(this, _AadSpListCommand_instances, "m", _AadSpListCommand_initTelemetry).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _AadSpListCommand_instances, "m", _AadSpListCommand_initOptions).call(this);
|
|
36
|
+
}
|
|
37
|
+
commandAction(logger, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (this.verbose) {
|
|
40
|
+
logger.logToStderr(`Retrieving service principal information...`);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
let requestUrl = `${this.resource}/v1.0/servicePrincipals`;
|
|
44
|
+
const filter = [];
|
|
45
|
+
if (args.options.tag) {
|
|
46
|
+
filter.push(`(tags/any(t:t eq '${args.options.tag}'))`);
|
|
47
|
+
}
|
|
48
|
+
if (args.options.displayName) {
|
|
49
|
+
filter.push(`(displayName eq '${args.options.displayName}')`);
|
|
50
|
+
}
|
|
51
|
+
if (filter.length > 0) {
|
|
52
|
+
requestUrl += `?$filter=${filter.join(' and ')}`;
|
|
53
|
+
}
|
|
54
|
+
const res = yield odata_1.odata.getAllItems(requestUrl);
|
|
55
|
+
logger.log(res);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
this.handleRejectedODataJsonPromise(err);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
_AadSpListCommand_instances = new WeakSet(), _AadSpListCommand_initTelemetry = function _AadSpListCommand_initTelemetry() {
|
|
64
|
+
this.telemetry.push((args) => {
|
|
65
|
+
Object.assign(this.telemetryProperties, {
|
|
66
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
67
|
+
tag: typeof args.options.tag !== 'undefined'
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}, _AadSpListCommand_initOptions = function _AadSpListCommand_initOptions() {
|
|
71
|
+
this.options.unshift({
|
|
72
|
+
option: '--displayName [displayName]'
|
|
73
|
+
}, {
|
|
74
|
+
option: '--tag [tag]'
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
module.exports = new AadSpListCommand();
|
|
78
|
+
//# sourceMappingURL=sp-list.js.map
|
|
@@ -56,6 +56,7 @@ exports.default = {
|
|
|
56
56
|
SITECLASSIFICATION_SET: `${prefix} siteclassification set`,
|
|
57
57
|
SP_ADD: `${prefix} sp add`,
|
|
58
58
|
SP_GET: `${prefix} sp get`,
|
|
59
|
+
SP_LIST: `${prefix} sp list`,
|
|
59
60
|
USER_ADD: `${prefix} user add`,
|
|
60
61
|
USER_GET: `${prefix} user get`,
|
|
61
62
|
USER_GUEST_ADD: `${prefix} user guest add`,
|
|
@@ -17,6 +17,7 @@ var _AppOpenCommand_instances, _AppOpenCommand_initTelemetry, _AppOpenCommand_in
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const Cli_1 = require("../../../cli/Cli");
|
|
19
19
|
const settingsNames_1 = require("../../../settingsNames");
|
|
20
|
+
const browserUtil_1 = require("../../../utils/browserUtil");
|
|
20
21
|
const AppCommand_1 = require("../../base/AppCommand");
|
|
21
22
|
const commands_1 = require("../commands");
|
|
22
23
|
class AppOpenCommand extends AppCommand_1.default {
|
|
@@ -43,26 +44,15 @@ class AppOpenCommand extends AppCommand_1.default {
|
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
logOrOpenUrl(args, logger) {
|
|
46
|
-
return
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
48
|
const previewPrefix = args.options.preview === true ? "preview." : "";
|
|
48
49
|
const url = `https://${previewPrefix}portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/appId/${this.appId}/isMSAApp/`;
|
|
49
50
|
if (Cli_1.Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.autoOpenLinksInBrowser, false) === false) {
|
|
50
51
|
logger.log(`Use a web browser to open the page ${url}`);
|
|
51
|
-
return
|
|
52
|
+
return;
|
|
52
53
|
}
|
|
53
54
|
logger.log(`Opening the following page in your browser: ${url}`);
|
|
54
|
-
|
|
55
|
-
// _open is never set before hitting this line, but this check
|
|
56
|
-
// is implemented so that we can stub it when testing.
|
|
57
|
-
/* c8 ignore next 3 */
|
|
58
|
-
if (!this._open) {
|
|
59
|
-
this._open = require('open');
|
|
60
|
-
}
|
|
61
|
-
this._open(url).then(() => {
|
|
62
|
-
resolve();
|
|
63
|
-
}, (error) => {
|
|
64
|
-
reject(error);
|
|
65
|
-
});
|
|
55
|
+
yield browserUtil_1.browserUtil.open(url);
|
|
66
56
|
});
|
|
67
57
|
}
|
|
68
58
|
}
|
|
@@ -15,9 +15,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _CliIssueCommand_instances, _CliIssueCommand_initTelemetry, _CliIssueCommand_initOptions, _CliIssueCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const open = require("open");
|
|
19
18
|
const AnonymousCommand_1 = require("../../base/AnonymousCommand");
|
|
20
19
|
const commands_1 = require("../commands");
|
|
20
|
+
const browserUtil_1 = require("../../../utils/browserUtil");
|
|
21
21
|
class CliIssueCommand extends AnonymousCommand_1.default {
|
|
22
22
|
get name() {
|
|
23
23
|
return commands_1.default.ISSUE;
|
|
@@ -25,9 +25,8 @@ class CliIssueCommand extends AnonymousCommand_1.default {
|
|
|
25
25
|
get description() {
|
|
26
26
|
return 'Returns, or opens a URL that takes the user to the right place in the CLI GitHub repo to create a new issue reporting bug, feedback, ideas, etc.';
|
|
27
27
|
}
|
|
28
|
-
constructor(
|
|
28
|
+
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
this.open = open;
|
|
31
30
|
_CliIssueCommand_instances.add(this);
|
|
32
31
|
__classPrivateFieldGet(this, _CliIssueCommand_instances, "m", _CliIssueCommand_initTelemetry).call(this);
|
|
33
32
|
__classPrivateFieldGet(this, _CliIssueCommand_instances, "m", _CliIssueCommand_initOptions).call(this);
|
|
@@ -47,15 +46,10 @@ class CliIssueCommand extends AnonymousCommand_1.default {
|
|
|
47
46
|
issueLink = 'https://aka.ms/cli-m365/new-sample-script';
|
|
48
47
|
break;
|
|
49
48
|
}
|
|
50
|
-
yield
|
|
49
|
+
yield browserUtil_1.browserUtil.open(issueLink);
|
|
51
50
|
logger.log(issueLink);
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
openBrowser(issueLink) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
return this.open(issueLink, { wait: false });
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
53
|
}
|
|
60
54
|
_CliIssueCommand_instances = new WeakSet(), _CliIssueCommand_initTelemetry = function _CliIssueCommand_initTelemetry() {
|
|
61
55
|
this.telemetry.push((args) => {
|
|
@@ -81,5 +75,5 @@ CliIssueCommand.issueType = [
|
|
|
81
75
|
'command',
|
|
82
76
|
'sample'
|
|
83
77
|
];
|
|
84
|
-
module.exports = new CliIssueCommand(
|
|
78
|
+
module.exports = new CliIssueCommand();
|
|
85
79
|
//# sourceMappingURL=cli-issue.js.map
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const Cli_1 = require("../../../cli/Cli");
|
|
13
13
|
const config_1 = require("../../../config");
|
|
14
14
|
const settingsNames_1 = require("../../../settingsNames");
|
|
15
|
+
const browserUtil_1 = require("../../../utils/browserUtil");
|
|
15
16
|
const AnonymousCommand_1 = require("../../base/AnonymousCommand");
|
|
16
17
|
const commands_1 = require("../commands");
|
|
17
18
|
class CliReconsentCommand extends AnonymousCommand_1.default {
|
|
@@ -29,15 +30,8 @@ class CliReconsentCommand extends AnonymousCommand_1.default {
|
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
logger.log(`Opening the following page in your browser: ${url}`);
|
|
32
|
-
// _open is never set before hitting this line, but this check
|
|
33
|
-
// is implemented so that we can support lazy loading
|
|
34
|
-
// but also stub it for testing
|
|
35
|
-
/* c8 ignore next 3 */
|
|
36
|
-
if (!this._open) {
|
|
37
|
-
this._open = require('open');
|
|
38
|
-
}
|
|
39
33
|
try {
|
|
40
|
-
yield
|
|
34
|
+
yield browserUtil_1.browserUtil.open(url);
|
|
41
35
|
}
|
|
42
36
|
catch (err) {
|
|
43
37
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -13,6 +13,7 @@ const AnonymousCommand_1 = require("../base/AnonymousCommand");
|
|
|
13
13
|
const Cli_1 = require("../../cli/Cli");
|
|
14
14
|
const commands_1 = require("./commands");
|
|
15
15
|
const settingsNames_1 = require("../../settingsNames");
|
|
16
|
+
const browserUtil_1 = require("../../utils/browserUtil");
|
|
16
17
|
const packageJSON = require('../../../package.json');
|
|
17
18
|
class DocsCommand extends AnonymousCommand_1.default {
|
|
18
19
|
get name() {
|
|
@@ -27,14 +28,7 @@ class DocsCommand extends AnonymousCommand_1.default {
|
|
|
27
28
|
if (Cli_1.Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.autoOpenLinksInBrowser, false) === false) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
// is implemented so that we can support lazy loading
|
|
32
|
-
// but also stub it for testing
|
|
33
|
-
/* c8 ignore next 3 */
|
|
34
|
-
if (!this._open) {
|
|
35
|
-
this._open = require('open');
|
|
36
|
-
}
|
|
37
|
-
yield this._open(packageJSON.homepage);
|
|
31
|
+
yield browserUtil_1.browserUtil.open(packageJSON.homepage);
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
34
|
}
|
|
@@ -4,6 +4,7 @@ exports.powerShellPreset = exports.scriptingPreset = exports.interactivePreset =
|
|
|
4
4
|
exports.interactivePreset = {
|
|
5
5
|
autoOpenLinksInBrowser: true,
|
|
6
6
|
copyDeviceCodeToClipboard: true,
|
|
7
|
+
interactive: true,
|
|
7
8
|
output: 'text',
|
|
8
9
|
printErrorsAsPlainText: true,
|
|
9
10
|
prompt: true,
|
|
@@ -13,6 +14,7 @@ exports.interactivePreset = {
|
|
|
13
14
|
exports.scriptingPreset = {
|
|
14
15
|
autoOpenLinksInBrowser: false,
|
|
15
16
|
copyDeviceCodeToClipboard: false,
|
|
17
|
+
interactive: false,
|
|
16
18
|
output: 'json',
|
|
17
19
|
printErrorsAsPlainText: false,
|
|
18
20
|
prompt: false,
|
|
@@ -38,21 +38,28 @@ class FlowListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
|
|
|
38
38
|
}
|
|
39
39
|
commandAction(logger, args) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const url = `${this.resource}providers/Microsoft.ProcessSimple${args.options.asAdmin ? '/scopes/admin' : ''}/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows?api-version=2016-11-01`;
|
|
42
41
|
try {
|
|
43
|
-
|
|
42
|
+
const { environmentName, asAdmin, sharingStatus, includeSolutions } = args.options;
|
|
43
|
+
if (sharingStatus === 'personal') {
|
|
44
|
+
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
|
|
44
45
|
yield this.getAllItems(url, logger, true);
|
|
45
46
|
}
|
|
46
|
-
else if (
|
|
47
|
-
|
|
47
|
+
else if (sharingStatus === 'sharedWithMe') {
|
|
48
|
+
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
|
|
49
|
+
yield this.getAllItems(url, logger, true);
|
|
48
50
|
}
|
|
49
|
-
else if (
|
|
50
|
-
|
|
51
|
+
else if (sharingStatus === 'all') {
|
|
52
|
+
let url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
|
|
53
|
+
yield this.getAllItems(url, logger, true);
|
|
54
|
+
url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
|
|
55
|
+
yield this.getAllItems(url, logger, false);
|
|
51
56
|
}
|
|
52
57
|
else {
|
|
53
|
-
|
|
54
|
-
yield this.
|
|
58
|
+
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions);
|
|
59
|
+
yield this.getAllItems(url, logger, true);
|
|
55
60
|
}
|
|
61
|
+
// Remove duplicates
|
|
62
|
+
this.items = this.items.filter((flow, index, self) => index === self.findIndex(f => f.id === flow.id));
|
|
56
63
|
if (this.items.length > 0) {
|
|
57
64
|
this.items.forEach(i => {
|
|
58
65
|
i.displayName = i.properties.displayName;
|
|
@@ -70,16 +77,25 @@ class FlowListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
|
|
|
70
77
|
}
|
|
71
78
|
});
|
|
72
79
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
getApiUrl(environmentName, asAdmin, includeSolutionFlows, filter) {
|
|
81
|
+
let url = `${this.resource}providers/Microsoft.ProcessSimple${asAdmin ? '/scopes/admin' : ''}/environments/${formatting_1.formatting.encodeQueryParameter(environmentName)}/flows?api-version=2016-11-01`;
|
|
82
|
+
if (filter === 'personal') {
|
|
83
|
+
url += `&$filter=search('personal')`;
|
|
84
|
+
}
|
|
85
|
+
else if (filter === 'team') {
|
|
86
|
+
url += `&$filter=search('team')`;
|
|
87
|
+
}
|
|
88
|
+
if (includeSolutionFlows) {
|
|
89
|
+
url += '&include=includeSolutionCloudFlows';
|
|
90
|
+
}
|
|
91
|
+
return url;
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
94
|
_FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = function _FlowListCommand_initTelemetry() {
|
|
80
95
|
this.telemetry.push((args) => {
|
|
81
96
|
Object.assign(this.telemetryProperties, {
|
|
82
97
|
sharingStatus: typeof args.options.sharingStatus !== 'undefined',
|
|
98
|
+
includeSolutions: !!args.options.includeSolutions,
|
|
83
99
|
asAdmin: !!args.options.asAdmin
|
|
84
100
|
});
|
|
85
101
|
});
|
|
@@ -89,6 +105,8 @@ _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = fun
|
|
|
89
105
|
}, {
|
|
90
106
|
option: '--sharingStatus [sharingStatus]',
|
|
91
107
|
autocomplete: this.allowedSharingStatuses
|
|
108
|
+
}, {
|
|
109
|
+
option: '--includeSolutions'
|
|
92
110
|
}, {
|
|
93
111
|
option: '--asAdmin'
|
|
94
112
|
});
|
|
@@ -15,7 +15,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _FlowRemoveCommand_instances, _FlowRemoveCommand_initTelemetry, _FlowRemoveCommand_initOptions, _FlowRemoveCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chalk = require("chalk");
|
|
19
18
|
const Cli_1 = require("../../../cli/Cli");
|
|
20
19
|
const request_1 = require("../../../request");
|
|
21
20
|
const formatting_1 = require("../../../utils/formatting");
|
|
@@ -44,7 +43,7 @@ class FlowRemoveCommand extends AzmgmtCommand_1.default {
|
|
|
44
43
|
const removeFlow = () => __awaiter(this, void 0, void 0, function* () {
|
|
45
44
|
const requestOptions = {
|
|
46
45
|
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
47
|
-
|
|
46
|
+
fullResponse: true,
|
|
48
47
|
headers: {
|
|
49
48
|
accept: 'application/json'
|
|
50
49
|
},
|
|
@@ -55,7 +54,7 @@ class FlowRemoveCommand extends AzmgmtCommand_1.default {
|
|
|
55
54
|
// handle 204 and throw error message to cmd when invalid flow id is passed
|
|
56
55
|
// https://github.com/pnp/cli-microsoft365/issues/1063#issuecomment-537218957
|
|
57
56
|
if (rawRes.statusCode === 204) {
|
|
58
|
-
|
|
57
|
+
throw `Error: Resource '${args.options.name}' does not exist in environment '${args.options.environmentName}'`;
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
catch (err) {
|