@pnp/cli-microsoft365 10.1.0-beta.6c6be23 → 10.1.0-beta.deac605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/AuthServer.js +1 -1
- package/dist/Command.js +1 -1
- package/dist/cli/cli.js +2 -2
- package/dist/m365/entra/commands/m365group/m365group-add.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-list.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-set.js +1 -1
- package/dist/m365/file/commands/convert/convert-pdf.js +3 -4
- package/dist/m365/file/commands/file-add.js +5 -6
- package/dist/m365/pp/commands/{chatbot/chatbot-get.js → copilot/copilot-get.js} +24 -20
- package/dist/m365/pp/commands/{chatbot/chatbot-list.js → copilot/copilot-list.js} +16 -12
- package/dist/m365/pp/commands/{chatbot/chatbot-remove.js → copilot/copilot-remove.js} +28 -24
- package/dist/m365/pp/commands.js +3 -0
- package/dist/m365/spfx/commands/package/package-generate.js +1 -1
- package/dist/m365/spfx/commands/project/JsonRule.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN016004_TS_property_pane_property_import.js +2 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
- package/dist/m365/spo/commands/file/file-add.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +10 -8
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +1 -2
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +1 -2
- package/dist/m365/spo/commands/page/page-add.js +1 -1
- package/dist/m365/spo/commands/site/site-admin-add.js +4 -12
- package/dist/m365/spo/commands/site/site-admin-list.js +3 -11
- package/dist/m365/spo/commands/site/site-admin-remove.js +4 -12
- package/dist/m365/spo/commands/site/site-set.js +1 -1
- package/dist/m365/spp/commands/model/model-remove.js +105 -0
- package/dist/m365/spp/commands.js +2 -1
- package/dist/m365/teams/commands/user/user-app-list.js +1 -1
- package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -8
- package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -8
- package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -8
- package/dist/m365/todo/commands/list/list-remove.js +2 -1
- package/dist/m365/todo/commands/list/list-set.js +2 -1
- package/dist/m365/todo/commands/task/task-add.js +2 -1
- package/dist/m365/todo/commands/task/task-get.js +2 -1
- package/dist/m365/todo/commands/task/task-list.js +2 -1
- package/dist/m365/todo/commands/task/task-remove.js +2 -1
- package/dist/m365/todo/commands/task/task-set.js +1 -1
- package/dist/utils/formatting.js +8 -20
- package/dist/utils/spo.js +5 -4
- package/dist/utils/spp.js +3 -3
- package/dist/utils/urlUtil.js +11 -14
- package/docs/docs/cmd/pp/{chatbot/chatbot-get.mdx → copilot/copilot-get.mdx} +24 -18
- package/docs/docs/cmd/pp/{chatbot/chatbot-list.mdx → copilot/copilot-list.mdx} +20 -14
- package/docs/docs/cmd/pp/{chatbot/chatbot-remove.mdx → copilot/copilot-remove.mdx} +16 -10
- package/docs/docs/cmd/spp/model/model-remove.mdx +57 -0
- package/npm-shrinkwrap.json +6 -0
- package/package.json +3 -1
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelEnsureCommand_instances, _SpoListItemRetentionLabelEnsureCommand_initTelemetry, _SpoListItemRetentionLabelEnsureCommand_initOptions, _SpoListItemRetentionLabelEnsureCommand_initValidators, _SpoListItemRetentionLabelEnsureCommand_initOptionSets;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
@@ -60,7 +59,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
60
59
|
return label.TagName;
|
|
61
60
|
}
|
|
62
61
|
async getListAbsoluteUrl(options, logger) {
|
|
63
|
-
const parsedUrl =
|
|
62
|
+
const parsedUrl = new URL(options.webUrl);
|
|
64
63
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
65
64
|
if (options.listUrl) {
|
|
66
65
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoListItemRetentionLabelRemoveCommand_instances, _SpoListItemRetentionLabelRemoveCommand_initTelemetry, _SpoListItemRetentionLabelRemoveCommand_initOptions, _SpoListItemRetentionLabelRemoveCommand_initValidators, _SpoListItemRetentionLabelRemoveCommand_initOptionSets;
|
|
7
|
-
import * as url from 'url';
|
|
8
7
|
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -49,7 +48,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
async getListAbsoluteUrl(options, logger) {
|
|
52
|
-
const parsedUrl =
|
|
51
|
+
const parsedUrl = new URL(options.webUrl);
|
|
53
52
|
const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
|
|
54
53
|
if (options.listUrl) {
|
|
55
54
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
@@ -34,7 +34,7 @@ class SpoPageAddCommand extends SpoCommand {
|
|
|
34
34
|
let bannerImageUrl = '';
|
|
35
35
|
let canvasContent1 = '';
|
|
36
36
|
let layoutWebpartsContent = '';
|
|
37
|
-
const pageTitle = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.
|
|
37
|
+
const pageTitle = args.options.title ? args.options.title : (args.options.name.indexOf('.aspx') > -1 ? args.options.name.substring(0, args.options.name.indexOf('.aspx')) : args.options.name);
|
|
38
38
|
let pageId = null;
|
|
39
39
|
const pageDescription = args.options.description || "";
|
|
40
40
|
if (!pageName.endsWith('.aspx')) {
|
|
@@ -47,22 +47,14 @@ class SpoSiteAdminAddCommand extends SpoCommand {
|
|
|
47
47
|
await logger.logToStderr('Adding site administrator as an administrator...');
|
|
48
48
|
}
|
|
49
49
|
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
50
|
-
const
|
|
51
|
-
const siteAdmins = (await this.getSiteAdmins(adminUrl,
|
|
50
|
+
const tenantSiteProperties = await spo.getSiteAdminPropertiesByUrl(args.options.siteUrl, false, logger, this.verbose);
|
|
51
|
+
const siteAdmins = (await this.getSiteAdmins(adminUrl, tenantSiteProperties.SiteId)).map(u => u.loginName);
|
|
52
52
|
siteAdmins.push(loginNameToAdd);
|
|
53
|
-
await this.setSiteAdminsAsAdmin(adminUrl,
|
|
53
|
+
await this.setSiteAdminsAsAdmin(adminUrl, tenantSiteProperties.SiteId, siteAdmins);
|
|
54
54
|
if (args.options.primary) {
|
|
55
|
-
await this.setPrimaryAdminAsAdmin(adminUrl,
|
|
55
|
+
await this.setPrimaryAdminAsAdmin(adminUrl, tenantSiteProperties.SiteId, loginNameToAdd);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async getSiteIdBasedOnUrl(siteUrl, logger) {
|
|
59
|
-
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
60
|
-
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
61
|
-
if (!match) {
|
|
62
|
-
throw `Site with URL ${siteUrl} not found`;
|
|
63
|
-
}
|
|
64
|
-
return match[1];
|
|
65
|
-
}
|
|
66
58
|
async getSiteAdmins(adminUrl, siteId) {
|
|
67
59
|
const requestOptions = {
|
|
68
60
|
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${siteId}'`,
|
|
@@ -45,16 +45,16 @@ class SpoSiteAdminListCommand extends SpoCommand {
|
|
|
45
45
|
await logger.logToStderr('Retrieving site administrators as an administrator...');
|
|
46
46
|
}
|
|
47
47
|
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
48
|
-
const
|
|
48
|
+
const tenantSiteProperties = await spo.getSiteAdminPropertiesByUrl(args.options.siteUrl, false, logger, this.verbose);
|
|
49
49
|
const requestOptions = {
|
|
50
|
-
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${
|
|
50
|
+
url: `${adminUrl}/_api/SPO.Tenant/GetSiteAdministrators?siteId='${tenantSiteProperties.SiteId}'`,
|
|
51
51
|
headers: {
|
|
52
52
|
accept: 'application/json;odata=nometadata'
|
|
53
53
|
},
|
|
54
54
|
responseType: 'json'
|
|
55
55
|
};
|
|
56
56
|
const response = await request.post(requestOptions);
|
|
57
|
-
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl,
|
|
57
|
+
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl, tenantSiteProperties.SiteId, logger, this.verbose);
|
|
58
58
|
const mappedResult = response.value.map((u) => ({
|
|
59
59
|
Email: u.email,
|
|
60
60
|
LoginName: u.loginName,
|
|
@@ -63,14 +63,6 @@ class SpoSiteAdminListCommand extends SpoCommand {
|
|
|
63
63
|
}));
|
|
64
64
|
await logger.log(mappedResult);
|
|
65
65
|
}
|
|
66
|
-
async getSiteId(siteUrl, logger) {
|
|
67
|
-
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
68
|
-
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
69
|
-
if (!match) {
|
|
70
|
-
throw `Site with URL ${siteUrl} not found`;
|
|
71
|
-
}
|
|
72
|
-
return match[1];
|
|
73
|
-
}
|
|
74
66
|
async callAction(logger, args) {
|
|
75
67
|
if (this.verbose) {
|
|
76
68
|
await logger.logToStderr('Retrieving site administrators...');
|
|
@@ -54,22 +54,14 @@ class SpoSiteAdminRemoveCommand extends SpoCommand {
|
|
|
54
54
|
await logger.logToStderr('Removing site administrator as an administrator...');
|
|
55
55
|
}
|
|
56
56
|
const adminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
57
|
-
const
|
|
58
|
-
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl,
|
|
57
|
+
const tenantSiteProperties = await spo.getSiteAdminPropertiesByUrl(args.options.siteUrl, false, logger, this.verbose);
|
|
58
|
+
const primaryAdminLoginName = await spo.getPrimaryAdminLoginNameAsAdmin(adminUrl, tenantSiteProperties.SiteId, logger, this.verbose);
|
|
59
59
|
if (loginNameToRemove === primaryAdminLoginName) {
|
|
60
60
|
throw 'You cannot remove the primary site collection administrator.';
|
|
61
61
|
}
|
|
62
|
-
const existingAdmins = await this.getSiteAdmins(adminUrl,
|
|
62
|
+
const existingAdmins = await this.getSiteAdmins(adminUrl, tenantSiteProperties.SiteId);
|
|
63
63
|
const adminsToSet = existingAdmins.filter(u => u.loginName.toLowerCase() !== loginNameToRemove.toLowerCase());
|
|
64
|
-
await this.setSiteAdminsAsAdmin(adminUrl,
|
|
65
|
-
}
|
|
66
|
-
async getSiteId(siteUrl, logger) {
|
|
67
|
-
const siteGraphId = await spo.getSiteId(siteUrl, logger, this.verbose);
|
|
68
|
-
const match = siteGraphId.match(/,([a-f0-9\-]{36}),/i);
|
|
69
|
-
if (!match) {
|
|
70
|
-
throw `Site with URL ${siteUrl} not found`;
|
|
71
|
-
}
|
|
72
|
-
return match[1];
|
|
64
|
+
await this.setSiteAdminsAsAdmin(adminUrl, tenantSiteProperties.SiteId, adminsToSet);
|
|
73
65
|
}
|
|
74
66
|
async getSiteAdmins(adminUrl, siteId) {
|
|
75
67
|
const requestOptions = {
|
|
@@ -373,7 +373,7 @@ class SpoSiteSetCommand extends SpoCommand {
|
|
|
373
373
|
headers: {
|
|
374
374
|
'X-RequestDigest': this.context.FormDigestValue
|
|
375
375
|
},
|
|
376
|
-
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${this.tenantId.
|
|
376
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${this.tenantId.substring(pos, this.tenantId.indexOf('&'))}
SiteProperties
${formatting.encodeQueryParameter(args.options.url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
|
|
377
377
|
};
|
|
378
378
|
response = await request.post(requestOptions);
|
|
379
379
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 _SppModelRemoveCommand_instances, _SppModelRemoveCommand_initTelemetry, _SppModelRemoveCommand_initOptions, _SppModelRemoveCommand_initValidators, _SppModelRemoveCommand_initOptionSets, _SppModelRemoveCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { spp } from '../../../../utils/spp.js';
|
|
11
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
12
|
+
import { validation } from '../../../../utils/validation.js';
|
|
13
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
|
+
import commands from '../../commands.js';
|
|
15
|
+
class SppModelRemoveCommand extends SpoCommand {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands.MODEL_REMOVE;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'Deletes a document understanding model';
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SppModelRemoveCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SppModelRemoveCommand_instances, "m", _SppModelRemoveCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SppModelRemoveCommand_instances, "m", _SppModelRemoveCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SppModelRemoveCommand_instances, "m", _SppModelRemoveCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SppModelRemoveCommand_instances, "m", _SppModelRemoveCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SppModelRemoveCommand_instances, "m", _SppModelRemoveCommand_initTypes).call(this);
|
|
30
|
+
}
|
|
31
|
+
async commandAction(logger, args) {
|
|
32
|
+
try {
|
|
33
|
+
if (!args.options.force) {
|
|
34
|
+
const confirmationResult = await cli.promptForConfirmation({ message: `Are you sure you want to remove model '${args.options.title ?? args.options.id}'?` });
|
|
35
|
+
if (!confirmationResult) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (this.verbose) {
|
|
40
|
+
await logger.log(`Removing model from ${args.options.siteUrl}...`);
|
|
41
|
+
}
|
|
42
|
+
const siteUrl = urlUtil.removeTrailingSlashes(args.options.siteUrl);
|
|
43
|
+
await spp.assertSiteIsContentCenter(siteUrl);
|
|
44
|
+
let requestUrl = `${siteUrl}/_api/machinelearning/models/`;
|
|
45
|
+
if (args.options.title) {
|
|
46
|
+
let requestTitle = args.options.title.toLowerCase();
|
|
47
|
+
if (!requestTitle.endsWith('.classifier')) {
|
|
48
|
+
requestTitle += '.classifier';
|
|
49
|
+
}
|
|
50
|
+
requestUrl += `getbytitle('${formatting.encodeQueryParameter(requestTitle)}')`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
requestUrl += `getbyuniqueid('${args.options.id}')`;
|
|
54
|
+
}
|
|
55
|
+
const requestOptions = {
|
|
56
|
+
url: requestUrl,
|
|
57
|
+
headers: {
|
|
58
|
+
accept: 'application/json;odata=nometadata',
|
|
59
|
+
'if-match': '*'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
const result = await request.delete(requestOptions);
|
|
64
|
+
if (result?.['odata.null'] === true) {
|
|
65
|
+
throw "Model not found.";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
this.handleRejectedODataJsonPromise(err);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_SppModelRemoveCommand_instances = new WeakSet(), _SppModelRemoveCommand_initTelemetry = function _SppModelRemoveCommand_initTelemetry() {
|
|
74
|
+
this.telemetry.push((args) => {
|
|
75
|
+
Object.assign(this.telemetryProperties, {
|
|
76
|
+
id: typeof args.options.id !== 'undefined',
|
|
77
|
+
title: typeof args.options.title !== 'undefined',
|
|
78
|
+
force: !!args.options.force
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}, _SppModelRemoveCommand_initOptions = function _SppModelRemoveCommand_initOptions() {
|
|
82
|
+
this.options.unshift({
|
|
83
|
+
option: '-u, --siteUrl <siteUrl>'
|
|
84
|
+
}, {
|
|
85
|
+
option: '-i, --id [id]'
|
|
86
|
+
}, {
|
|
87
|
+
option: '-t, --title [title]'
|
|
88
|
+
}, {
|
|
89
|
+
option: '-f, --force'
|
|
90
|
+
});
|
|
91
|
+
}, _SppModelRemoveCommand_initValidators = function _SppModelRemoveCommand_initValidators() {
|
|
92
|
+
this.validators.push(async (args) => {
|
|
93
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
94
|
+
return `${args.options.id} is not a valid GUID for option 'id'.`;
|
|
95
|
+
}
|
|
96
|
+
return validation.isValidSharePointUrl(args.options.siteUrl);
|
|
97
|
+
});
|
|
98
|
+
}, _SppModelRemoveCommand_initOptionSets = function _SppModelRemoveCommand_initOptionSets() {
|
|
99
|
+
this.optionSets.push({ options: ['id', 'title'] });
|
|
100
|
+
}, _SppModelRemoveCommand_initTypes = function _SppModelRemoveCommand_initTypes() {
|
|
101
|
+
this.types.string.push('siteUrl', 'id', 'title');
|
|
102
|
+
this.types.boolean.push('force');
|
|
103
|
+
};
|
|
104
|
+
export default new SppModelRemoveCommand();
|
|
105
|
+
//# sourceMappingURL=model-remove.js.map
|
|
@@ -33,7 +33,7 @@ class TeamsUserAppListCommand extends GraphCommand {
|
|
|
33
33
|
const items = await odata.getAllItems(endpoint);
|
|
34
34
|
items.forEach(i => {
|
|
35
35
|
const userAppId = Buffer.from(i.id, 'base64').toString('ascii');
|
|
36
|
-
const appId = userAppId.
|
|
36
|
+
const appId = userAppId.substring(userAppId.indexOf("##") + 2, userAppId.length);
|
|
37
37
|
i.appId = appId;
|
|
38
38
|
});
|
|
39
39
|
if (!cli.shouldTrimOutput(args.options.output)) {
|
|
@@ -27,12 +27,11 @@ class TenantReportOffice365ActivationCountsCommand extends GraphCommand {
|
|
|
27
27
|
try {
|
|
28
28
|
const res = await request.get(requestOptions);
|
|
29
29
|
let content = '';
|
|
30
|
-
const cleanResponse = this.removeEmptyLines(res);
|
|
31
30
|
if (output && output.toLowerCase() === 'json') {
|
|
32
|
-
content = formatting.parseCsvToJson(
|
|
31
|
+
content = formatting.parseCsvToJson(res);
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
|
-
content =
|
|
34
|
+
content = res;
|
|
36
35
|
}
|
|
37
36
|
await logger.log(content);
|
|
38
37
|
}
|
|
@@ -40,11 +39,6 @@ class TenantReportOffice365ActivationCountsCommand extends GraphCommand {
|
|
|
40
39
|
this.handleRejectedODataJsonPromise(err);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
removeEmptyLines(input) {
|
|
44
|
-
const rows = input.split('\n');
|
|
45
|
-
const cleanRows = rows.filter(Boolean);
|
|
46
|
-
return cleanRows.join('\n');
|
|
47
|
-
}
|
|
48
42
|
}
|
|
49
43
|
export default new TenantReportOffice365ActivationCountsCommand();
|
|
50
44
|
//# sourceMappingURL=report-office365activationcounts.js.map
|
|
@@ -27,12 +27,11 @@ class TenantReportOffice365ActivationsUserCountsCommand extends GraphCommand {
|
|
|
27
27
|
try {
|
|
28
28
|
const res = await request.get(requestOptions);
|
|
29
29
|
let content = '';
|
|
30
|
-
const cleanResponse = this.removeEmptyLines(res);
|
|
31
30
|
if (output && output.toLowerCase() === 'json') {
|
|
32
|
-
content = formatting.parseCsvToJson(
|
|
31
|
+
content = formatting.parseCsvToJson(res);
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
|
-
content =
|
|
34
|
+
content = res;
|
|
36
35
|
}
|
|
37
36
|
await logger.log(content);
|
|
38
37
|
}
|
|
@@ -40,11 +39,6 @@ class TenantReportOffice365ActivationsUserCountsCommand extends GraphCommand {
|
|
|
40
39
|
this.handleRejectedODataJsonPromise(err);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
removeEmptyLines(input) {
|
|
44
|
-
const rows = input.split('\n');
|
|
45
|
-
const cleanRows = rows.filter(Boolean);
|
|
46
|
-
return cleanRows.join('\n');
|
|
47
|
-
}
|
|
48
42
|
}
|
|
49
43
|
export default new TenantReportOffice365ActivationsUserCountsCommand();
|
|
50
44
|
//# sourceMappingURL=report-office365activationsusercounts.js.map
|
|
@@ -27,12 +27,11 @@ class TenantReportOffice365ActivationsUserDetailCommand extends GraphCommand {
|
|
|
27
27
|
try {
|
|
28
28
|
const res = await request.get(requestOptions);
|
|
29
29
|
let content = '';
|
|
30
|
-
const cleanResponse = this.removeEmptyLines(res);
|
|
31
30
|
if (output && output.toLowerCase() === 'json') {
|
|
32
|
-
content = formatting.parseCsvToJson(
|
|
31
|
+
content = formatting.parseCsvToJson(res);
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
|
-
content =
|
|
34
|
+
content = res;
|
|
36
35
|
}
|
|
37
36
|
await logger.log(content);
|
|
38
37
|
}
|
|
@@ -40,11 +39,6 @@ class TenantReportOffice365ActivationsUserDetailCommand extends GraphCommand {
|
|
|
40
39
|
this.handleRejectedODataJsonPromise(err);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
removeEmptyLines(input) {
|
|
44
|
-
const rows = input.split('\n');
|
|
45
|
-
const cleanRows = rows.filter(Boolean);
|
|
46
|
-
return cleanRows.join('\n');
|
|
47
|
-
}
|
|
48
42
|
}
|
|
49
43
|
export default new TenantReportOffice365ActivationsUserDetailCommand();
|
|
50
44
|
//# sourceMappingURL=report-office365activationsuserdetail.js.map
|
|
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _TodoListRemoveCommand_instances, _TodoListRemoveCommand_initTelemetry, _TodoListRemoveCommand_initOptions, _TodoListRemoveCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
11
12
|
class TodoListRemoveCommand extends DelegatedGraphCommand {
|
|
@@ -38,7 +39,7 @@ class TodoListRemoveCommand extends DelegatedGraphCommand {
|
|
|
38
39
|
return args.options.id;
|
|
39
40
|
}
|
|
40
41
|
const requestOptions = {
|
|
41
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
42
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name)}'`,
|
|
42
43
|
headers: {
|
|
43
44
|
accept: "application/json;odata.metadata=none"
|
|
44
45
|
},
|
|
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _TodoListSetCommand_instances, _TodoListSetCommand_initTelemetry, _TodoListSetCommand_initOptions, _TodoListSetCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
9
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
9
10
|
import commands from '../../commands.js';
|
|
10
11
|
class TodoListSetCommand extends DelegatedGraphCommand {
|
|
@@ -52,7 +53,7 @@ class TodoListSetCommand extends DelegatedGraphCommand {
|
|
|
52
53
|
return args.options.id;
|
|
53
54
|
}
|
|
54
55
|
const requestOptions = {
|
|
55
|
-
url: `${endpoint}/me/todo/lists?$filter=displayName eq '${
|
|
56
|
+
url: `${endpoint}/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.name)}'`,
|
|
56
57
|
headers: {
|
|
57
58
|
accept: "application/json;odata.metadata=none"
|
|
58
59
|
},
|
|
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _TodoTaskAddCommand_instances, _a, _TodoTaskAddCommand_initTelemetry, _TodoTaskAddCommand_initOptions, _TodoTaskAddCommand_initValidators, _TodoTaskAddCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
9
|
import { validation } from '../../../../utils/validation.js';
|
|
9
10
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
@@ -71,7 +72,7 @@ class TodoTaskAddCommand extends DelegatedGraphCommand {
|
|
|
71
72
|
return args.options.listId;
|
|
72
73
|
}
|
|
73
74
|
const requestOptions = {
|
|
74
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
75
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.listName)}'`,
|
|
75
76
|
headers: {
|
|
76
77
|
accept: 'application/json;odata.metadata=none'
|
|
77
78
|
},
|
|
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _TodoTaskGetCommand_instances, _TodoTaskGetCommand_initTelemetry, _TodoTaskGetCommand_initOptions, _TodoTaskGetCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
11
12
|
class TodoTaskGetCommand extends DelegatedGraphCommand {
|
|
@@ -30,7 +31,7 @@ class TodoTaskGetCommand extends DelegatedGraphCommand {
|
|
|
30
31
|
return args.options.listId;
|
|
31
32
|
}
|
|
32
33
|
const requestOptions = {
|
|
33
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
34
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.listName)}'`,
|
|
34
35
|
headers: {
|
|
35
36
|
accept: 'application/json;odata.metadata=none'
|
|
36
37
|
},
|
|
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _TodoTaskListCommand_instances, _TodoTaskListCommand_initTelemetry, _TodoTaskListCommand_initOptions, _TodoTaskListCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import { odata } from '../../../../utils/odata.js';
|
|
10
11
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
11
12
|
import commands from '../../commands.js';
|
|
@@ -31,7 +32,7 @@ class TodoTaskListCommand extends DelegatedGraphCommand {
|
|
|
31
32
|
return args.options.listId;
|
|
32
33
|
}
|
|
33
34
|
const requestOptions = {
|
|
34
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
35
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(args.options.listName)}'`,
|
|
35
36
|
headers: {
|
|
36
37
|
accept: 'application/json;odata.metadata=none'
|
|
37
38
|
},
|
|
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _TodoTaskRemoveCommand_instances, _TodoTaskRemoveCommand_initTelemetry, _TodoTaskRemoveCommand_initOptions, _TodoTaskRemoveCommand_initOptionSets;
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import DelegatedGraphCommand from '../../../base/DelegatedGraphCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
11
12
|
class TodoTaskRemoveCommand extends DelegatedGraphCommand {
|
|
@@ -37,7 +38,7 @@ class TodoTaskRemoveCommand extends DelegatedGraphCommand {
|
|
|
37
38
|
if (options.listName) {
|
|
38
39
|
// Search list by its name
|
|
39
40
|
const requestOptions = {
|
|
40
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
41
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(options.listName)}'`,
|
|
41
42
|
headers: {
|
|
42
43
|
accept: "application/json;odata.metadata=none"
|
|
43
44
|
},
|
|
@@ -50,7 +50,7 @@ class TodoTaskSetCommand extends DelegatedGraphCommand {
|
|
|
50
50
|
return options.listId;
|
|
51
51
|
}
|
|
52
52
|
const requestOptions = {
|
|
53
|
-
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${
|
|
53
|
+
url: `${this.resource}/v1.0/me/todo/lists?$filter=displayName eq '${formatting.encodeQueryParameter(options.listName)}'`,
|
|
54
54
|
headers: {
|
|
55
55
|
accept: 'application/json;odata.metadata=none'
|
|
56
56
|
},
|
package/dist/utils/formatting.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parse } from 'csv-parse/sync';
|
|
1
2
|
import chalk from 'chalk';
|
|
2
3
|
import stripJsonComments from 'strip-json-comments';
|
|
3
4
|
import { BasePermissions } from '../m365/spo/base-permissions.js';
|
|
@@ -75,26 +76,13 @@ export const formatting = {
|
|
|
75
76
|
return response;
|
|
76
77
|
},
|
|
77
78
|
parseCsvToJson(s, quoteChar = '"', delimiter = ',') {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.map(line => {
|
|
86
|
-
const lineMatch = match(line);
|
|
87
|
-
const obj = {};
|
|
88
|
-
heads.forEach((key, index) => {
|
|
89
|
-
const value = parseInt(lineMatch[index]);
|
|
90
|
-
if (isNaN(value) || value.toString() !== lineMatch[index]) {
|
|
91
|
-
obj[key] = lineMatch[index];
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
obj[key] = parseInt(lineMatch[index]);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return obj;
|
|
79
|
+
return parse(s, {
|
|
80
|
+
quote: quoteChar,
|
|
81
|
+
delimiter: delimiter,
|
|
82
|
+
columns: true,
|
|
83
|
+
skipEmptyLines: true,
|
|
84
|
+
ltrim: true,
|
|
85
|
+
cast: true
|
|
98
86
|
});
|
|
99
87
|
},
|
|
100
88
|
encodeQueryParameter(value) {
|
package/dist/utils/spo.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
|
-
import url from 'url';
|
|
3
2
|
import { urlUtil } from "./urlUtil.js";
|
|
4
3
|
import { validation } from "./validation.js";
|
|
5
4
|
import auth from '../Auth.js';
|
|
@@ -200,8 +199,10 @@ export const spo = {
|
|
|
200
199
|
* @param siteAccessToken a valid access token for the site specified in the webFullUrl param
|
|
201
200
|
*/
|
|
202
201
|
async ensureFolder(webFullUrl, folderToEnsure, logger, debug) {
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
try {
|
|
203
|
+
new URL(webFullUrl);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
205
206
|
throw new Error('webFullUrl is not a valid URL');
|
|
206
207
|
}
|
|
207
208
|
if (!folderToEnsure) {
|
|
@@ -1060,7 +1061,7 @@ export const spo = {
|
|
|
1060
1061
|
headers: {
|
|
1061
1062
|
'X-RequestDigest': context.FormDigestValue
|
|
1062
1063
|
},
|
|
1063
|
-
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${tenantId.
|
|
1064
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${tenantId.substring(pos, tenantId.indexOf('&'))}
SiteProperties
${formatting.encodeQueryParameter(url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
|
|
1064
1065
|
};
|
|
1065
1066
|
const res = await request.post(requestOptionsUpdateProperties);
|
|
1066
1067
|
const json = JSON.parse(res);
|
package/dist/utils/spp.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import request from '../request.js';
|
|
2
2
|
export const spp = {
|
|
3
3
|
/**
|
|
4
|
-
* Asserts whether the specified site is a content center
|
|
5
|
-
* @param siteUrl The URL of the site to check
|
|
6
|
-
* @throws
|
|
4
|
+
* Asserts whether the specified site is a content center
|
|
5
|
+
* @param siteUrl The URL of the site to check
|
|
6
|
+
* @throws error when site is not a content center.
|
|
7
7
|
*/
|
|
8
8
|
async assertSiteIsContentCenter(siteUrl) {
|
|
9
9
|
const requestOptions = {
|
package/dist/utils/urlUtil.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import url from 'url';
|
|
2
1
|
export const urlUtil = {
|
|
3
2
|
/**
|
|
4
3
|
* Returns server relative path.
|
|
@@ -15,12 +14,7 @@ export const urlUtil = {
|
|
|
15
14
|
* urlUtil.getServerRelativePath("/sites/team1/", "/Shared Documents");
|
|
16
15
|
*/
|
|
17
16
|
getServerRelativePath(webUrl, folderRelativePath) {
|
|
18
|
-
|
|
19
|
-
// if webUrl is a server-relative URL then tenantUrl will resolve to null//null
|
|
20
|
-
// in which case we should keep webUrl
|
|
21
|
-
let webRelativePath = tenantUrl !== 'null//null' ? webUrl.substr(tenantUrl.length) : webUrl;
|
|
22
|
-
// will be used to remove relative path from the folderRelativePath
|
|
23
|
-
// in case the web relative url is included
|
|
17
|
+
let webRelativePath = this.getUrlRelativePath(webUrl);
|
|
24
18
|
let relativePathToRemove = webRelativePath;
|
|
25
19
|
// add '/' at 0
|
|
26
20
|
if (webRelativePath[0] !== '/') {
|
|
@@ -90,11 +84,8 @@ export const urlUtil = {
|
|
|
90
84
|
* Utils.getWebRelativePath("/sites/team1/", "/sites/team1/Shared Documents");
|
|
91
85
|
*/
|
|
92
86
|
getWebRelativePath(webUrl, folderUrl) {
|
|
87
|
+
let webRelativePath = this.getUrlRelativePath(webUrl);
|
|
93
88
|
let folderWebRelativePath = '';
|
|
94
|
-
const tenantUrl = `${url.parse(webUrl).protocol}//${url.parse(webUrl).hostname}`;
|
|
95
|
-
// if webUrl is a server-relative URL then tenantUrl will resolve to null//null
|
|
96
|
-
// in which case we should keep webUrl
|
|
97
|
-
let webRelativePath = tenantUrl !== 'null//null' ? webUrl.substr(tenantUrl.length) : webUrl;
|
|
98
89
|
// will be used to remove relative path from the folderRelativePath
|
|
99
90
|
// in case the web relative url is included
|
|
100
91
|
let relativePathToRemove = webRelativePath;
|
|
@@ -140,12 +131,11 @@ export const urlUtil = {
|
|
|
140
131
|
* urlUtil.getAbsoluteUrl("https://contoso.sharepoint.com/sites/team1/", "/sites/team1/Lists/MyList");
|
|
141
132
|
*/
|
|
142
133
|
getAbsoluteUrl(webUrl, serverRelativeUrl) {
|
|
143
|
-
const
|
|
144
|
-
const tenantUrl = `${uri.protocol}//${uri.hostname}`;
|
|
134
|
+
const parsedUrl = new URL(webUrl);
|
|
145
135
|
if (serverRelativeUrl[0] !== '/') {
|
|
146
136
|
serverRelativeUrl = `/${serverRelativeUrl}`;
|
|
147
137
|
}
|
|
148
|
-
return `${
|
|
138
|
+
return `${parsedUrl.origin}${serverRelativeUrl}`;
|
|
149
139
|
},
|
|
150
140
|
/**
|
|
151
141
|
* Combines base and relative url considering any missing slashes
|
|
@@ -213,6 +203,13 @@ export const urlUtil = {
|
|
|
213
203
|
*/
|
|
214
204
|
removeTrailingSlashes(url) {
|
|
215
205
|
return url.replace(/\/+$/, '');
|
|
206
|
+
},
|
|
207
|
+
getUrlRelativePath(url) {
|
|
208
|
+
if (url.includes('://')) {
|
|
209
|
+
const parsedUrl = new URL(url);
|
|
210
|
+
return url.substring(parsedUrl.origin.length);
|
|
211
|
+
}
|
|
212
|
+
return url;
|
|
216
213
|
}
|
|
217
214
|
};
|
|
218
215
|
//# sourceMappingURL=urlUtil.js.map
|