@pnp/cli-microsoft365 7.1.0-beta.d53f0d9 → 7.2.0-beta.0642f3a
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 +0 -1
- package/.eslintrc.cjs +4 -0
- package/Dockerfile +0 -1
- package/dist/Auth.js +1 -1
- package/dist/Command.js +18 -28
- package/dist/cli/Cli.js +6 -4
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-add.js +61 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-get.js +80 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-list.js +25 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-remove.js +96 -0
- package/dist/m365/aad/commands/group/group-user-list.js +146 -0
- package/dist/m365/aad/commands/m365group/m365group-remove.js +109 -15
- package/dist/m365/aad/commands.js +5 -0
- package/dist/m365/base/AppCommand.js +3 -12
- package/dist/m365/cli/commands/cli-doctor.js +11 -6
- package/dist/m365/commands/setup.js +6 -1
- package/dist/m365/{search/commands/externalconnection/externalconnection-add.js → external/commands/connection/connection-add.js} +16 -13
- package/dist/m365/{search/commands/externalconnection/externalconnection-get.js → external/commands/connection/connection-get.js} +16 -13
- package/dist/m365/{search/commands/externalconnection/externalconnection-list.js → external/commands/connection/connection-list.js} +7 -4
- package/dist/m365/{search/commands/externalconnection/externalconnection-remove.js → external/commands/connection/connection-remove.js} +17 -14
- package/dist/m365/{search/commands/externalconnection/externalconnection-schema-add.js → external/commands/connection/connection-schema-add.js} +14 -11
- package/dist/m365/external/commands.js +15 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1-rc.0.js +21 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014010_CODE_settings_filesexclude_jest.js +44 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.1-rc.0.js +57 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/site/site-set.js +33 -1
- package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +15 -14
- package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +22 -22
- package/dist/m365/teams/commands/app/app-update.js +9 -6
- package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +131 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +75 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +53 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +84 -0
- package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +118 -0
- package/dist/m365/tenant/commands/people/profileCardProperties.js +24 -0
- package/dist/m365/tenant/commands.js +5 -0
- package/dist/m365/todo/commands/task/task-list.js +8 -10
- package/dist/m365/todo/commands/task/task-remove.js +36 -36
- package/dist/m365/todo/commands/task/task-set.js +11 -13
- package/dist/m365/yammer/commands/group/group-user-remove.js +22 -23
- package/dist/utils/aadAdministrativeUnit.js +25 -0
- package/dist/utils/aadGroup.js +3 -1
- package/dist/utils/odata.js +20 -19
- package/dist/utils/prompt.js +16 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx +119 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-get.mdx +102 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-list.mdx +87 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-remove.mdx +56 -0
- package/docs/docs/cmd/aad/group/group-user-list.mdx +135 -0
- package/docs/docs/cmd/aad/m365group/m365group-remove.mdx +11 -1
- package/docs/docs/cmd/{search/externalconnection/externalconnection-add.mdx → external/connection/connection-add.mdx} +16 -10
- package/docs/docs/cmd/{search/externalconnection/externalconnection-get.mdx → external/connection/connection-get.mdx} +16 -11
- package/docs/docs/cmd/{search/externalconnection/externalconnection-list.mdx → external/connection/connection-list.mdx} +12 -7
- package/docs/docs/cmd/external/connection/connection-remove.mdx +54 -0
- package/docs/docs/cmd/external/connection/connection-schema-add.mdx +41 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/field/field-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-rename.mdx +2 -0
- package/docs/docs/cmd/spo/site/site-set.mdx +15 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +126 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +101 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +98 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +61 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +120 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +36 -18
- package/dist/m365/search/commands.js +0 -9
- package/docs/docs/cmd/search/externalconnection/externalconnection-remove.mdx +0 -48
- package/docs/docs/cmd/search/externalconnection/externalconnection-schema-add.mdx +0 -35
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
2
|
+
import commands from '../../commands.js';
|
|
3
|
+
import { odata } from '../../../../utils/odata.js';
|
|
4
|
+
class TenantPeopleProfileCardPropertyListCommand extends GraphCommand {
|
|
5
|
+
get name() {
|
|
6
|
+
return commands.PEOPLE_PROFILECARDPROPERTY_LIST;
|
|
7
|
+
}
|
|
8
|
+
get description() {
|
|
9
|
+
return 'Lists all profile card properties';
|
|
10
|
+
}
|
|
11
|
+
async commandAction(logger, args) {
|
|
12
|
+
try {
|
|
13
|
+
if (this.verbose) {
|
|
14
|
+
await logger.logToStderr(`Listing all profile card properties...`);
|
|
15
|
+
}
|
|
16
|
+
const result = await odata.getAllItems(`${this.resource}/v1.0/admin/people/profileCardProperties`);
|
|
17
|
+
let output = result;
|
|
18
|
+
if (args.options.output && args.options.output !== 'json') {
|
|
19
|
+
output = output.sort((n1, n2) => {
|
|
20
|
+
const localizations1 = n1.annotations[0]?.localizations?.length ?? 0;
|
|
21
|
+
const localizations2 = n2.annotations[0]?.localizations?.length ?? 0;
|
|
22
|
+
if (localizations1 > localizations2) {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
if (localizations1 < localizations2) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
});
|
|
30
|
+
output = output.map((p) => {
|
|
31
|
+
const propertyAnnotations = p.annotations[0]?.localizations?.map((l) => {
|
|
32
|
+
return { ['displayName ' + l.languageTag]: l.displayName };
|
|
33
|
+
}) ?? [];
|
|
34
|
+
const propertyAnnotationsObject = Object.assign({}, ...propertyAnnotations);
|
|
35
|
+
const result = { directoryPropertyName: p.directoryPropertyName };
|
|
36
|
+
if (p.annotations[0]?.displayName) {
|
|
37
|
+
result.displayName = p.annotations[0]?.displayName;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...result,
|
|
41
|
+
...propertyAnnotationsObject
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
await logger.log(output);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleRejectedODataJsonPromise(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export default new TenantPeopleProfileCardPropertyListCommand();
|
|
53
|
+
//# sourceMappingURL=people-profilecardproperty-list.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _TenantPeopleProfileCardPropertyRemoveCommand_instances, _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry, _TenantPeopleProfileCardPropertyRemoveCommand_initOptions, _TenantPeopleProfileCardPropertyRemoveCommand_initValidators;
|
|
7
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
|
+
import commands from '../../commands.js';
|
|
11
|
+
import { profileCardPropertyNames } from './profileCardProperties.js';
|
|
12
|
+
class TenantPeopleProfileCardPropertyRemoveCommand extends GraphCommand {
|
|
13
|
+
get name() {
|
|
14
|
+
return commands.PEOPLE_PROFILECARDPROPERTY_REMOVE;
|
|
15
|
+
}
|
|
16
|
+
get description() {
|
|
17
|
+
return 'Removes an additional attribute from the profile card properties';
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
_TenantPeopleProfileCardPropertyRemoveCommand_instances.add(this);
|
|
22
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry).call(this);
|
|
23
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initOptions).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initValidators).call(this);
|
|
25
|
+
}
|
|
26
|
+
async commandAction(logger, args) {
|
|
27
|
+
const directoryPropertyName = profileCardPropertyNames.find(n => n.toLowerCase() === args.options.name.toLowerCase());
|
|
28
|
+
const removeProfileCardProperty = async () => {
|
|
29
|
+
if (this.verbose) {
|
|
30
|
+
await logger.logToStderr(`Removing '${directoryPropertyName}' as a profile card property...`);
|
|
31
|
+
}
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
url: `${this.resource}/v1.0/admin/people/profileCardProperties/${directoryPropertyName}`,
|
|
34
|
+
headers: {
|
|
35
|
+
'content-type': 'application/json'
|
|
36
|
+
},
|
|
37
|
+
responseType: 'json'
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
await request.delete(requestOptions);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
this.handleRejectedODataJsonPromise(err);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (args.options.force) {
|
|
47
|
+
await removeProfileCardProperty();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const result = await Cli.prompt({
|
|
51
|
+
type: 'confirm',
|
|
52
|
+
name: 'continue',
|
|
53
|
+
default: false,
|
|
54
|
+
message: `Are you sure you want to remove the profile card property '${directoryPropertyName}'?`
|
|
55
|
+
});
|
|
56
|
+
if (result.continue) {
|
|
57
|
+
await removeProfileCardProperty();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_TenantPeopleProfileCardPropertyRemoveCommand_instances = new WeakSet(), _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry = function _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry() {
|
|
63
|
+
this.telemetry.push((args) => {
|
|
64
|
+
Object.assign(this.telemetryProperties, {
|
|
65
|
+
force: !!args.options.force
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}, _TenantPeopleProfileCardPropertyRemoveCommand_initOptions = function _TenantPeopleProfileCardPropertyRemoveCommand_initOptions() {
|
|
69
|
+
this.options.unshift({
|
|
70
|
+
option: '-n, --name <name>',
|
|
71
|
+
autocomplete: profileCardPropertyNames
|
|
72
|
+
}, {
|
|
73
|
+
option: '-f, --force'
|
|
74
|
+
});
|
|
75
|
+
}, _TenantPeopleProfileCardPropertyRemoveCommand_initValidators = function _TenantPeopleProfileCardPropertyRemoveCommand_initValidators() {
|
|
76
|
+
this.validators.push(async (args) => {
|
|
77
|
+
if (profileCardPropertyNames.every(n => n.toLowerCase() !== args.options.name.toLowerCase())) {
|
|
78
|
+
return `${args.options.name} is not a valid value for name. Allowed values are ${profileCardPropertyNames.join(', ')}`;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export default new TenantPeopleProfileCardPropertyRemoveCommand();
|
|
84
|
+
//# sourceMappingURL=people-profilecardproperty-remove.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _TenantPeopleProfileCardPropertySetCommand_instances, _TenantPeopleProfileCardPropertySetCommand_initTelemetry, _TenantPeopleProfileCardPropertySetCommand_initOptions, _TenantPeopleProfileCardPropertySetCommand_initValidators, _TenantPeopleProfileCardPropertySetCommand_initTypes;
|
|
7
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { profileCardPropertyNames as allProfileCardPropertyNames } from './profileCardProperties.js';
|
|
10
|
+
import commands from '../../commands.js';
|
|
11
|
+
class TenantPeopleProfileCardPropertySetCommand extends GraphCommand {
|
|
12
|
+
get name() {
|
|
13
|
+
return commands.PEOPLE_PROFILECARDPROPERTY_SET;
|
|
14
|
+
}
|
|
15
|
+
get description() {
|
|
16
|
+
return 'Updates a custom attribute to the profile card property';
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
_TenantPeopleProfileCardPropertySetCommand_instances.add(this);
|
|
21
|
+
this.profileCardPropertyNames = allProfileCardPropertyNames.filter(p => p.toLowerCase().startsWith('customattribute'));
|
|
22
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertySetCommand_instances, "m", _TenantPeopleProfileCardPropertySetCommand_initTelemetry).call(this);
|
|
23
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertySetCommand_instances, "m", _TenantPeopleProfileCardPropertySetCommand_initOptions).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertySetCommand_instances, "m", _TenantPeopleProfileCardPropertySetCommand_initValidators).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _TenantPeopleProfileCardPropertySetCommand_instances, "m", _TenantPeopleProfileCardPropertySetCommand_initTypes).call(this);
|
|
26
|
+
}
|
|
27
|
+
allowUnknownOptions() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
async commandAction(logger, args) {
|
|
31
|
+
try {
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
await logger.logToStderr(`Updating profile card property '${args.options.name}'...`);
|
|
34
|
+
}
|
|
35
|
+
// Get the right casing for the profile card property name
|
|
36
|
+
const profileCardProperty = this.profileCardPropertyNames.find(p => p.toLowerCase() === args.options.name.toLowerCase());
|
|
37
|
+
const requestOptions = {
|
|
38
|
+
url: `${this.resource}/v1.0/admin/people/profileCardProperties/${profileCardProperty}`,
|
|
39
|
+
headers: {
|
|
40
|
+
accept: 'application/json;odata.metadata=none'
|
|
41
|
+
},
|
|
42
|
+
responseType: 'json',
|
|
43
|
+
data: {
|
|
44
|
+
annotations: [
|
|
45
|
+
{
|
|
46
|
+
displayName: args.options.displayName,
|
|
47
|
+
localizations: this.getLocalizations(args.options)
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const result = await request.patch(requestOptions);
|
|
53
|
+
let output = result;
|
|
54
|
+
// Transform the output to make it more readable
|
|
55
|
+
if (args.options.output && args.options.output !== 'json' && result.annotations.length > 0) {
|
|
56
|
+
output = result.annotations[0].localizations.reduce((acc, curr) => ({
|
|
57
|
+
...acc,
|
|
58
|
+
['displayName ' + curr.languageTag]: curr.displayName
|
|
59
|
+
}), {
|
|
60
|
+
...result,
|
|
61
|
+
displayName: result.annotations[0].displayName
|
|
62
|
+
});
|
|
63
|
+
delete output.annotations;
|
|
64
|
+
}
|
|
65
|
+
await logger.log(output);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Transform option to localization object.
|
|
73
|
+
* @example Transform "--displayName-en-US 'Cost center'" to { languageTag: 'en-US', displayName: 'Cost center' }
|
|
74
|
+
*/
|
|
75
|
+
getLocalizations(options) {
|
|
76
|
+
const unknownOptions = this.getUnknownOptions(options);
|
|
77
|
+
const result = Object.keys(unknownOptions).map(o => ({
|
|
78
|
+
languageTag: o.substring(o.indexOf('-') + 1),
|
|
79
|
+
displayName: unknownOptions[o]
|
|
80
|
+
}));
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
_TenantPeopleProfileCardPropertySetCommand_instances = new WeakSet(), _TenantPeopleProfileCardPropertySetCommand_initTelemetry = function _TenantPeopleProfileCardPropertySetCommand_initTelemetry() {
|
|
85
|
+
this.telemetry.push((args) => {
|
|
86
|
+
// Add unknown options to telemetry
|
|
87
|
+
const unknownOptions = Object.keys(this.getUnknownOptions(args.options));
|
|
88
|
+
const unknownOptionsObj = unknownOptions.reduce((obj, key) => ({ ...obj, [key]: true }), {});
|
|
89
|
+
Object.assign(this.telemetryProperties, {
|
|
90
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
91
|
+
...unknownOptionsObj
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}, _TenantPeopleProfileCardPropertySetCommand_initOptions = function _TenantPeopleProfileCardPropertySetCommand_initOptions() {
|
|
95
|
+
this.options.unshift({
|
|
96
|
+
option: '-n, --name <name>',
|
|
97
|
+
autocomplete: this.profileCardPropertyNames
|
|
98
|
+
}, {
|
|
99
|
+
option: '-d, --displayName <displayName>'
|
|
100
|
+
});
|
|
101
|
+
}, _TenantPeopleProfileCardPropertySetCommand_initValidators = function _TenantPeopleProfileCardPropertySetCommand_initValidators() {
|
|
102
|
+
this.validators.push(async (args) => {
|
|
103
|
+
if (!this.profileCardPropertyNames.some(p => p.toLowerCase() === args.options.name.toLowerCase())) {
|
|
104
|
+
return `'${args.options.name}' is not a valid value for option name. Allowed values are: ${this.profileCardPropertyNames.join(', ')}.`;
|
|
105
|
+
}
|
|
106
|
+
// Unknown options are allowed only if they start with 'displayName-'
|
|
107
|
+
const unknownOptionKeys = Object.keys(this.getUnknownOptions(args.options));
|
|
108
|
+
const invalidOptionKey = unknownOptionKeys.find(o => !o.startsWith('displayName-'));
|
|
109
|
+
if (invalidOptionKey) {
|
|
110
|
+
return `Invalid option: '${invalidOptionKey}'`;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
});
|
|
114
|
+
}, _TenantPeopleProfileCardPropertySetCommand_initTypes = function _TenantPeopleProfileCardPropertySetCommand_initTypes() {
|
|
115
|
+
this.types.string.push('name', 'displayName');
|
|
116
|
+
};
|
|
117
|
+
export default new TenantPeopleProfileCardPropertySetCommand();
|
|
118
|
+
//# sourceMappingURL=people-profilecardproperty-set.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const profileCardPropertyNames = [
|
|
2
|
+
'UserPrincipalName',
|
|
3
|
+
'Fax',
|
|
4
|
+
'StreetAddress',
|
|
5
|
+
'PostalCode',
|
|
6
|
+
'StateOrProvince',
|
|
7
|
+
'Alias',
|
|
8
|
+
'customAttribute1',
|
|
9
|
+
'customAttribute2',
|
|
10
|
+
'customAttribute3',
|
|
11
|
+
'customAttribute4',
|
|
12
|
+
'customAttribute5',
|
|
13
|
+
'customAttribute6',
|
|
14
|
+
'customAttribute7',
|
|
15
|
+
'customAttribute8',
|
|
16
|
+
'customAttribute9',
|
|
17
|
+
'customAttribute10',
|
|
18
|
+
'customAttribute11',
|
|
19
|
+
'customAttribute12',
|
|
20
|
+
'customAttribute13',
|
|
21
|
+
'customAttribute14',
|
|
22
|
+
'customAttribute15'
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=profileCardProperties.js.map
|
|
@@ -2,6 +2,11 @@ const prefix = 'tenant';
|
|
|
2
2
|
export default {
|
|
3
3
|
ID_GET: `${prefix} id get`,
|
|
4
4
|
INFO_GET: `${prefix} info get`,
|
|
5
|
+
PEOPLE_PROFILECARDPROPERTY_ADD: `${prefix} people profilecardproperty add`,
|
|
6
|
+
PEOPLE_PROFILECARDPROPERTY_GET: `${prefix} people profilecardproperty get`,
|
|
7
|
+
PEOPLE_PROFILECARDPROPERTY_LIST: `${prefix} people profilecardproperty list`,
|
|
8
|
+
PEOPLE_PROFILECARDPROPERTY_REMOVE: `${prefix} people profilecardproperty remove`,
|
|
9
|
+
PEOPLE_PROFILECARDPROPERTY_SET: `${prefix} people profilecardproperty set`,
|
|
5
10
|
REPORT_ACTIVEUSERCOUNTS: `${prefix} report activeusercounts`,
|
|
6
11
|
REPORT_ACTIVEUSERDETAIL: `${prefix} report activeuserdetail`,
|
|
7
12
|
REPORT_OFFICE365ACTIVATIONCOUNTS: `${prefix} report office365activationcounts`,
|
|
@@ -26,9 +26,9 @@ class TodoTaskListCommand extends GraphCommand {
|
|
|
26
26
|
__classPrivateFieldGet(this, _TodoTaskListCommand_instances, "m", _TodoTaskListCommand_initOptions).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _TodoTaskListCommand_instances, "m", _TodoTaskListCommand_initOptionSets).call(this);
|
|
28
28
|
}
|
|
29
|
-
getTodoListId(args) {
|
|
29
|
+
async getTodoListId(args) {
|
|
30
30
|
if (args.options.listId) {
|
|
31
|
-
return
|
|
31
|
+
return args.options.listId;
|
|
32
32
|
}
|
|
33
33
|
const requestOptions = {
|
|
34
34
|
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(args.options.listName)}'`,
|
|
@@ -37,14 +37,12 @@ class TodoTaskListCommand extends GraphCommand {
|
|
|
37
37
|
},
|
|
38
38
|
responseType: 'json'
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return Promise.resolve(taskList.id);
|
|
47
|
-
});
|
|
40
|
+
const response = await request.get(requestOptions);
|
|
41
|
+
const taskList = response.value[0];
|
|
42
|
+
if (!taskList) {
|
|
43
|
+
throw `The specified task list does not exist`;
|
|
44
|
+
}
|
|
45
|
+
return taskList.id;
|
|
48
46
|
}
|
|
49
47
|
async commandAction(logger, args) {
|
|
50
48
|
try {
|
|
@@ -23,42 +23,8 @@ class TodoTaskRemoveCommand extends GraphCommand {
|
|
|
23
23
|
__classPrivateFieldGet(this, _TodoTaskRemoveCommand_instances, "m", _TodoTaskRemoveCommand_initOptionSets).call(this);
|
|
24
24
|
}
|
|
25
25
|
async commandAction(logger, args) {
|
|
26
|
-
const getToDoListId = async () => {
|
|
27
|
-
if (args.options.listName) {
|
|
28
|
-
// Search list by its name
|
|
29
|
-
const requestOptions = {
|
|
30
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(args.options.listName)}'`,
|
|
31
|
-
headers: {
|
|
32
|
-
accept: "application/json;odata.metadata=none"
|
|
33
|
-
},
|
|
34
|
-
responseType: 'json'
|
|
35
|
-
};
|
|
36
|
-
const response = await request.get(requestOptions);
|
|
37
|
-
return response.value && response.value.length === 1 ? response.value[0].id : undefined;
|
|
38
|
-
}
|
|
39
|
-
return Promise.resolve(args.options.listId);
|
|
40
|
-
};
|
|
41
|
-
const removeToDoTask = async () => {
|
|
42
|
-
try {
|
|
43
|
-
const toDoListId = await getToDoListId();
|
|
44
|
-
if (!toDoListId) {
|
|
45
|
-
throw `The list ${args.options.listName} cannot be found`;
|
|
46
|
-
}
|
|
47
|
-
const requestOptions = {
|
|
48
|
-
url: `${this.resource}/v1.0/me/todo/lists/${toDoListId}/tasks/${args.options.id}`,
|
|
49
|
-
headers: {
|
|
50
|
-
accept: "application/json;odata.metadata=none"
|
|
51
|
-
},
|
|
52
|
-
responseType: 'json'
|
|
53
|
-
};
|
|
54
|
-
await request.delete(requestOptions);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
this.handleRejectedODataJsonPromise(err);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
26
|
if (args.options.force) {
|
|
61
|
-
await removeToDoTask();
|
|
27
|
+
await this.removeToDoTask(args.options);
|
|
62
28
|
}
|
|
63
29
|
else {
|
|
64
30
|
const result = await Cli.prompt({
|
|
@@ -68,10 +34,44 @@ class TodoTaskRemoveCommand extends GraphCommand {
|
|
|
68
34
|
message: `Are you sure you want to remove the task ${args.options.id} from list ${args.options.listId || args.options.listName}?`
|
|
69
35
|
});
|
|
70
36
|
if (result.continue) {
|
|
71
|
-
await removeToDoTask();
|
|
37
|
+
await this.removeToDoTask(args.options);
|
|
72
38
|
}
|
|
73
39
|
}
|
|
74
40
|
}
|
|
41
|
+
async getToDoListId(options) {
|
|
42
|
+
if (options.listName) {
|
|
43
|
+
// Search list by its name
|
|
44
|
+
const requestOptions = {
|
|
45
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(options.listName)}'`,
|
|
46
|
+
headers: {
|
|
47
|
+
accept: "application/json;odata.metadata=none"
|
|
48
|
+
},
|
|
49
|
+
responseType: 'json'
|
|
50
|
+
};
|
|
51
|
+
const response = await request.get(requestOptions);
|
|
52
|
+
return response.value && response.value.length === 1 ? response.value[0].id : undefined;
|
|
53
|
+
}
|
|
54
|
+
return options.listId;
|
|
55
|
+
}
|
|
56
|
+
async removeToDoTask(options) {
|
|
57
|
+
try {
|
|
58
|
+
const toDoListId = await this.getToDoListId(options);
|
|
59
|
+
if (!toDoListId) {
|
|
60
|
+
throw `The list ${options.listName} cannot be found`;
|
|
61
|
+
}
|
|
62
|
+
const requestOptions = {
|
|
63
|
+
url: `${this.resource}/v1.0/me/todo/lists/${toDoListId}/tasks/${options.id}`,
|
|
64
|
+
headers: {
|
|
65
|
+
accept: "application/json;odata.metadata=none"
|
|
66
|
+
},
|
|
67
|
+
responseType: 'json'
|
|
68
|
+
};
|
|
69
|
+
await request.delete(requestOptions);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
this.handleRejectedODataJsonPromise(err);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
75
|
}
|
|
76
76
|
_TodoTaskRemoveCommand_instances = new WeakSet(), _TodoTaskRemoveCommand_initTelemetry = function _TodoTaskRemoveCommand_initTelemetry() {
|
|
77
77
|
this.telemetry.push((args) => {
|
|
@@ -28,7 +28,7 @@ class TodoTaskSetCommand extends GraphCommand {
|
|
|
28
28
|
const endpoint = `${this.resource}/v1.0`;
|
|
29
29
|
const data = this.mapRequestBody(args.options);
|
|
30
30
|
try {
|
|
31
|
-
const listId = await this.getTodoListId(args);
|
|
31
|
+
const listId = await this.getTodoListId(args.options);
|
|
32
32
|
const requestOptions = {
|
|
33
33
|
url: `${endpoint}/me/todo/lists/${listId}/tasks/${formatting.encodeQueryParameter(args.options.id)}`,
|
|
34
34
|
headers: {
|
|
@@ -45,25 +45,23 @@ class TodoTaskSetCommand extends GraphCommand {
|
|
|
45
45
|
this.handleRejectedODataJsonPromise(err);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
getTodoListId(
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
48
|
+
async getTodoListId(options) {
|
|
49
|
+
if (options.listId) {
|
|
50
|
+
return options.listId;
|
|
51
51
|
}
|
|
52
52
|
const requestOptions = {
|
|
53
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(
|
|
53
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${escape(options.listName)}'`,
|
|
54
54
|
headers: {
|
|
55
55
|
accept: 'application/json;odata.metadata=none'
|
|
56
56
|
},
|
|
57
57
|
responseType: 'json'
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return Promise.resolve(taskList.id);
|
|
66
|
-
});
|
|
59
|
+
const response = await request.get(requestOptions);
|
|
60
|
+
const taskList = response.value[0];
|
|
61
|
+
if (!taskList) {
|
|
62
|
+
throw `The specified task list does not exist`;
|
|
63
|
+
}
|
|
64
|
+
return taskList.id;
|
|
67
65
|
}
|
|
68
66
|
getDateTimeTimeZone(dateTime) {
|
|
69
67
|
return {
|
|
@@ -23,29 +23,8 @@ class YammerGroupUserRemoveCommand extends YammerCommand {
|
|
|
23
23
|
__classPrivateFieldGet(this, _YammerGroupUserRemoveCommand_instances, "m", _YammerGroupUserRemoveCommand_initValidators).call(this);
|
|
24
24
|
}
|
|
25
25
|
async commandAction(logger, args) {
|
|
26
|
-
const executeRemoveAction = async () => {
|
|
27
|
-
const endpoint = `${this.resource}/v1/group_memberships.json`;
|
|
28
|
-
const requestOptions = {
|
|
29
|
-
url: endpoint,
|
|
30
|
-
headers: {
|
|
31
|
-
accept: 'application/json;odata.metadata=none',
|
|
32
|
-
'content-type': 'application/json;odata=nometadata'
|
|
33
|
-
},
|
|
34
|
-
responseType: 'json',
|
|
35
|
-
data: {
|
|
36
|
-
group_id: args.options.groupId,
|
|
37
|
-
user_id: args.options.id
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
try {
|
|
41
|
-
await request.delete(requestOptions);
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
this.handleRejectedODataJsonPromise(err);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
26
|
if (args.options.force) {
|
|
48
|
-
await executeRemoveAction();
|
|
27
|
+
await this.executeRemoveAction(args.options);
|
|
49
28
|
}
|
|
50
29
|
else {
|
|
51
30
|
let messagePrompt = `Are you sure you want to leave group ${args.options.groupId}?`;
|
|
@@ -59,8 +38,28 @@ class YammerGroupUserRemoveCommand extends YammerCommand {
|
|
|
59
38
|
message: messagePrompt
|
|
60
39
|
});
|
|
61
40
|
if (result.continue) {
|
|
62
|
-
await executeRemoveAction();
|
|
41
|
+
await this.executeRemoveAction(args.options);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async executeRemoveAction(options) {
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${this.resource}/v1/group_memberships.json`,
|
|
48
|
+
headers: {
|
|
49
|
+
accept: 'application/json;odata.metadata=none',
|
|
50
|
+
'content-type': 'application/json;odata=nometadata'
|
|
51
|
+
},
|
|
52
|
+
responseType: 'json',
|
|
53
|
+
data: {
|
|
54
|
+
group_id: options.groupId,
|
|
55
|
+
user_id: options.id
|
|
63
56
|
}
|
|
57
|
+
};
|
|
58
|
+
try {
|
|
59
|
+
await request.delete(requestOptions);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { odata } from "./odata.js";
|
|
2
|
+
import { formatting } from "./formatting.js";
|
|
3
|
+
import { Cli } from "../cli/Cli.js";
|
|
4
|
+
const graphResource = 'https://graph.microsoft.com';
|
|
5
|
+
export const aadAdministrativeUnit = {
|
|
6
|
+
/**
|
|
7
|
+
* Get an administrative unit by its display name.
|
|
8
|
+
* @param displayName Administrative unit display name.
|
|
9
|
+
* @returns The administrative unit.
|
|
10
|
+
* @throws Error when administrative unit was not found.
|
|
11
|
+
*/
|
|
12
|
+
async getAdministrativeUnitByDisplayName(displayName) {
|
|
13
|
+
const administrativeUnits = await odata.getAllItems(`${graphResource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
|
|
14
|
+
if (administrativeUnits.length === 0) {
|
|
15
|
+
throw `The specified administrative unit '${displayName}' does not exist.`;
|
|
16
|
+
}
|
|
17
|
+
if (administrativeUnits.length > 1) {
|
|
18
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', administrativeUnits);
|
|
19
|
+
const selectedAdministrativeUnit = await Cli.handleMultipleResultsFound(`Multiple administrative units with name '${displayName}' found.`, resultAsKeyValuePair);
|
|
20
|
+
return selectedAdministrativeUnit;
|
|
21
|
+
}
|
|
22
|
+
return administrativeUnits[0];
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=aadAdministrativeUnit.js.map
|
package/dist/utils/aadGroup.js
CHANGED
|
@@ -54,7 +54,9 @@ export const aadGroup = {
|
|
|
54
54
|
throw Error(`The specified group '${displayName}' does not exist.`);
|
|
55
55
|
}
|
|
56
56
|
if (groups.length > 1) {
|
|
57
|
-
|
|
57
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', groups);
|
|
58
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple groups with name '${displayName}' found.`, resultAsKeyValuePair);
|
|
59
|
+
return result.id;
|
|
58
60
|
}
|
|
59
61
|
return groups[0].id;
|
|
60
62
|
},
|
package/dist/utils/odata.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import request from "../request.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
items = items.concat(nextPageItems);
|
|
19
|
-
}
|
|
20
|
-
return items;
|
|
2
|
+
async function getAllItems(param1, metadata) {
|
|
3
|
+
let items = [];
|
|
4
|
+
const requestOptions = typeof param1 !== 'string' ? param1 : {
|
|
5
|
+
url: param1,
|
|
6
|
+
headers: {
|
|
7
|
+
accept: `application/json;odata.metadata=${metadata ?? 'none'}`,
|
|
8
|
+
'odata-version': '4.0'
|
|
9
|
+
},
|
|
10
|
+
responseType: 'json'
|
|
11
|
+
};
|
|
12
|
+
const res = await request.get(requestOptions);
|
|
13
|
+
items = res.value;
|
|
14
|
+
const nextLink = res['@odata.nextLink'] ?? res.nextLink;
|
|
15
|
+
if (nextLink) {
|
|
16
|
+
const nextPageItems = await odata.getAllItems({ ...requestOptions, url: nextLink });
|
|
17
|
+
items = items.concat(nextPageItems);
|
|
21
18
|
}
|
|
19
|
+
return items;
|
|
20
|
+
}
|
|
21
|
+
export const odata = {
|
|
22
|
+
getAllItems
|
|
22
23
|
};
|
|
23
24
|
//# sourceMappingURL=odata.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Cli } from '../cli/Cli.js';
|
|
2
|
+
import { settingsNames } from '../settingsNames.js';
|
|
3
|
+
let inquirer;
|
|
4
|
+
export const prompt = {
|
|
5
|
+
/* c8 ignore next 10 */
|
|
6
|
+
async forInput(config, answers) {
|
|
7
|
+
if (!inquirer) {
|
|
8
|
+
inquirer = await import('inquirer');
|
|
9
|
+
}
|
|
10
|
+
const cli = Cli.getInstance();
|
|
11
|
+
const errorOutput = cli.getSettingWithDefaultValue(settingsNames.errorOutput, 'stderr');
|
|
12
|
+
const prompt = inquirer.createPromptModule({ output: errorOutput === 'stderr' ? process.stderr : process.stdout });
|
|
13
|
+
return await prompt(config, answers);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=prompt.js.map
|