@pnp/cli-microsoft365 6.1.0-beta.1da0a1d → 6.1.0-beta.a927083
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/cli/Cli.js +48 -5
- package/dist/m365/planner/commands/plan/plan-set.js +305 -0
- package/dist/m365/planner/commands/tenant/tenant-settings-set.js +4 -7
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.1.js +23 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +63 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015009_FILE_config_sass_json.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.16.1.js +59 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/contenttype/contenttype-set.js +78 -31
- package/dist/m365/spo/commands/file/file-get.js +5 -17
- package/dist/m365/spo/commands/folder/folder-get.js +1 -9
- package/dist/m365/spo/commands/listitem/listitem-get.js +4 -16
- package/dist/m365/spo/commands/listitem/listitem-set.js +7 -4
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +5 -1
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +2 -13
- package/dist/m365/spo/commands/web/web-get.js +5 -16
- package/dist/utils/formatting.js +37 -0
- package/docs/docs/cmd/planner/plan/plan-set.md +144 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-set.md +15 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-add.md +6 -6
- package/package.json +1 -1
|
@@ -443,6 +443,21 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
443
443
|
range: '^4',
|
|
444
444
|
fix: 'npm i -g yo@4'
|
|
445
445
|
}
|
|
446
|
+
},
|
|
447
|
+
'1.16.1': {
|
|
448
|
+
gulpCli: {
|
|
449
|
+
range: '^1 || ^2',
|
|
450
|
+
fix: 'npm i -g gulp-cli@2'
|
|
451
|
+
},
|
|
452
|
+
node: {
|
|
453
|
+
range: '>=16.13.0 <17.0.0',
|
|
454
|
+
fix: 'Install Node.js >=16.13.0 <17.0.0'
|
|
455
|
+
},
|
|
456
|
+
sp: SharePointVersion.SPO,
|
|
457
|
+
yo: {
|
|
458
|
+
range: '^4',
|
|
459
|
+
fix: 'npm i -g yo@4'
|
|
460
|
+
}
|
|
446
461
|
}
|
|
447
462
|
};
|
|
448
463
|
__classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
|
|
@@ -21,6 +21,7 @@ const validation_1 = require("../../../../utils/validation");
|
|
|
21
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
22
|
const commands_1 = require("../../commands");
|
|
23
23
|
const request_1 = require("../../../../request");
|
|
24
|
+
const config_1 = require("../../../../config");
|
|
24
25
|
class SpoContentTypeSetCommand extends SpoCommand_1.default {
|
|
25
26
|
constructor() {
|
|
26
27
|
super();
|
|
@@ -35,46 +36,32 @@ class SpoContentTypeSetCommand extends SpoCommand_1.default {
|
|
|
35
36
|
return commands_1.default.CONTENTTYPE_SET;
|
|
36
37
|
}
|
|
37
38
|
get description() {
|
|
38
|
-
return '
|
|
39
|
+
return 'Update an existing content type';
|
|
39
40
|
}
|
|
40
41
|
allowUnknownOptions() {
|
|
41
42
|
return true;
|
|
42
43
|
}
|
|
43
44
|
commandAction(logger, args) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const requestOptions = {
|
|
46
|
-
url: `${args.options.webUrl}/_api/Web`,
|
|
47
|
-
headers: {
|
|
48
|
-
accept: 'application/json;odata=nometadata'
|
|
49
|
-
},
|
|
50
|
-
responseType: 'json',
|
|
51
|
-
data: this.getRequestPayload(args.options)
|
|
52
|
-
};
|
|
53
|
-
if (args.options.listId) {
|
|
54
|
-
requestOptions.url += `/Lists/GetById('${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
55
|
-
}
|
|
56
|
-
else if (args.options.listTitle) {
|
|
57
|
-
requestOptions.url += `/Lists/GetByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
58
|
-
}
|
|
59
|
-
else if (args.options.listUrl) {
|
|
60
|
-
requestOptions.url += `/GetList('${formatting_1.formatting.encodeQueryParameter(urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl))}')`;
|
|
61
|
-
}
|
|
62
|
-
requestOptions.url += '/ContentTypes';
|
|
63
46
|
try {
|
|
64
|
-
const contentTypeId = yield this.getContentTypeId(args.options);
|
|
65
|
-
|
|
66
|
-
yield
|
|
47
|
+
const contentTypeId = yield this.getContentTypeId(logger, args.options);
|
|
48
|
+
const siteId = yield this.getSiteId(logger, args.options.webUrl);
|
|
49
|
+
const webId = yield this.getWebId(logger, args.options.webUrl);
|
|
50
|
+
yield this.updateContentType(logger, siteId, webId, contentTypeId, args.options);
|
|
67
51
|
}
|
|
68
52
|
catch (err) {
|
|
69
|
-
this.
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
70
54
|
}
|
|
71
55
|
});
|
|
72
56
|
}
|
|
73
|
-
getContentTypeId(options) {
|
|
57
|
+
getContentTypeId(logger, options) {
|
|
74
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
59
|
if (options.id) {
|
|
76
60
|
return options.id;
|
|
77
61
|
}
|
|
62
|
+
if (this.verbose) {
|
|
63
|
+
logger.logToStderr(`Retrieving content type to update...`);
|
|
64
|
+
}
|
|
78
65
|
const requestOptions = {
|
|
79
66
|
url: `${options.webUrl}/_api/Web`,
|
|
80
67
|
headers: {
|
|
@@ -99,6 +86,27 @@ class SpoContentTypeSetCommand extends SpoCommand_1.default {
|
|
|
99
86
|
return res.value[0].Id.StringValue;
|
|
100
87
|
});
|
|
101
88
|
}
|
|
89
|
+
updateContentType(logger, siteId, webId, contentTypeId, options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
if (this.verbose) {
|
|
92
|
+
logger.logToStderr(`Updating content type...`);
|
|
93
|
+
}
|
|
94
|
+
const payload = this.getRequestPayload(options);
|
|
95
|
+
const requestOptions = {
|
|
96
|
+
url: `${options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
97
|
+
headers: {
|
|
98
|
+
'Content-Type': 'text/xml'
|
|
99
|
+
},
|
|
100
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload}</Actions><ObjectPaths><Identity Id="9" Name="fc4179a0-e0d7-5000-c38b-bc3506fbab6f|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:contenttype:${formatting_1.formatting.escapeXml(contentTypeId)}" /></ObjectPaths></Request>`
|
|
101
|
+
};
|
|
102
|
+
const res = yield request_1.default.post(requestOptions);
|
|
103
|
+
const json = JSON.parse(res);
|
|
104
|
+
const response = json[0];
|
|
105
|
+
if (response.ErrorInfo) {
|
|
106
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
102
110
|
getRequestPayload(options) {
|
|
103
111
|
const excludeOptions = [
|
|
104
112
|
'webUrl',
|
|
@@ -110,15 +118,51 @@ class SpoContentTypeSetCommand extends SpoCommand_1.default {
|
|
|
110
118
|
'query',
|
|
111
119
|
'debug',
|
|
112
120
|
'verbose',
|
|
113
|
-
'output'
|
|
121
|
+
'output',
|
|
122
|
+
'updateChildren'
|
|
114
123
|
];
|
|
124
|
+
let i = 12;
|
|
115
125
|
const payload = Object.keys(options)
|
|
116
126
|
.filter(key => excludeOptions.indexOf(key) === -1)
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
.map(key => {
|
|
128
|
+
return `<SetProperty Id="${i++}" ObjectPathId="9" Name="${key}"><Parameter Type="String">${formatting_1.formatting.escapeXml(options[key])}</Parameter></SetProperty>`;
|
|
129
|
+
});
|
|
130
|
+
if (options.updateChildren) {
|
|
131
|
+
payload.push(`<Method Name="Update" Id="${i++}" ObjectPathId="9"><Parameters><Parameter Type="Boolean">true</Parameter></Parameters></Method>`);
|
|
132
|
+
}
|
|
133
|
+
return payload.join('');
|
|
134
|
+
}
|
|
135
|
+
getSiteId(logger, webUrl) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
if (this.verbose) {
|
|
138
|
+
logger.logToStderr(`Retrieving site collection id...`);
|
|
139
|
+
}
|
|
140
|
+
const requestOptions = {
|
|
141
|
+
url: `${webUrl}/_api/site?$select=Id`,
|
|
142
|
+
headers: {
|
|
143
|
+
accept: 'application/json;odata=nometadata'
|
|
144
|
+
},
|
|
145
|
+
responseType: 'json'
|
|
146
|
+
};
|
|
147
|
+
const site = yield request_1.default.get(requestOptions);
|
|
148
|
+
return site.Id;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
getWebId(logger, webUrl) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if (this.verbose) {
|
|
154
|
+
logger.logToStderr(`Retrieving web id...`);
|
|
155
|
+
}
|
|
156
|
+
const requestOptions = {
|
|
157
|
+
url: `${webUrl}/_api/web?$select=Id`,
|
|
158
|
+
headers: {
|
|
159
|
+
accept: 'application/json;odata=nometadata'
|
|
160
|
+
},
|
|
161
|
+
responseType: 'json'
|
|
162
|
+
};
|
|
163
|
+
const web = yield request_1.default.get(requestOptions);
|
|
164
|
+
return web.Id;
|
|
165
|
+
});
|
|
122
166
|
}
|
|
123
167
|
}
|
|
124
168
|
_SpoContentTypeSetCommand_instances = new WeakSet(), _SpoContentTypeSetCommand_initTelemetry = function _SpoContentTypeSetCommand_initTelemetry() {
|
|
@@ -128,7 +172,8 @@ _SpoContentTypeSetCommand_instances = new WeakSet(), _SpoContentTypeSetCommand_i
|
|
|
128
172
|
name: typeof args.options.name !== 'undefined',
|
|
129
173
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
130
174
|
listId: typeof args.options.listId !== 'undefined',
|
|
131
|
-
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
175
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
176
|
+
updateChildren: args.options.updateChildren
|
|
132
177
|
});
|
|
133
178
|
});
|
|
134
179
|
}, _SpoContentTypeSetCommand_initOptions = function _SpoContentTypeSetCommand_initOptions() {
|
|
@@ -144,6 +189,8 @@ _SpoContentTypeSetCommand_instances = new WeakSet(), _SpoContentTypeSetCommand_i
|
|
|
144
189
|
option: '--listId [listId]'
|
|
145
190
|
}, {
|
|
146
191
|
option: '--listUrl [listUrl]'
|
|
192
|
+
}, {
|
|
193
|
+
option: '--updateChildren'
|
|
147
194
|
});
|
|
148
195
|
}, _SpoContentTypeSetCommand_initValidators = function _SpoContentTypeSetCommand_initValidators() {
|
|
149
196
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -21,9 +21,7 @@ const request_1 = require("../../../../request");
|
|
|
21
21
|
const formatting_1 = require("../../../../utils/formatting");
|
|
22
22
|
const validation_1 = require("../../../../utils/validation");
|
|
23
23
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
|
-
const base_permissions_1 = require("../../base-permissions");
|
|
25
24
|
const commands_1 = require("../../commands");
|
|
26
|
-
const RoleType_1 = require("../roledefinition/RoleType");
|
|
27
25
|
class SpoFileGetCommand extends SpoCommand_1.default {
|
|
28
26
|
constructor() {
|
|
29
27
|
super();
|
|
@@ -107,10 +105,12 @@ class SpoFileGetCommand extends SpoCommand_1.default {
|
|
|
107
105
|
if (args.options.withPermissions) {
|
|
108
106
|
requestOptions.url = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${file.ServerRelativeUrl}')/ListItemAllFields/RoleAssignments?$expand=Member,RoleDefinitionBindings`;
|
|
109
107
|
const response = yield request_1.default.get(requestOptions);
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
response.value.forEach((r) => {
|
|
109
|
+
r.RoleDefinitionBindings = formatting_1.formatting.setFriendlyPermissions(r.RoleDefinitionBindings);
|
|
110
|
+
});
|
|
111
|
+
fileProperties.RoleAssignments = response.value;
|
|
112
112
|
if (args.options.asListItem) {
|
|
113
|
-
fileProperties.ListItemAllFields.RoleAssignments =
|
|
113
|
+
fileProperties.ListItemAllFields.RoleAssignments = response.value;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
logger.log(args.options.asListItem ? fileProperties.ListItemAllFields : fileProperties);
|
|
@@ -122,18 +122,6 @@ class SpoFileGetCommand extends SpoCommand_1.default {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
setFriendlyPermissions(response) {
|
|
126
|
-
response.forEach((r) => {
|
|
127
|
-
r.RoleDefinitionBindings.forEach((r) => {
|
|
128
|
-
const permissions = new base_permissions_1.BasePermissions();
|
|
129
|
-
permissions.high = r.BasePermissions.High;
|
|
130
|
-
permissions.low = r.BasePermissions.Low;
|
|
131
|
-
r.BasePermissionsValue = permissions.parse();
|
|
132
|
-
r.RoleTypeKindValue = RoleType_1.RoleType[r.RoleTypeKind];
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
return response;
|
|
136
|
-
}
|
|
137
125
|
}
|
|
138
126
|
_SpoFileGetCommand_instances = new WeakSet(), _SpoFileGetCommand_initTelemetry = function _SpoFileGetCommand_initTelemetry() {
|
|
139
127
|
this.telemetry.push((args) => {
|
|
@@ -23,8 +23,6 @@ const validation_1 = require("../../../../utils/validation");
|
|
|
23
23
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
24
|
const commands_1 = require("../../commands");
|
|
25
25
|
const ListPrincipalType_1 = require("../list/ListPrincipalType");
|
|
26
|
-
const base_permissions_1 = require("../../base-permissions");
|
|
27
|
-
const RoleType_1 = require("../../commands/roledefinition/RoleType");
|
|
28
26
|
class SpoFolderGetCommand extends SpoCommand_1.default {
|
|
29
27
|
constructor() {
|
|
30
28
|
super();
|
|
@@ -72,13 +70,7 @@ class SpoFolderGetCommand extends SpoCommand_1.default {
|
|
|
72
70
|
}
|
|
73
71
|
listItemAllFields.RoleAssignments.forEach(r => {
|
|
74
72
|
r.Member.PrincipalTypeString = ListPrincipalType_1.ListPrincipalType[r.Member.PrincipalType];
|
|
75
|
-
r.RoleDefinitionBindings.
|
|
76
|
-
const permissions = new base_permissions_1.BasePermissions();
|
|
77
|
-
permissions.high = rb.BasePermissions.High;
|
|
78
|
-
permissions.low = rb.BasePermissions.Low;
|
|
79
|
-
rb.BasePermissionsValue = permissions.parse();
|
|
80
|
-
rb.RoleTypeKindValue = RoleType_1.RoleType[rb.RoleTypeKind];
|
|
81
|
-
});
|
|
73
|
+
r.RoleDefinitionBindings = formatting_1.formatting.setFriendlyPermissions(r.RoleDefinitionBindings);
|
|
82
74
|
});
|
|
83
75
|
}
|
|
84
76
|
logger.log(folder);
|
|
@@ -20,9 +20,7 @@ const formatting_1 = require("../../../../utils/formatting");
|
|
|
20
20
|
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
21
21
|
const validation_1 = require("../../../../utils/validation");
|
|
22
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
-
const base_permissions_1 = require("../../base-permissions");
|
|
24
23
|
const commands_1 = require("../../commands");
|
|
25
|
-
const RoleType_1 = require("../roledefinition/RoleType");
|
|
26
24
|
class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
27
25
|
constructor() {
|
|
28
26
|
super();
|
|
@@ -72,8 +70,10 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
|
72
70
|
if (args.options.withPermissions) {
|
|
73
71
|
requestOptions.url = `${requestUrl}/items(${args.options.id})/RoleAssignments?$expand=Member,RoleDefinitionBindings`;
|
|
74
72
|
const response = yield request_1.default.get(requestOptions);
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
response.value.forEach((r) => {
|
|
74
|
+
r.RoleDefinitionBindings = formatting_1.formatting.setFriendlyPermissions(r.RoleDefinitionBindings);
|
|
75
|
+
});
|
|
76
|
+
itemProperties.RoleAssignments = response.value;
|
|
77
77
|
}
|
|
78
78
|
delete itemProperties['ID'];
|
|
79
79
|
logger.log(itemProperties);
|
|
@@ -83,18 +83,6 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
setFriendlyPermissions(response) {
|
|
87
|
-
response.forEach((r) => {
|
|
88
|
-
r.RoleDefinitionBindings.forEach((r) => {
|
|
89
|
-
const permissions = new base_permissions_1.BasePermissions();
|
|
90
|
-
permissions.high = r.BasePermissions.High;
|
|
91
|
-
permissions.low = r.BasePermissions.Low;
|
|
92
|
-
r.BasePermissionsValue = permissions.parse();
|
|
93
|
-
r.RoleTypeKindValue = RoleType_1.RoleType[r.RoleTypeKind];
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
86
|
}
|
|
99
87
|
_SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTelemetry = function _SpoListItemGetCommand_initTelemetry() {
|
|
100
88
|
this.telemetry.push((args) => {
|
|
@@ -127,16 +127,17 @@ class SpoListItemSetCommand extends SpoCommand_1.default {
|
|
|
127
127
|
objectIdentity = yield this.requestObjectIdentity(args.options.webUrl, logger, formDigestValue);
|
|
128
128
|
}
|
|
129
129
|
const additionalContentType = (args.options.systemUpdate && args.options.contentType && contentTypeName !== '') ? `
|
|
130
|
+
<Method Name="ParseAndSetFieldValue" Id="1" ObjectPathId="147">
|
|
130
131
|
<Parameters>
|
|
131
132
|
<Parameter Type="String">ContentType</Parameter>
|
|
132
133
|
<Parameter Type="String">${contentTypeName}</Parameter>
|
|
133
|
-
</Parameters
|
|
134
|
+
</Parameters>
|
|
135
|
+
</Method>`
|
|
134
136
|
: ``;
|
|
135
137
|
const requestBody = args.options.systemUpdate ?
|
|
136
138
|
`<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
|
|
137
139
|
<Actions>
|
|
138
|
-
|
|
139
|
-
</Method>
|
|
140
|
+
${this.mapRequestBody(args.options).join('')}${additionalContentType}
|
|
140
141
|
<Method Name="SystemUpdate" Id="2" ObjectPathId="147" />
|
|
141
142
|
</Actions>
|
|
142
143
|
<ObjectPaths>
|
|
@@ -231,10 +232,12 @@ class SpoListItemSetCommand extends SpoCommand_1.default {
|
|
|
231
232
|
if (excludeOptions.indexOf(key) === -1) {
|
|
232
233
|
if (options.systemUpdate) {
|
|
233
234
|
requestBody.push(`
|
|
235
|
+
<Method Name="ParseAndSetFieldValue" Id="1" ObjectPathId="147">
|
|
234
236
|
<Parameters>
|
|
235
237
|
<Parameter Type="String">${key}</Parameter>
|
|
236
238
|
<Parameter Type="String">${options[key].toString()}</Parameter>
|
|
237
|
-
</Parameters
|
|
239
|
+
</Parameters>
|
|
240
|
+
</Method>`);
|
|
238
241
|
}
|
|
239
242
|
else {
|
|
240
243
|
requestBody.push({ FieldName: key, FieldValue: options[key].toString() });
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
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
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _SpoNavigationNodeAddCommand_instances, _SpoNavigationNodeAddCommand_initTelemetry, _SpoNavigationNodeAddCommand_initOptions, _SpoNavigationNodeAddCommand_initValidators;
|
|
16
|
+
var _SpoNavigationNodeAddCommand_instances, _SpoNavigationNodeAddCommand_initTelemetry, _SpoNavigationNodeAddCommand_initOptions, _SpoNavigationNodeAddCommand_initValidators, _SpoNavigationNodeAddCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const validation_1 = require("../../../../utils/validation");
|
|
@@ -26,6 +26,7 @@ class SpoNavigationNodeAddCommand extends SpoCommand_1.default {
|
|
|
26
26
|
__classPrivateFieldGet(this, _SpoNavigationNodeAddCommand_instances, "m", _SpoNavigationNodeAddCommand_initTelemetry).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _SpoNavigationNodeAddCommand_instances, "m", _SpoNavigationNodeAddCommand_initOptions).call(this);
|
|
28
28
|
__classPrivateFieldGet(this, _SpoNavigationNodeAddCommand_instances, "m", _SpoNavigationNodeAddCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoNavigationNodeAddCommand_instances, "m", _SpoNavigationNodeAddCommand_initOptionSets).call(this);
|
|
29
30
|
}
|
|
30
31
|
get name() {
|
|
31
32
|
return commands_1.default.NAVIGATION_NODE_ADD;
|
|
@@ -71,6 +72,7 @@ _SpoNavigationNodeAddCommand_instances = new WeakSet(), _SpoNavigationNodeAddCom
|
|
|
71
72
|
this.telemetry.push((args) => {
|
|
72
73
|
Object.assign(this.telemetryProperties, {
|
|
73
74
|
isExternal: args.options.isExternal,
|
|
75
|
+
location: typeof args.options.location !== 'undefined',
|
|
74
76
|
parentNodeId: typeof args.options.parentNodeId !== 'undefined'
|
|
75
77
|
});
|
|
76
78
|
});
|
|
@@ -108,6 +110,8 @@ _SpoNavigationNodeAddCommand_instances = new WeakSet(), _SpoNavigationNodeAddCom
|
|
|
108
110
|
}
|
|
109
111
|
return true;
|
|
110
112
|
}));
|
|
113
|
+
}, _SpoNavigationNodeAddCommand_initOptionSets = function _SpoNavigationNodeAddCommand_initOptionSets() {
|
|
114
|
+
this.optionSets.push({ options: ['location', 'parentNodeId'] });
|
|
111
115
|
};
|
|
112
116
|
module.exports = new SpoNavigationNodeAddCommand();
|
|
113
117
|
//# sourceMappingURL=navigation-node-add.js.map
|
|
@@ -16,11 +16,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _SpoRoleDefinitionListCommand_instances, _SpoRoleDefinitionListCommand_initOptions, _SpoRoleDefinitionListCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const odata_1 = require("../../../../utils/odata");
|
|
19
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
19
20
|
const validation_1 = require("../../../../utils/validation");
|
|
20
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
-
const base_permissions_1 = require("../../base-permissions");
|
|
22
22
|
const commands_1 = require("../../commands");
|
|
23
|
-
const RoleType_1 = require("./RoleType");
|
|
24
23
|
class SpoRoleDefinitionListCommand extends SpoCommand_1.default {
|
|
25
24
|
constructor() {
|
|
26
25
|
super();
|
|
@@ -44,7 +43,7 @@ class SpoRoleDefinitionListCommand extends SpoCommand_1.default {
|
|
|
44
43
|
}
|
|
45
44
|
try {
|
|
46
45
|
const res = yield odata_1.odata.getAllItems(`${args.options.webUrl}/_api/web/roledefinitions`);
|
|
47
|
-
const response =
|
|
46
|
+
const response = formatting_1.formatting.setFriendlyPermissions(res);
|
|
48
47
|
logger.log(response);
|
|
49
48
|
}
|
|
50
49
|
catch (err) {
|
|
@@ -52,16 +51,6 @@ class SpoRoleDefinitionListCommand extends SpoCommand_1.default {
|
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
|
-
setFriendlyPermissions(response) {
|
|
56
|
-
response.forEach((r) => {
|
|
57
|
-
const permissions = new base_permissions_1.BasePermissions();
|
|
58
|
-
permissions.high = r.BasePermissions.High;
|
|
59
|
-
permissions.low = r.BasePermissions.Low;
|
|
60
|
-
r.BasePermissionsValue = permissions.parse();
|
|
61
|
-
r.RoleTypeKindValue = RoleType_1.RoleType[r.RoleTypeKind];
|
|
62
|
-
});
|
|
63
|
-
return response;
|
|
64
|
-
}
|
|
65
54
|
}
|
|
66
55
|
_SpoRoleDefinitionListCommand_instances = new WeakSet(), _SpoRoleDefinitionListCommand_initOptions = function _SpoRoleDefinitionListCommand_initOptions() {
|
|
67
56
|
this.options.unshift({
|
|
@@ -16,11 +16,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _SpoWebGetCommand_instances, _SpoWebGetCommand_initTelemetry, _SpoWebGetCommand_initOptions, _SpoWebGetCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
19
20
|
const validation_1 = require("../../../../utils/validation");
|
|
20
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
-
const base_permissions_1 = require("../../base-permissions");
|
|
22
22
|
const commands_1 = require("../../commands");
|
|
23
|
-
const RoleType_1 = require("../roledefinition/RoleType");
|
|
24
23
|
class SpoWebGetCommand extends SpoCommand_1.default {
|
|
25
24
|
constructor() {
|
|
26
25
|
super();
|
|
@@ -53,8 +52,10 @@ class SpoWebGetCommand extends SpoCommand_1.default {
|
|
|
53
52
|
if (args.options.withPermissions) {
|
|
54
53
|
requestOptions.url = `${args.options.url}/_api/web/RoleAssignments?$expand=Member,RoleDefinitionBindings`;
|
|
55
54
|
const response = yield request_1.default.get(requestOptions);
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
response.value.forEach((r) => {
|
|
56
|
+
r.RoleDefinitionBindings = formatting_1.formatting.setFriendlyPermissions(r.RoleDefinitionBindings);
|
|
57
|
+
});
|
|
58
|
+
webProperties.RoleAssignments = response.value;
|
|
58
59
|
}
|
|
59
60
|
logger.log(webProperties);
|
|
60
61
|
}
|
|
@@ -63,18 +64,6 @@ class SpoWebGetCommand extends SpoCommand_1.default {
|
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
setFriendlyPermissions(response) {
|
|
67
|
-
response.forEach((r) => {
|
|
68
|
-
r.RoleDefinitionBindings.forEach((r) => {
|
|
69
|
-
const permissions = new base_permissions_1.BasePermissions();
|
|
70
|
-
permissions.high = r.BasePermissions.High;
|
|
71
|
-
permissions.low = r.BasePermissions.Low;
|
|
72
|
-
r.BasePermissionsValue = permissions.parse();
|
|
73
|
-
r.RoleTypeKindValue = RoleType_1.RoleType[r.RoleTypeKind];
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
return response;
|
|
77
|
-
}
|
|
78
67
|
}
|
|
79
68
|
_SpoWebGetCommand_instances = new WeakSet(), _SpoWebGetCommand_initTelemetry = function _SpoWebGetCommand_initTelemetry() {
|
|
80
69
|
this.telemetry.push((args) => {
|
package/dist/utils/formatting.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatting = void 0;
|
|
4
4
|
const stripJsonComments = require("strip-json-comments");
|
|
5
|
+
const base_permissions_1 = require("../m365/spo/base-permissions");
|
|
6
|
+
const RoleType_1 = require("../m365/spo/commands/roledefinition/RoleType");
|
|
5
7
|
exports.formatting = {
|
|
6
8
|
escapeXml(s) {
|
|
7
9
|
if (!s) {
|
|
@@ -38,6 +40,16 @@ exports.formatting = {
|
|
|
38
40
|
return filtered;
|
|
39
41
|
}, {});
|
|
40
42
|
},
|
|
43
|
+
setFriendlyPermissions(response) {
|
|
44
|
+
response.forEach((r) => {
|
|
45
|
+
const permissions = new base_permissions_1.BasePermissions();
|
|
46
|
+
permissions.high = r.BasePermissions.High;
|
|
47
|
+
permissions.low = r.BasePermissions.Low;
|
|
48
|
+
r.BasePermissionsValue = permissions.parse();
|
|
49
|
+
r.RoleTypeKindValue = RoleType_1.RoleType[r.RoleTypeKind];
|
|
50
|
+
});
|
|
51
|
+
return response;
|
|
52
|
+
},
|
|
41
53
|
parseCsvToJson(s, quoteChar = '"', delimiter = ',') {
|
|
42
54
|
const regex = new RegExp(`\\s*(${quoteChar})?(.*?)\\1\\s*(?:${delimiter}|$)`, 'gs');
|
|
43
55
|
const lines = s.split('\n');
|
|
@@ -73,6 +85,31 @@ exports.formatting = {
|
|
|
73
85
|
.replace(/:/g, '%3A')
|
|
74
86
|
.replace(/@/g, '%40')
|
|
75
87
|
.replace(/#/g, '%23');
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Rewrites boolean values according to the definition:
|
|
91
|
+
* Booleans are case-insensitive, and are represented by the following values.
|
|
92
|
+
* True: 1, yes, true, on
|
|
93
|
+
* False: 0, no, false, off
|
|
94
|
+
* @value Stringified Boolean value to rewrite
|
|
95
|
+
* @returns A stringified boolean with the value 'true' or 'false'. Returns the original value if it does not comply with the definition.
|
|
96
|
+
*/
|
|
97
|
+
rewriteBooleanValue(value) {
|
|
98
|
+
const argValue = value.toLowerCase();
|
|
99
|
+
switch (argValue) {
|
|
100
|
+
case '1':
|
|
101
|
+
case 'true':
|
|
102
|
+
case 'yes':
|
|
103
|
+
case 'on':
|
|
104
|
+
return 'true';
|
|
105
|
+
case '0':
|
|
106
|
+
case 'false':
|
|
107
|
+
case 'no':
|
|
108
|
+
case 'off':
|
|
109
|
+
return 'false';
|
|
110
|
+
default:
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
76
113
|
}
|
|
77
114
|
};
|
|
78
115
|
//# sourceMappingURL=formatting.js.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# planner plan set
|
|
2
|
+
|
|
3
|
+
Updates a Microsoft Planner plan
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 planner plan set [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-i, --id [id]`
|
|
14
|
+
: ID of the plan. Specify either `id` or `title` but not both.
|
|
15
|
+
|
|
16
|
+
`-t, --title [title]`
|
|
17
|
+
: Title of the plan. Specify either `id` or `title` but not both.
|
|
18
|
+
|
|
19
|
+
`--ownerGroupId [ownerGroupId]`
|
|
20
|
+
: ID of the group to which the plan belongs. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
|
|
21
|
+
|
|
22
|
+
`--ownerGroupName [ownerGroupName]`
|
|
23
|
+
: Name of the Group to which the plan belongs. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
|
|
24
|
+
|
|
25
|
+
`--newTitle [newTitle]`
|
|
26
|
+
: New title of the plan.
|
|
27
|
+
|
|
28
|
+
`--shareWithUserIds [shareWithUserIds]`
|
|
29
|
+
: The comma-separated IDs of the users with whom you want to share the plan. Specify either `shareWithUserIds` or `shareWithUserNames` but not both.
|
|
30
|
+
|
|
31
|
+
`--shareWithUserNames [shareWithUserNames]`
|
|
32
|
+
: The comma-separated UPNs of the users with whom you want to share the plan. Specify either `shareWithUserIds` or `shareWithUserNames` but not both.
|
|
33
|
+
|
|
34
|
+
--8<-- "docs/cmd/_global.md"
|
|
35
|
+
|
|
36
|
+
## Remarks
|
|
37
|
+
|
|
38
|
+
This command allows using unknown options.
|
|
39
|
+
|
|
40
|
+
`--category1 [category1]`
|
|
41
|
+
: New label for a category. Define the category key within your option to update the related label. Category 1 to 25 are available. E.g., `--category4`, `--category12`.
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
Updates a Microsoft Planner plan title to New Title
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
m365 planner plan set --id 'gndWOTSK60GfPQfiDDj43JgACDCb' --newTitle 'New Title'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Share a Microsoft Planner plan owned by the group, with the users
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
m365 planner plan set --title 'Plan Title' --ownerGroupName 'My Group' --shareWithUserNames 'user1@contoso.com,user2@contoso.com'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Updates a Microsoft Planner plan category labels
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
m365 planner plan set --id 'gndWOTSK60GfPQfiDDj43JgACDCb' --category21 'ToDo' --category25 'Urgent'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## More information
|
|
64
|
+
|
|
65
|
+
- Update plannerPlan: [https://learn.microsoft.com/en-us/graph/api/plannerplan-update?view=graph-rest-1.0&tabs=http](https://learn.microsoft.com/en-us/graph/api/plannerplan-update?view=graph-rest-1.0&tabs=http)
|
|
66
|
+
- plannerPlanDetails resource type: [https://learn.microsoft.com/en-us/graph/api/resources/plannerplandetails?view=graph-rest-1.0](https://learn.microsoft.com/en-us/graph/api/resources/plannerplandetails?view=graph-rest-1.0)
|
|
67
|
+
- plannerCategoryDescriptions resource type: [https://learn.microsoft.com/en-us/graph/api/resources/plannercategorydescriptions?view=graph-rest-1.0](https://learn.microsoft.com/en-us/graph/api/resources/plannercategorydescriptions?view=graph-rest-1.0)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Response
|
|
71
|
+
|
|
72
|
+
=== "JSON"
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"createdDateTime": "2015-03-30T18:36:49.2407981Z",
|
|
77
|
+
"owner": "ebf3b108-5234-4e22-b93d-656d7dae5874",
|
|
78
|
+
"title": "My Planner Plan",
|
|
79
|
+
"id": "xqQg5FS2LkCp935s-FIFm2QAFkHM",
|
|
80
|
+
"createdBy": {
|
|
81
|
+
"user": {
|
|
82
|
+
"displayName": null,
|
|
83
|
+
"id": "95e27074-6c4a-447a-aa24-9d718a0b86fa"
|
|
84
|
+
},
|
|
85
|
+
"application": {
|
|
86
|
+
"displayName": null,
|
|
87
|
+
"id": "ebf3b108-5234-4e22-b93d-656d7dae5874"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"container": {
|
|
91
|
+
"containerId": "ebf3b108-5234-4e22-b93d-656d7dae5874",
|
|
92
|
+
"type": "group",
|
|
93
|
+
"url": "https://graph.microsoft.com/v1.0/groups/ebf3b108-5234-4e22-b93d-656d7dae5874"
|
|
94
|
+
},
|
|
95
|
+
"sharedWith": {
|
|
96
|
+
"ebf3b108-5234-4e22-b93d-656d7dae5874": true,
|
|
97
|
+
"6463a5ce-2119-4198-9f2a-628761df4a62": true
|
|
98
|
+
},
|
|
99
|
+
"categoryDescriptions": {
|
|
100
|
+
"category1": null,
|
|
101
|
+
"category2": null,
|
|
102
|
+
"category3": null,
|
|
103
|
+
"category4": null,
|
|
104
|
+
"category5": null,
|
|
105
|
+
"category6": null,
|
|
106
|
+
"category7": null,
|
|
107
|
+
"category8": null,
|
|
108
|
+
"category9": null,
|
|
109
|
+
"category10": null,
|
|
110
|
+
"category11": null,
|
|
111
|
+
"category12": null,
|
|
112
|
+
"category13": null,
|
|
113
|
+
"category14": null,
|
|
114
|
+
"category15": null,
|
|
115
|
+
"category16": null,
|
|
116
|
+
"category17": null,
|
|
117
|
+
"category18": null,
|
|
118
|
+
"category19": null,
|
|
119
|
+
"category20": null,
|
|
120
|
+
"category21": null,
|
|
121
|
+
"category22": null,
|
|
122
|
+
"category23": null,
|
|
123
|
+
"category24": null,
|
|
124
|
+
"category25": null
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
=== "Text"
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
createdDateTime: 2015-03-30T18:36:49.2407981Z
|
|
133
|
+
id : xqQg5FS2LkCp935s-FIFm2QAFkHM
|
|
134
|
+
owner : ebf3b108-5234-4e22-b93d-656d7dae5874
|
|
135
|
+
title : My Planner Plan
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
=== "CSV"
|
|
139
|
+
|
|
140
|
+
```csv
|
|
141
|
+
id,title,createdDateTime,owner
|
|
142
|
+
xqQg5FS2LkCp935s-FIFm2QAFkHM,My Planner Plan,2015-03-30T18:36:49.2407981Z,ebf3b108-5234-4e22-b93d-656d7dae5874
|
|
143
|
+
```
|
|
144
|
+
|