@pnp/cli-microsoft365 11.12.0-beta.8589b73 → 12.0.0-beta.e4f7675
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/m365/spfx/commands/project/DeployWorkflow.js +7 -15
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +30 -2
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -2
- package/dist/m365/spo/commands/cdn/cdn-get.js +8 -35
- package/dist/m365/spo/commands/cdn/cdn-origin-add.js +9 -36
- package/dist/m365/spo/commands/cdn/cdn-origin-list.js +8 -34
- package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +10 -39
- package/dist/m365/spo/commands/cdn/cdn-policy-list.js +8 -34
- package/dist/m365/spo/commands/cdn/cdn-policy-set.js +10 -45
- package/dist/m365/spo/commands/cdn/cdn-set.js +10 -46
- package/dist/m365/spo/commands/contenttype/contenttype-sync.js +12 -24
- package/dist/m365/spo/commands/file/file-add.js +2 -6
- package/dist/m365/spo/commands/listitem/listitem-get.js +15 -7
- package/dist/m365/spo/commands/page/page-header-set.js +123 -64
- package/dist/m365/spo/commands/site/site-list.js +60 -49
- package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
- package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
- package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
- package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
- package/dist/m365/teams/commands/channel/channel-list.js +2 -6
- package/dist/m365/teams/commands/channel/channel-member-add.js +2 -6
- package/dist/m365/teams/commands/channel/channel-member-list.js +2 -6
- package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -6
- package/dist/m365/teams/commands/channel/channel-member-set.js +2 -6
- package/dist/m365/teams/commands/channel/channel-remove.js +2 -8
- package/dist/m365/teams/commands/channel/channel-set.js +2 -8
- package/dist/m365/teams/commands/tab/tab-get.js +2 -6
- package/dist/m365/teams/commands/team/team-archive.js +2 -6
- package/dist/m365/teams/commands/team/team-remove.js +2 -6
- package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
- package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +4 -4
- package/docs/docs/cmd/spo/file/file-add.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-checkin.mdx +21 -0
- package/docs/docs/cmd/spo/file/file-checkout.mdx +21 -0
- package/docs/docs/cmd/spo/file/file-copy.mdx +19 -0
- package/docs/docs/cmd/spo/file/file-get.mdx +19 -0
- package/docs/docs/cmd/spo/file/file-list.mdx +19 -0
- package/docs/docs/cmd/spo/file/file-move.mdx +19 -0
- package/docs/docs/cmd/spo/file/file-remove.mdx +21 -0
- package/docs/docs/cmd/spo/file/file-rename.mdx +19 -0
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-add.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-contenttype-add.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-contenttype-default-set.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-defaultvalue-clear.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-defaultvalue-list.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-defaultvalue-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-defaultvalue-set.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-get.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-list.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-retentionlabel-get.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-retentionlabel-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +23 -0
- package/docs/docs/cmd/spo/list/list-set.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-sitescript-get.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-view-add.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-view-field-add.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-view-field-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-view-field-set.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-view-get.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-view-list.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-view-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-view-set.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-add.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-get.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-list.mdx +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-remove.mdx +21 -0
- package/docs/docs/cmd/spo/list/list-webhook-set.mdx +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-get.mdx +13 -7
- package/docs/docs/cmd/spo/page/page-header-set.mdx +9 -9
- package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
- package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
- package/docs/docs/cmd/tenant/id/id-get.mdx +15 -0
- package/docs/docs/cmd/tenant/info/info-get.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-pronouns-get.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-pronouns-set.mdx +19 -0
- package/docs/docs/cmd/tenant/report/report-settings-get.mdx +19 -0
- package/docs/docs/cmd/tenant/report/report-settings-set.mdx +21 -0
- package/docs/docs/cmd/tenant/security/security-alerts-list.mdx +19 -0
- package/npm-shrinkwrap.json +1103 -1157
- package/package.json +17 -17
|
@@ -9,7 +9,6 @@ import request from '../../../../request.js';
|
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
10
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
-
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
13
12
|
import { odata } from '../../../../utils/odata.js';
|
|
14
13
|
import { spo } from '../../../../utils/spo.js';
|
|
15
14
|
class SpoContentTypeSyncCommand extends SpoCommand {
|
|
@@ -31,11 +30,16 @@ class SpoContentTypeSyncCommand extends SpoCommand {
|
|
|
31
30
|
async commandAction(logger, args) {
|
|
32
31
|
const { listId, listTitle, listUrl, webUrl } = args.options;
|
|
33
32
|
const url = new URL(webUrl);
|
|
34
|
-
const baseUrl =
|
|
33
|
+
const baseUrl = `${url.origin}/_api/v2.0/sites/`;
|
|
35
34
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const [siteId, webId] = await Promise.all([
|
|
36
|
+
spo.getSiteIdBySPApi(webUrl, logger, this.verbose),
|
|
37
|
+
spo.getWebId(webUrl, logger, this.verbose)
|
|
38
|
+
]);
|
|
39
|
+
const siteUrl = `${url.host},${siteId},${webId}`;
|
|
40
|
+
const targetListId = listId || (listTitle || listUrl ? await spo.getListId(webUrl, listTitle, listUrl, logger, this.verbose) : undefined);
|
|
41
|
+
const listPath = targetListId ? `/lists/${targetListId}` : '';
|
|
42
|
+
const contentTypeId = await this.getContentTypeId(webUrl, args.options, logger);
|
|
39
43
|
if (this.verbose) {
|
|
40
44
|
await logger.logToStderr(`Adding or syncing the content type...`);
|
|
41
45
|
}
|
|
@@ -60,34 +64,18 @@ class SpoContentTypeSyncCommand extends SpoCommand {
|
|
|
60
64
|
this.handleRejectedODataJsonPromise(err);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
async getContentTypeId(
|
|
67
|
+
async getContentTypeId(webUrl, options, logger) {
|
|
64
68
|
if (options.id) {
|
|
65
69
|
return options.id;
|
|
66
70
|
}
|
|
67
|
-
const siteId = await spo.getSiteIdByMSGraph(`${url.origin}/sites/contenttypehub`, logger, this.verbose);
|
|
68
71
|
if (this.verbose) {
|
|
69
72
|
await logger.logToStderr(`Retrieving content type Id by name...`);
|
|
70
73
|
}
|
|
71
|
-
const contentTypes = await odata.getAllItems(`${
|
|
74
|
+
const contentTypes = await odata.getAllItems(`${webUrl}/_api/web/AvailableContentTypes?$filter=Name eq '${formatting.encodeQueryParameter(options.name)}'&$select=StringId,Name`);
|
|
72
75
|
if (contentTypes.length === 0) {
|
|
73
76
|
throw `Content type with name ${options.name} not found.`;
|
|
74
77
|
}
|
|
75
|
-
return contentTypes[0].
|
|
76
|
-
}
|
|
77
|
-
async getListIdByUrl(webUrl, listUrl, logger) {
|
|
78
|
-
if (this.verbose) {
|
|
79
|
-
await logger.logToStderr(`Retrieving list id to sync the content type to...`);
|
|
80
|
-
}
|
|
81
|
-
const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
|
|
82
|
-
const requestOptions = {
|
|
83
|
-
url: `${webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=id`,
|
|
84
|
-
headers: {
|
|
85
|
-
'accept': 'application/json;odata=nometadata'
|
|
86
|
-
},
|
|
87
|
-
responseType: 'json'
|
|
88
|
-
};
|
|
89
|
-
const response = await request.get(requestOptions);
|
|
90
|
-
return response.Id;
|
|
78
|
+
return contentTypes[0].StringId;
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
81
|
_SpoContentTypeSyncCommand_instances = new WeakSet(), _SpoContentTypeSyncCommand_initTelemetry = function _SpoContentTypeSyncCommand_initTelemetry() {
|
|
@@ -45,11 +45,8 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
45
45
|
await logger.logToStderr(`file name: ${fileName}...`);
|
|
46
46
|
await logger.logToStderr(`folder path: ${folderPath}...`);
|
|
47
47
|
}
|
|
48
|
-
if (args.options.overwrite === undefined) {
|
|
49
|
-
await this.warn(logger, 'In the next major version, the --overwrite option will default to false. To avoid this warning, please set the --overwrite option explicitly to true or false.');
|
|
50
|
-
}
|
|
51
48
|
try {
|
|
52
|
-
if (args.options.overwrite
|
|
49
|
+
if (!args.options.overwrite) {
|
|
53
50
|
try {
|
|
54
51
|
const requestOptions = {
|
|
55
52
|
url: `${args.options.webUrl}/_api/Web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath + '/' + fileName)}')?$select=Exists`,
|
|
@@ -491,8 +488,7 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
|
|
|
491
488
|
}, {
|
|
492
489
|
option: '--publishComment [publishComment]'
|
|
493
490
|
}, {
|
|
494
|
-
option: '--overwrite
|
|
495
|
-
autocomplete: ['true', 'false']
|
|
491
|
+
option: '--overwrite'
|
|
496
492
|
}, {
|
|
497
493
|
option: '--fileName [fileName]'
|
|
498
494
|
});
|
|
@@ -30,6 +30,12 @@ class SpoListItemGetCommand extends SpoCommand {
|
|
|
30
30
|
__classPrivateFieldGet(this, _SpoListItemGetCommand_instances, "m", _SpoListItemGetCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async commandAction(logger, args) {
|
|
33
|
+
if (args.options.properties) {
|
|
34
|
+
await this.warn(logger, `Option 'properties' is deprecated. Please use 'fields' instead.`);
|
|
35
|
+
if (!args.options.fields) {
|
|
36
|
+
args.options.fields = args.options.properties;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
34
40
|
if (args.options.listId) {
|
|
35
41
|
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
@@ -41,11 +47,11 @@ class SpoListItemGetCommand extends SpoCommand {
|
|
|
41
47
|
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
42
48
|
requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
43
49
|
}
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const fieldExpand =
|
|
50
|
+
const fieldsSelect = args.options.fields ? args.options.fields.split(',') : [];
|
|
51
|
+
const fieldsWithSlash = fieldsSelect.filter(item => item.includes('/'));
|
|
52
|
+
const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
|
|
53
|
+
const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
|
|
54
|
+
const fieldExpand = expandFieldsArray.length > 0 ? `&$expand=${expandFieldsArray.join(",")}` : ``;
|
|
49
55
|
if (args.options.id) {
|
|
50
56
|
requestUrl += `/items(${args.options.id})`;
|
|
51
57
|
}
|
|
@@ -53,7 +59,7 @@ class SpoListItemGetCommand extends SpoCommand {
|
|
|
53
59
|
requestUrl += `/GetItemByUniqueId(guid'${args.options.uniqueId}')`;
|
|
54
60
|
}
|
|
55
61
|
const requestOptions = {
|
|
56
|
-
url: `${requestUrl}?$select=${formatting.encodeQueryParameter(
|
|
62
|
+
url: `${requestUrl}?$select=${formatting.encodeQueryParameter(fieldsSelect.join(","))}${fieldExpand}`,
|
|
57
63
|
headers: {
|
|
58
64
|
'accept': 'application/json;odata=nometadata'
|
|
59
65
|
},
|
|
@@ -101,6 +107,8 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
|
|
|
101
107
|
option: '-t, --listTitle [listTitle]'
|
|
102
108
|
}, {
|
|
103
109
|
option: '--listUrl [listUrl]'
|
|
110
|
+
}, {
|
|
111
|
+
option: '--fields [fields]'
|
|
104
112
|
}, {
|
|
105
113
|
option: '-p, --properties [properties]'
|
|
106
114
|
}, {
|
|
@@ -127,7 +135,7 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
|
|
|
127
135
|
return true;
|
|
128
136
|
});
|
|
129
137
|
}, _SpoListItemGetCommand_initTypes = function _SpoListItemGetCommand_initTypes() {
|
|
130
|
-
this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'properties');
|
|
138
|
+
this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'fields', 'properties');
|
|
131
139
|
}, _SpoListItemGetCommand_initOptionSets = function _SpoListItemGetCommand_initOptionSets() {
|
|
132
140
|
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }, { options: ['id', 'uniqueId'] });
|
|
133
141
|
};
|
|
@@ -155,19 +155,6 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
155
155
|
else {
|
|
156
156
|
pageData = await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
|
|
157
157
|
}
|
|
158
|
-
let header;
|
|
159
|
-
switch (args.options.type) {
|
|
160
|
-
case 'None':
|
|
161
|
-
header = noPageHeader;
|
|
162
|
-
break;
|
|
163
|
-
case 'Custom':
|
|
164
|
-
header = customPageHeader;
|
|
165
|
-
break;
|
|
166
|
-
case 'Default':
|
|
167
|
-
default:
|
|
168
|
-
header = defaultPageHeader;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
158
|
if (pageData) {
|
|
172
159
|
canvasContent = pageData.CanvasContent1;
|
|
173
160
|
authorByline = authorByline.length > 0 ? authorByline : pageData.AuthorByline;
|
|
@@ -180,63 +167,135 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
180
167
|
//In the new design page header is is a configurable Banner webpart in the first full-width section
|
|
181
168
|
const headerControl = pageControls.find(control => control?.position?.zoneIndex === 1 && control?.position?.sectionFactor === 0 && control?.webPartId === BannerWebPartId);
|
|
182
169
|
const isStandardPageHeader = pageData.LayoutWebpartsContent !== '[]';
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
170
|
+
const existingHeader = isStandardPageHeader && typeof pageData.LayoutWebpartsContent === 'string'
|
|
171
|
+
? JSON.parse(pageData.LayoutWebpartsContent)[0]
|
|
172
|
+
: headerControl?.webPartData;
|
|
173
|
+
let header;
|
|
174
|
+
switch (args.options.type) {
|
|
175
|
+
case 'None':
|
|
176
|
+
header = noPageHeader;
|
|
177
|
+
break;
|
|
178
|
+
case 'Custom':
|
|
179
|
+
header = customPageHeader;
|
|
180
|
+
break;
|
|
181
|
+
case 'Default':
|
|
182
|
+
header = defaultPageHeader;
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
header = existingHeader || defaultPageHeader;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
if (existingHeader && args.options.type !== 'None') {
|
|
189
|
+
if (typeof args.options.textAlignment === 'undefined') {
|
|
190
|
+
header.properties.textAlignment = existingHeader.properties.textAlignment;
|
|
191
|
+
}
|
|
192
|
+
if (typeof args.options.showTopicHeader === 'undefined') {
|
|
193
|
+
header.properties.showTopicHeader = existingHeader.properties.showTopicHeader;
|
|
194
|
+
}
|
|
195
|
+
if (typeof args.options.topicHeader === 'undefined') {
|
|
196
|
+
header.properties.topicHeader = existingHeader.properties.topicHeader;
|
|
197
|
+
}
|
|
198
|
+
if (typeof args.options.showPublishDate === 'undefined') {
|
|
199
|
+
header.properties.showPublishDate = existingHeader.properties.showPublishDate;
|
|
200
|
+
}
|
|
201
|
+
if (typeof args.options.showTimeToRead === 'undefined') {
|
|
202
|
+
header.properties.showTimeToRead = existingHeader.properties.showTimeToRead;
|
|
203
|
+
}
|
|
204
|
+
if (typeof args.options.layout === 'undefined') {
|
|
205
|
+
header.properties.layoutType = existingHeader.properties.layoutType;
|
|
206
|
+
}
|
|
207
|
+
if (header.properties.imageSourceType === 2 && existingHeader.properties.imageSourceType === 2) {
|
|
208
|
+
const properties = header.properties;
|
|
209
|
+
const existingProperties = existingHeader.properties;
|
|
210
|
+
if (typeof args.options.altText === 'undefined') {
|
|
211
|
+
properties.altText = existingProperties.altText;
|
|
212
|
+
}
|
|
213
|
+
if (typeof args.options.translateX === 'undefined') {
|
|
214
|
+
properties.translateX = existingProperties.translateX;
|
|
215
|
+
}
|
|
216
|
+
if (typeof args.options.translateY === 'undefined') {
|
|
217
|
+
properties.translateY = existingProperties.translateY;
|
|
218
|
+
}
|
|
219
|
+
if (typeof args.options.imageUrl === 'undefined') {
|
|
220
|
+
properties.listId = existingProperties.listId;
|
|
221
|
+
properties.siteId = existingProperties.siteId;
|
|
222
|
+
properties.uniqueId = existingProperties.uniqueId;
|
|
223
|
+
properties.webId = existingProperties.webId;
|
|
224
|
+
header.serverProcessedContent = existingHeader.serverProcessedContent;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
186
227
|
}
|
|
187
228
|
header.properties.title = title;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
header.properties.topicHeader = args.options.topicHeader || '';
|
|
191
|
-
header.properties.showPublishDate = args.options.showPublishDate || false;
|
|
192
|
-
header.properties.showTimeToRead = args.options.showTimeToRead || false;
|
|
193
|
-
if (args.options.type !== 'None') {
|
|
194
|
-
header.properties.layoutType = args.options.layout || 'FullWidthImage';
|
|
229
|
+
if (typeof args.options.textAlignment !== 'undefined') {
|
|
230
|
+
header.properties.textAlignment = args.options.textAlignment;
|
|
195
231
|
}
|
|
196
|
-
if (args.options.
|
|
197
|
-
header.
|
|
198
|
-
|
|
199
|
-
|
|
232
|
+
if (typeof args.options.showTopicHeader !== 'undefined') {
|
|
233
|
+
header.properties.showTopicHeader = args.options.showTopicHeader;
|
|
234
|
+
}
|
|
235
|
+
if (typeof args.options.topicHeader !== 'undefined') {
|
|
236
|
+
header.properties.topicHeader = args.options.topicHeader;
|
|
237
|
+
}
|
|
238
|
+
if (typeof args.options.showPublishDate !== 'undefined') {
|
|
239
|
+
header.properties.showPublishDate = args.options.showPublishDate;
|
|
240
|
+
}
|
|
241
|
+
if (typeof args.options.showTimeToRead !== 'undefined') {
|
|
242
|
+
header.properties.showTimeToRead = args.options.showTimeToRead;
|
|
243
|
+
}
|
|
244
|
+
if (args.options.type !== 'None' && typeof args.options.layout !== 'undefined') {
|
|
245
|
+
header.properties.layoutType = args.options.layout;
|
|
246
|
+
}
|
|
247
|
+
if (header.properties.imageSourceType === 2) {
|
|
200
248
|
const properties = header.properties;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
properties.translateY = args.options.translateY || 0;
|
|
204
|
-
header.properties = properties;
|
|
205
|
-
if (!args.options.imageUrl) {
|
|
206
|
-
header.serverProcessedContent.customMetadata = {
|
|
207
|
-
imageSource: {
|
|
208
|
-
siteId: '',
|
|
209
|
-
webId: '',
|
|
210
|
-
listId: '',
|
|
211
|
-
uniqueId: ''
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
properties.listId = '';
|
|
215
|
-
properties.siteId = '';
|
|
216
|
-
properties.uniqueId = '';
|
|
217
|
-
properties.webId = '';
|
|
218
|
-
header.properties = properties;
|
|
249
|
+
if (typeof args.options.altText !== 'undefined') {
|
|
250
|
+
properties.altText = args.options.altText;
|
|
219
251
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
listId: res[2].ListId,
|
|
231
|
-
uniqueId: res[2].UniqueId
|
|
232
|
-
}
|
|
252
|
+
if (typeof args.options.translateX !== 'undefined') {
|
|
253
|
+
properties.translateX = args.options.translateX;
|
|
254
|
+
}
|
|
255
|
+
if (typeof args.options.translateY !== 'undefined') {
|
|
256
|
+
properties.translateY = args.options.translateY;
|
|
257
|
+
}
|
|
258
|
+
header.properties = properties;
|
|
259
|
+
if (typeof args.options.imageUrl !== 'undefined') {
|
|
260
|
+
header.serverProcessedContent.imageSources = {
|
|
261
|
+
imageSource: args.options.imageUrl
|
|
233
262
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
263
|
+
if (!args.options.imageUrl) {
|
|
264
|
+
header.serverProcessedContent.customMetadata = {
|
|
265
|
+
imageSource: {
|
|
266
|
+
siteId: '',
|
|
267
|
+
webId: '',
|
|
268
|
+
listId: '',
|
|
269
|
+
uniqueId: ''
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
properties.listId = '';
|
|
273
|
+
properties.siteId = '';
|
|
274
|
+
properties.uniqueId = '';
|
|
275
|
+
properties.webId = '';
|
|
276
|
+
header.properties = properties;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const res = await Promise.all([
|
|
280
|
+
spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
|
|
281
|
+
spo.getWebId(args.options.webUrl, logger, this.verbose),
|
|
282
|
+
this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
|
|
283
|
+
]);
|
|
284
|
+
header.serverProcessedContent.customMetadata = {
|
|
285
|
+
imageSource: {
|
|
286
|
+
siteId: res[0],
|
|
287
|
+
webId: res[1],
|
|
288
|
+
listId: res[2].ListId,
|
|
289
|
+
uniqueId: res[2].UniqueId
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const properties = header.properties;
|
|
293
|
+
properties.listId = res[2].ListId;
|
|
294
|
+
properties.siteId = res[0];
|
|
295
|
+
properties.uniqueId = res[2].UniqueId;
|
|
296
|
+
properties.webId = res[1];
|
|
297
|
+
header.properties = properties;
|
|
298
|
+
}
|
|
240
299
|
}
|
|
241
300
|
}
|
|
242
301
|
const requestBody = {
|
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _SpoSiteListCommand_instances, _SpoSiteListCommand_initTelemetry, _SpoSiteListCommand_initOptions, _SpoSiteListCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import config from '../../../../config.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { spo } from '../../../../utils/spo.js';
|
|
7
|
+
import { zod } from '../../../../utils/zod.js';
|
|
11
8
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
9
|
import commands from '../../commands.js';
|
|
10
|
+
var SiteListType;
|
|
11
|
+
(function (SiteListType) {
|
|
12
|
+
SiteListType["TeamSite"] = "TeamSite";
|
|
13
|
+
SiteListType["CommunicationSite"] = "CommunicationSite";
|
|
14
|
+
})(SiteListType || (SiteListType = {}));
|
|
15
|
+
var SiteListState;
|
|
16
|
+
(function (SiteListState) {
|
|
17
|
+
SiteListState["active"] = "active";
|
|
18
|
+
SiteListState["fullyArchived"] = "fullyArchived";
|
|
19
|
+
SiteListState["recentlyArchived"] = "recentlyArchived";
|
|
20
|
+
SiteListState["archived"] = "archived";
|
|
21
|
+
})(SiteListState || (SiteListState = {}));
|
|
22
|
+
export const options = z.strictObject({
|
|
23
|
+
...globalOptionsZod.shape,
|
|
24
|
+
type: zod.coercedEnum(SiteListType).optional().alias('t'),
|
|
25
|
+
state: zod.coercedEnum(SiteListState).optional(),
|
|
26
|
+
webTemplate: z.string().optional(),
|
|
27
|
+
filter: z.string().optional(),
|
|
28
|
+
withOneDriveSites: z.boolean().optional()
|
|
29
|
+
});
|
|
13
30
|
class SpoSiteListCommand extends SpoCommand {
|
|
14
31
|
get name() {
|
|
15
32
|
return commands.SITE_LIST;
|
|
@@ -20,12 +37,20 @@ class SpoSiteListCommand extends SpoCommand {
|
|
|
20
37
|
defaultProperties() {
|
|
21
38
|
return ['Title', 'Url'];
|
|
22
39
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
get schema() {
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
43
|
+
getRefinedSchema(schema) {
|
|
44
|
+
return schema
|
|
45
|
+
.refine(o => !(o.type && o.webTemplate), {
|
|
46
|
+
message: 'Specify either type or webTemplate, but not both'
|
|
47
|
+
})
|
|
48
|
+
.refine(o => !(o.withOneDriveSites && (o.type !== undefined || o.webTemplate !== undefined)), {
|
|
49
|
+
message: `When using withOneDriveSites, don't specify the type or webTemplate options`
|
|
50
|
+
})
|
|
51
|
+
.refine(o => !(o.withOneDriveSites && o.state !== undefined), {
|
|
52
|
+
message: `When using withOneDriveSites, don't specify the state option`
|
|
53
|
+
});
|
|
29
54
|
}
|
|
30
55
|
alias() {
|
|
31
56
|
return [commands.SITE_LIST];
|
|
@@ -34,13 +59,14 @@ class SpoSiteListCommand extends SpoCommand {
|
|
|
34
59
|
const webTemplate = this.getWebTemplateId(args.options);
|
|
35
60
|
const includeOneDriveSites = args.options.withOneDriveSites || false;
|
|
36
61
|
const personalSite = includeOneDriveSites === false ? '0' : '1';
|
|
62
|
+
const effectiveFilter = this.buildFilter(args.options);
|
|
37
63
|
try {
|
|
38
64
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
39
65
|
if (this.verbose) {
|
|
40
66
|
await logger.logToStderr(`Retrieving list of site collections...`);
|
|
41
67
|
}
|
|
42
68
|
this.allSites = [];
|
|
43
|
-
await this.getAllSites(spoAdminUrl, formatting.escapeXml(
|
|
69
|
+
await this.getAllSites(spoAdminUrl, formatting.escapeXml(effectiveFilter), '0', personalSite, webTemplate, undefined, logger);
|
|
44
70
|
await logger.log(this.allSites);
|
|
45
71
|
}
|
|
46
72
|
catch (err) {
|
|
@@ -88,43 +114,28 @@ class SpoSiteListCommand extends SpoCommand {
|
|
|
88
114
|
return '';
|
|
89
115
|
}
|
|
90
116
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, {
|
|
108
|
-
option: '--filter [filter]'
|
|
109
|
-
}, {
|
|
110
|
-
option: '--withOneDriveSites'
|
|
111
|
-
});
|
|
112
|
-
}, _SpoSiteListCommand_initValidators = function _SpoSiteListCommand_initValidators() {
|
|
113
|
-
this.validators.push(async (args) => {
|
|
114
|
-
if (args.options.type && args.options.webTemplate) {
|
|
115
|
-
return 'Specify either type or webTemplate, but not both';
|
|
117
|
+
buildFilter(options) {
|
|
118
|
+
const providedFilter = options.filter || '';
|
|
119
|
+
let stateFilter = '';
|
|
120
|
+
switch (options.state) {
|
|
121
|
+
case 'active':
|
|
122
|
+
stateFilter = `ArchiveStatus -eq 'NotArchived'`;
|
|
123
|
+
break;
|
|
124
|
+
case 'fullyArchived':
|
|
125
|
+
stateFilter = `ArchiveStatus -eq 'FullyArchived'`;
|
|
126
|
+
break;
|
|
127
|
+
case 'recentlyArchived':
|
|
128
|
+
stateFilter = `ArchiveStatus -eq 'RecentlyArchived'`;
|
|
129
|
+
break;
|
|
130
|
+
case 'archived':
|
|
131
|
+
stateFilter = `ArchiveStatus -ne 'NotArchived'`;
|
|
132
|
+
break;
|
|
116
133
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
typeValues.indexOf(args.options.type) < 0) {
|
|
120
|
-
return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
|
|
134
|
+
if (stateFilter && providedFilter) {
|
|
135
|
+
return `${providedFilter} and ${stateFilter}`;
|
|
121
136
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
return true;
|
|
127
|
-
});
|
|
128
|
-
};
|
|
137
|
+
return stateFilter || providedFilter;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
129
140
|
export default new SpoSiteListCommand();
|
|
130
141
|
//# sourceMappingURL=site-list.js.map
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _SpoStorageEntityGetCommand_instances, _SpoStorageEntityGetCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
5
|
import { spo } from '../../../../utils/spo.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
10
7
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
8
|
import commands from '../../commands.js';
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
key: z.string().alias('k'),
|
|
12
|
+
appCatalogUrl: z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})
|
|
16
|
+
.optional()
|
|
17
|
+
.alias('u')
|
|
18
|
+
});
|
|
12
19
|
class SpoStorageEntityGetCommand extends SpoCommand {
|
|
13
20
|
get name() {
|
|
14
21
|
return commands.STORAGEENTITY_GET;
|
|
@@ -16,16 +23,20 @@ class SpoStorageEntityGetCommand extends SpoCommand {
|
|
|
16
23
|
get description() {
|
|
17
24
|
return 'Gets details for the specified tenant property';
|
|
18
25
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_SpoStorageEntityGetCommand_instances.add(this);
|
|
22
|
-
__classPrivateFieldGet(this, _SpoStorageEntityGetCommand_instances, "m", _SpoStorageEntityGetCommand_initOptions).call(this);
|
|
26
|
+
get schema() {
|
|
27
|
+
return options;
|
|
23
28
|
}
|
|
24
29
|
async commandAction(logger, args) {
|
|
25
30
|
try {
|
|
26
|
-
|
|
31
|
+
let appCatalogUrl = args.options.appCatalogUrl;
|
|
32
|
+
if (!appCatalogUrl) {
|
|
33
|
+
appCatalogUrl = await spo.getTenantAppCatalogUrl(logger, this.debug);
|
|
34
|
+
if (!appCatalogUrl) {
|
|
35
|
+
throw 'Tenant app catalog URL not found. Specify the URL of the app catalog site using the appCatalogUrl option.';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
27
38
|
const requestOptions = {
|
|
28
|
-
url: `${
|
|
39
|
+
url: `${appCatalogUrl}/_api/web/GetStorageEntity('${formatting.encodeQueryParameter(args.options.key)}')`,
|
|
29
40
|
headers: {
|
|
30
41
|
accept: 'application/json;odata=nometadata'
|
|
31
42
|
},
|
|
@@ -51,10 +62,5 @@ class SpoStorageEntityGetCommand extends SpoCommand {
|
|
|
51
62
|
}
|
|
52
63
|
}
|
|
53
64
|
}
|
|
54
|
-
_SpoStorageEntityGetCommand_instances = new WeakSet(), _SpoStorageEntityGetCommand_initOptions = function _SpoStorageEntityGetCommand_initOptions() {
|
|
55
|
-
this.options.unshift({
|
|
56
|
-
option: '-k, --key <key>'
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
65
|
export default new SpoStorageEntityGetCommand();
|
|
60
66
|
//# sourceMappingURL=storageentity-get.js.map
|