@pnp/cli-microsoft365 10.10.0-beta.eb74779 → 10.11.0-beta.24af61c
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/.eslintrc.cjs +2 -0
- package/Dockerfile +2 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/config.js +1 -0
- package/dist/m365/base/GraphApplicationCommand.js +17 -0
- package/dist/m365/base/{DelegatedGraphCommand.js → GraphDelegatedCommand.js} +4 -4
- package/dist/m365/base/PowerAppsCommand.js +1 -1
- package/dist/m365/base/PowerAutomateCommand.js +1 -1
- package/dist/m365/base/PowerBICommand.js +1 -1
- package/dist/m365/base/PowerPlatformCommand.js +1 -1
- package/dist/m365/base/VivaEngageCommand.js +1 -1
- package/dist/m365/cli/commands/app/app-add.js +95 -0
- package/dist/m365/cli/commands.js +1 -0
- package/dist/m365/entra/commands/app/app-get.js +11 -52
- package/dist/m365/entra/commands/app/app-permission-add.js +19 -30
- package/dist/m365/entra/commands/app/app-permission-list.js +2 -19
- package/dist/m365/entra/commands/app/app-permission-remove.js +22 -31
- package/dist/m365/entra/commands/app/app-remove.js +2 -18
- package/dist/m365/entra/commands/app/app-role-add.js +10 -43
- package/dist/m365/entra/commands/app/app-role-list.js +2 -20
- package/dist/m365/entra/commands/app/app-role-remove.js +9 -40
- package/dist/m365/entra/commands/app/app-set.js +2 -19
- package/dist/m365/entra/commands/group/group-member-add.js +55 -10
- package/dist/m365/entra/commands/group/group-member-set.js +18 -3
- package/dist/m365/entra/commands/organization/organization-set.js +104 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/outlook/commands/message/message-move.js +1 -1
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +7 -21
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +96 -0
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spfx/commands/project/base-project-command.js +1 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.0.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.21.1.js +2 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.22.0-beta.1.js +21 -0
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN002022_DEVDEP_typescript.js +10 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-model/SassJson.js +2 -0
- package/dist/m365/spfx/commands/project/project-model/index.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002001_DEVDEP_microsoft_sp_build_web.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002004_DEVDEP_gulp.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002007_DEVDEP_ajv.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002029_DEVDEP_microsoft_rush_stack_compiler_5_3.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002030_DEVDEP_microsoft_spfx_web_build_rig.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002031_DEVDEP_rushstack_heft.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002032_DEVDEP_typescript_eslint_parser.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002033_DEVDEP_jest_junit.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010011_YORC_useGulp.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015010_FILE_gulpfile_js.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015011_FILE_tsconfig_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015012_FILE_config_heft_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015013_FILE_config_jest_config_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015014_FILE_config_rig_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015015_FILE_config_typescript_json.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021004_PKG_scripts_build.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021005_PKG_scripts_test.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021006_PKG_scripts_clean.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021007_PKG_scripts_deploy.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021008_PKG_scripts_start.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_scripts_build_watch.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021010_PKG_scripts_package_solution.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021011_PKG_scripts_deploy_azure_storage.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021012_PKG_scripts_eject_webpack.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021013_PKG_overrides_rushstack_heft.js +45 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023003_GITIGNORE_libdts.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023004_GITIGNORE_libcommonjs.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023005_GITIGNORE_libesm.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023006_GITIGNORE_jestoutput.js +36 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026001_CFG_SASS_schema.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN026002_CFG_SASS_extends.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FileAddRemoveRule.js +7 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0-beta.1.js +241 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/file/file-version-get.js +1 -0
- package/dist/m365/spo/commands/file/file-version-list.js +2 -2
- package/dist/m365/spo/commands/homesite/homesite-remove.js +57 -37
- package/dist/m365/spo/commands/list/list-view-add.js +140 -87
- package/dist/m365/spo/commands/page/Page.js +10 -3
- package/dist/m365/spo/commands/page/clientsidepages.js +4 -0
- package/dist/m365/spo/commands/page/page-section-add.js +73 -13
- package/dist/m365/spo/commands/page/page-section-list.js +5 -1
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +13 -7
- package/dist/m365/spo/commands/site/site-appcatalog-list.js +38 -2
- package/dist/m365/spo/commands/tenant/tenant-site-unarchive.js +1 -1
- package/dist/m365/teams/commands/callrecord/callrecord-list.js +100 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +2 -2
- package/dist/m365/teams/commands/message/message-remove.js +2 -2
- package/dist/m365/teams/commands/message/message-restore.js +2 -2
- package/dist/m365/teams/commands.js +1 -0
- package/dist/m365/todo/commands/list/list-add.js +2 -2
- package/dist/m365/todo/commands/list/list-get.js +2 -2
- package/dist/m365/todo/commands/list/list-list.js +2 -2
- package/dist/m365/todo/commands/list/list-remove.js +2 -2
- package/dist/m365/todo/commands/list/list-set.js +2 -2
- package/dist/m365/todo/commands/task/task-add.js +2 -2
- package/dist/m365/todo/commands/task/task-get.js +2 -2
- package/dist/m365/todo/commands/task/task-list.js +2 -2
- package/dist/m365/todo/commands/task/task-remove.js +2 -2
- package/dist/m365/todo/commands/task/task-set.js +2 -2
- package/dist/m365/viva/commands/engage/EngageRole.js +2 -0
- package/dist/m365/viva/commands/engage/engage-role-list.js +28 -0
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +57 -0
- package/dist/m365/viva/commands.js +2 -0
- package/dist/utils/accessToken.js +9 -5
- package/dist/utils/entraApp.js +15 -0
- package/dist/utils/entraGroup.js +43 -0
- package/dist/utils/vivaEngage.js +19 -0
- package/docs/docs/cmd/cli/app/app-add.mdx +50 -0
- package/docs/docs/cmd/entra/group/group-member-add.mdx +26 -5
- package/docs/docs/cmd/entra/group/group-member-set.mdx +7 -4
- package/docs/docs/cmd/entra/organization/organization-set.mdx +84 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +53 -0
- package/docs/docs/cmd/spo/file/file-version-get.mdx +5 -2
- package/docs/docs/cmd/spo/file/file-version-list.mdx +7 -5
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +6 -3
- package/docs/docs/cmd/spo/list/list-view-add.mdx +53 -10
- package/docs/docs/cmd/spo/page/page-section-add.mdx +22 -2
- package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +11 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-unarchive.mdx +1 -1
- package/docs/docs/cmd/teams/callrecord/callrecord-list.mdx +173 -0
- package/docs/docs/cmd/viva/engage/engage-role-list.mdx +102 -0
- package/docs/docs/cmd/viva/engage/engage-role-member-list.mdx +118 -0
- package/npm-shrinkwrap.json +293 -765
- package/package.json +18 -17
|
@@ -1,53 +1,126 @@
|
|
|
1
|
-
|
|
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 _SpoListViewAddCommand_instances, _SpoListViewAddCommand_initTelemetry, _SpoListViewAddCommand_initOptions, _SpoListViewAddCommand_initValidators, _SpoListViewAddCommand_initOptionSets;
|
|
1
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
2
|
import request from '../../../../request.js';
|
|
8
3
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
4
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
5
|
import { validation } from '../../../../utils/validation.js';
|
|
11
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
7
|
import commands from '../../commands.js';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { zod } from '../../../../utils/zod.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
webUrl: zod.alias('u', z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
+
message: 'webUrl is not a valid SharePoint site URL.'
|
|
15
|
+
})),
|
|
16
|
+
listId: z.string()
|
|
17
|
+
.refine(id => validation.isValidGuid(id), id => ({
|
|
18
|
+
message: `'${id}' is not a valid GUID.`
|
|
19
|
+
})).optional(),
|
|
20
|
+
listTitle: z.string().optional(),
|
|
21
|
+
listUrl: z.string().optional(),
|
|
22
|
+
title: z.string().min(1, 'Cannot be empty.'),
|
|
23
|
+
fields: z.string().optional(),
|
|
24
|
+
viewQuery: z.string().optional(),
|
|
25
|
+
personal: z.boolean().optional(),
|
|
26
|
+
default: z.boolean().optional(),
|
|
27
|
+
paged: z.boolean().optional(),
|
|
28
|
+
rowLimit: z.number().int().positive().optional(),
|
|
29
|
+
customFormatter: z.string()
|
|
30
|
+
.refine(formatter => {
|
|
31
|
+
try {
|
|
32
|
+
JSON.parse(formatter);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
message: 'Custom formatter must be a valid JSON string.'
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
type: z.enum(['list', 'calendar', 'gallery', 'kanban']).optional(),
|
|
43
|
+
calendarStartDateField: z.string().min(1, 'Cannot be empty.').optional(),
|
|
44
|
+
calendarEndDateField: z.string().min(1, 'Cannot be empty.').optional(),
|
|
45
|
+
calendarTitleField: z.string().min(1, 'Cannot be empty.').optional(),
|
|
46
|
+
calendarSubTitleField: z.string().min(1, 'Cannot be empty.').optional(),
|
|
47
|
+
calendarDefaultLayout: z.enum(['month', 'week', 'workWeek', 'day']).optional(),
|
|
48
|
+
kanbanBucketField: z.string().min(1, 'Cannot be empty.').optional()
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
13
51
|
class SpoListViewAddCommand extends SpoCommand {
|
|
14
52
|
get name() {
|
|
15
53
|
return commands.LIST_VIEW_ADD;
|
|
16
54
|
}
|
|
17
55
|
get description() {
|
|
18
|
-
return 'Adds a new view to a SharePoint list
|
|
56
|
+
return 'Adds a new view to a SharePoint list';
|
|
19
57
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
58
|
+
get schema() {
|
|
59
|
+
return options;
|
|
60
|
+
}
|
|
61
|
+
getRefinedSchema(schema) {
|
|
62
|
+
return schema
|
|
63
|
+
.refine((options) => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
|
|
64
|
+
message: 'Use one of the following options: listId, listTitle, or listUrl.'
|
|
65
|
+
})
|
|
66
|
+
.refine((options) => !options.personal || !options.default, {
|
|
67
|
+
message: 'Default view cannot be a personal view.'
|
|
68
|
+
})
|
|
69
|
+
.refine((options) => options.type !== 'calendar' || [options.calendarStartDateField, options.calendarEndDateField, options.calendarTitleField].filter(o => o === undefined).length === 0, {
|
|
70
|
+
message: 'When type is calendar, do specify calendarStartDateField, calendarEndDateField, and calendarTitleField.'
|
|
71
|
+
})
|
|
72
|
+
.refine((options) => options.type === 'calendar' || [options.calendarStartDateField, options.calendarEndDateField, options.calendarTitleField].filter(o => o === undefined).length === 3, {
|
|
73
|
+
message: 'When type is not calendar, do not specify calendarStartDateField, calendarEndDateField, and calendarTitleField.'
|
|
74
|
+
})
|
|
75
|
+
.refine((options) => options.type !== 'kanban' || options.kanbanBucketField !== undefined, {
|
|
76
|
+
message: 'When type is kanban, do specify kanbanBucketField.'
|
|
77
|
+
})
|
|
78
|
+
.refine((options) => options.type === 'kanban' || options.kanbanBucketField === undefined, {
|
|
79
|
+
message: 'When type is not kanban, do not specify kanbanBucketField.'
|
|
80
|
+
})
|
|
81
|
+
.refine((options) => options.type === 'calendar' || options.fields !== undefined, {
|
|
82
|
+
message: 'When type is not calendar, do specify fields.'
|
|
83
|
+
});
|
|
27
84
|
}
|
|
28
85
|
async commandAction(logger, args) {
|
|
29
|
-
const requestOptions = {
|
|
30
|
-
url: this.getRestUrl(args.options),
|
|
31
|
-
headers: {
|
|
32
|
-
'content-type': 'application/json;odata=verbose',
|
|
33
|
-
accept: 'application/json;odata=nometadata'
|
|
34
|
-
},
|
|
35
|
-
responseType: 'json',
|
|
36
|
-
data: {
|
|
37
|
-
parameters: {
|
|
38
|
-
Title: args.options.title,
|
|
39
|
-
ViewFields: {
|
|
40
|
-
results: args.options.fields.split(',')
|
|
41
|
-
},
|
|
42
|
-
Query: args.options.viewQuery,
|
|
43
|
-
PersonalView: !!args.options.personal,
|
|
44
|
-
SetAsDefaultView: !!args.options.default,
|
|
45
|
-
Paged: !!args.options.paged,
|
|
46
|
-
RowLimit: args.options.rowLimit ? +args.options.rowLimit : 30
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
86
|
try {
|
|
87
|
+
if (this.verbose) {
|
|
88
|
+
await logger.logToStderr(`Adding view '${args.options.title}' to list...`);
|
|
89
|
+
}
|
|
90
|
+
let apiUrl = `${args.options.webUrl}/_api/web/`;
|
|
91
|
+
if (args.options.listId) {
|
|
92
|
+
apiUrl += `lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
93
|
+
}
|
|
94
|
+
else if (args.options.listTitle) {
|
|
95
|
+
apiUrl += `lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
96
|
+
}
|
|
97
|
+
else if (args.options.listUrl) {
|
|
98
|
+
apiUrl += `GetList('${formatting.encodeQueryParameter(urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl))}')`;
|
|
99
|
+
}
|
|
100
|
+
apiUrl += '/views/add';
|
|
101
|
+
const requestOptions = {
|
|
102
|
+
url: apiUrl,
|
|
103
|
+
headers: {
|
|
104
|
+
'content-type': 'application/json;odata=verbose',
|
|
105
|
+
accept: 'application/json;odata=nometadata'
|
|
106
|
+
},
|
|
107
|
+
responseType: 'json',
|
|
108
|
+
data: {
|
|
109
|
+
parameters: {
|
|
110
|
+
Title: args.options.title,
|
|
111
|
+
ViewFields: {
|
|
112
|
+
results: args.options.fields?.split(',').map(f => f.trim()) ?? []
|
|
113
|
+
},
|
|
114
|
+
Query: args.options.viewQuery,
|
|
115
|
+
PersonalView: !!args.options.personal,
|
|
116
|
+
SetAsDefaultView: !!args.options.default,
|
|
117
|
+
Paged: !!args.options.paged,
|
|
118
|
+
RowLimit: args.options.rowLimit ?? 30,
|
|
119
|
+
CustomFormatter: args.options.customFormatter
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.setViewTypeSpecificParameters(args.options, requestOptions.data.parameters);
|
|
51
124
|
const result = await request.post(requestOptions);
|
|
52
125
|
await logger.log(result);
|
|
53
126
|
}
|
|
@@ -55,62 +128,42 @@ class SpoListViewAddCommand extends SpoCommand {
|
|
|
55
128
|
this.handleRejectedODataJsonPromise(err);
|
|
56
129
|
}
|
|
57
130
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.telemetry.push((args) => {
|
|
75
|
-
Object.assign(this.telemetryProperties, {
|
|
76
|
-
listId: typeof args.options.listId !== 'undefined',
|
|
77
|
-
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
78
|
-
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
79
|
-
title: typeof args.options.title !== 'undefined',
|
|
80
|
-
viewQuery: typeof args.options.viewQuery !== 'undefined',
|
|
81
|
-
personal: !!args.options.personal,
|
|
82
|
-
default: !!args.options.default,
|
|
83
|
-
orderedView: !!args.options.orderedView,
|
|
84
|
-
paged: !!args.options.paged,
|
|
85
|
-
rowLimit: typeof args.options.rowLimit !== 'undefined'
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}, _SpoListViewAddCommand_initOptions = function _SpoListViewAddCommand_initOptions() {
|
|
89
|
-
this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--listId [listId]' }, { option: '--listTitle [listTitle]' }, { option: '--listUrl [listUrl]' }, { option: '--title <title>' }, { option: '--fields <fields>' }, { option: '--viewQuery [viewQuery]' }, { option: '--personal' }, { option: '--default' }, { option: '--paged' }, { option: '--rowLimit [rowLimit]' });
|
|
90
|
-
}, _SpoListViewAddCommand_initValidators = function _SpoListViewAddCommand_initValidators() {
|
|
91
|
-
this.validators.push(async (args) => {
|
|
92
|
-
const webUrlValidation = validation.isValidSharePointUrl(args.options.webUrl);
|
|
93
|
-
if (webUrlValidation !== true) {
|
|
94
|
-
return webUrlValidation;
|
|
131
|
+
setViewTypeSpecificParameters(options, requestBody) {
|
|
132
|
+
if (options.type === 'calendar') {
|
|
133
|
+
const defaultView = options.calendarDefaultLayout ?? 'month';
|
|
134
|
+
const titleField = options.calendarTitleField;
|
|
135
|
+
const subTitleField = options.calendarSubTitleField ?? '';
|
|
136
|
+
// Following fields are required for calendar view, order is important
|
|
137
|
+
const viewFields = [options.calendarStartDateField, options.calendarEndDateField, titleField, subTitleField].filter(field => field !== '');
|
|
138
|
+
// Add any additional fields specified by the user
|
|
139
|
+
const extraViewFields = requestBody.ViewFields.results.filter((field) => !viewFields.includes(field.trim()));
|
|
140
|
+
viewFields.push(...extraViewFields);
|
|
141
|
+
requestBody.CalendarViewStyles = `<CalendarViewStyle Title="Day" Type="day" Template="CalendarViewdayChrome" Sequence="1" Default="${String(defaultView === 'day').toUpperCase()}" /><CalendarViewStyle Title="Week" Type="week" Template="CalendarViewweekChrome" Sequence="2" Default="${String(defaultView === 'week').toUpperCase()}" /><CalendarViewStyle Title="Month" Type="month" Template="CalendarViewmonthChrome" Sequence="3" Default="${String(defaultView === 'month').toUpperCase()}" /><CalendarViewStyle Title="Work week" Type="workweek" Template="CalendarViewweekChrome" Sequence="4" Default="${String(defaultView === 'workWeek').toUpperCase()}" />`;
|
|
142
|
+
requestBody.Query = `<Where><DateRangesOverlap><FieldRef Name='${options.calendarStartDateField}' /><FieldRef Name='${options.calendarEndDateField}' /><Value Type='DateTime'><Month /></Value></DateRangesOverlap></Where>`;
|
|
143
|
+
requestBody.ViewData = `<FieldRef Name="${titleField}" Type="CalendarMonthTitle" /><FieldRef Name="${titleField}" Type="CalendarWeekTitle" /><FieldRef Name="${subTitleField}" Type="CalendarWeekLocation" /><FieldRef Name="${titleField}" Type="CalendarDayTitle" /><FieldRef Name="${subTitleField}" Type="CalendarDayLocation" />`;
|
|
144
|
+
requestBody.ViewFields.results = viewFields;
|
|
145
|
+
requestBody.ViewType2 = 'MODERNCALENDAR';
|
|
146
|
+
return;
|
|
95
147
|
}
|
|
96
|
-
if (
|
|
97
|
-
|
|
148
|
+
if (options.type === 'gallery') {
|
|
149
|
+
requestBody.ViewType2 = 'TILES';
|
|
150
|
+
return;
|
|
98
151
|
}
|
|
99
|
-
if (
|
|
100
|
-
if
|
|
101
|
-
|
|
152
|
+
if (options.type === 'kanban') {
|
|
153
|
+
// Add the bucket field to the view fields if it is not already included
|
|
154
|
+
const viewFields = requestBody.ViewFields.results;
|
|
155
|
+
if (!viewFields.includes(options.kanbanBucketField)) {
|
|
156
|
+
viewFields.push(options.kanbanBucketField);
|
|
102
157
|
}
|
|
103
|
-
if (
|
|
104
|
-
|
|
158
|
+
if (!options.customFormatter) {
|
|
159
|
+
requestBody.CustomFormatter = '{}';
|
|
105
160
|
}
|
|
161
|
+
requestBody.ViewData = `<FieldRef Name="${options.kanbanBucketField}" Type="KanbanPivotColumn" />`;
|
|
162
|
+
requestBody.ViewType2 = 'KANBAN';
|
|
163
|
+
return;
|
|
106
164
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return true;
|
|
111
|
-
});
|
|
112
|
-
}, _SpoListViewAddCommand_initOptionSets = function _SpoListViewAddCommand_initOptionSets() {
|
|
113
|
-
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
114
|
-
};
|
|
165
|
+
}
|
|
166
|
+
;
|
|
167
|
+
}
|
|
115
168
|
export default new SpoListViewAddCommand();
|
|
116
169
|
//# sourceMappingURL=list-view-add.js.map
|
|
@@ -72,10 +72,14 @@ export class Page {
|
|
|
72
72
|
return output;
|
|
73
73
|
}
|
|
74
74
|
static getSectionInformation(section, isJSONOutput) {
|
|
75
|
-
|
|
76
|
-
order: section.order
|
|
77
|
-
columns: section.columns.map(column => this.getColumnsInformation(column, isJSONOutput))
|
|
75
|
+
const sectionOutput = {
|
|
76
|
+
order: section.order
|
|
78
77
|
};
|
|
78
|
+
if (this.isVerticalSection(section)) {
|
|
79
|
+
sectionOutput.isVertical = true;
|
|
80
|
+
}
|
|
81
|
+
sectionOutput.columns = section.columns.map(column => this.getColumnsInformation(column, isJSONOutput));
|
|
82
|
+
return sectionOutput;
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
81
85
|
* Publish a modern page in SharePoint Online
|
|
@@ -99,5 +103,8 @@ export class Page {
|
|
|
99
103
|
}
|
|
100
104
|
return pageName;
|
|
101
105
|
}
|
|
106
|
+
static isVerticalSection(section) {
|
|
107
|
+
return section.layoutIndex === 2 && section?.controlData?.position?.sectionFactor === 12;
|
|
108
|
+
}
|
|
102
109
|
}
|
|
103
110
|
//# sourceMappingURL=Page.js.map
|
|
@@ -30,6 +30,10 @@ export var CanvasSectionTemplate;
|
|
|
30
30
|
/// Vertical
|
|
31
31
|
/// </summary>
|
|
32
32
|
CanvasSectionTemplate[CanvasSectionTemplate["Vertical"] = 6] = "Vertical";
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Flexible
|
|
35
|
+
/// </summary>
|
|
36
|
+
CanvasSectionTemplate[CanvasSectionTemplate["Flexible"] = 7] = "Flexible";
|
|
33
37
|
})(CanvasSectionTemplate || (CanvasSectionTemplate = {}));
|
|
34
38
|
/**
|
|
35
39
|
* Section background shading
|
|
@@ -22,10 +22,12 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
24
|
_SpoPageSectionAddCommand_instances.add(this);
|
|
25
|
-
this.sectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical'];
|
|
25
|
+
this.sectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical', 'Flexible'];
|
|
26
26
|
this.zoneEmphasis = ['None', 'Neutral', 'Soft', 'Strong', 'Image', 'Gradient'];
|
|
27
27
|
this.iconAlignment = ['Left', 'Right'];
|
|
28
28
|
this.fillMode = ['ScaleToFill', 'ScaleToFit', 'Tile', 'OriginalSize'];
|
|
29
|
+
this.zoneReflowStrategy = ['TopToBottom', 'LeftToRight'];
|
|
30
|
+
this.MINIMUM_ZONE_HEIGHT = 34;
|
|
29
31
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initTelemetry).call(this);
|
|
30
32
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initOptions).call(this);
|
|
31
33
|
__classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initValidators).call(this);
|
|
@@ -50,6 +52,12 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
50
52
|
};
|
|
51
53
|
const res = await request.get(requestOptions);
|
|
52
54
|
canvasContent = JSON.parse(res.CanvasContent1 || "[{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]");
|
|
55
|
+
if (args.options.sectionTemplate === 'OneColumnFullWidth') {
|
|
56
|
+
this.ensureFullWidthSectionCanBeAdded(canvasContent);
|
|
57
|
+
}
|
|
58
|
+
if (args.options.sectionTemplate === 'Vertical') {
|
|
59
|
+
this.ensureVerticalSectionCanBeAdded(canvasContent);
|
|
60
|
+
}
|
|
53
61
|
if (!res.IsPageCheckedOutToCurrentUser) {
|
|
54
62
|
await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
|
|
55
63
|
}
|
|
@@ -142,6 +150,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
142
150
|
case 'Vertical':
|
|
143
151
|
columns.push(this.getVerticalColumn(args, zoneId));
|
|
144
152
|
break;
|
|
153
|
+
case 'Flexible':
|
|
154
|
+
columns.push(this.getFlexibleColumn(zoneIndex, sectionIndex++, args, zoneId));
|
|
155
|
+
break;
|
|
145
156
|
case 'OneColumn':
|
|
146
157
|
default:
|
|
147
158
|
columns.push(this.getColumn(zoneIndex, sectionIndex++, 12, args, zoneId));
|
|
@@ -162,9 +173,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
162
173
|
},
|
|
163
174
|
emphasis: {}
|
|
164
175
|
};
|
|
165
|
-
if (zoneEmphasis && ['none', 'neutral', 'soft', 'strong'].includes(zoneEmphasis?.
|
|
176
|
+
if (zoneEmphasis && ['none', 'neutral', 'soft', 'strong'].includes(zoneEmphasis?.toLowerCase())) {
|
|
166
177
|
// Just these zoneEmphasis values should be added to column emphasis
|
|
167
|
-
const zoneEmphasisValue = ['none', 'neutral', 'soft', 'strong'].indexOf(zoneEmphasis.
|
|
178
|
+
const zoneEmphasisValue = ['none', 'neutral', 'soft', 'strong'].indexOf(zoneEmphasis.toLowerCase());
|
|
168
179
|
columnValue.emphasis = { zoneEmphasis: zoneEmphasisValue };
|
|
169
180
|
}
|
|
170
181
|
if (isCollapsibleSection) {
|
|
@@ -172,8 +183,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
172
183
|
type: 1,
|
|
173
184
|
isExpanded: !!isExpanded,
|
|
174
185
|
showDividerLine: !!showDivider,
|
|
175
|
-
iconAlignment: iconAlignment && iconAlignment.
|
|
176
|
-
displayName: collapsibleTitle
|
|
186
|
+
iconAlignment: iconAlignment && iconAlignment.toLowerCase() === "right" ? "right" : "left",
|
|
187
|
+
displayName: collapsibleTitle,
|
|
188
|
+
headingLevel: args.options.headingLevel ? args.options.headingLevel : 2 //2 is a default heading level
|
|
177
189
|
};
|
|
178
190
|
}
|
|
179
191
|
return columnValue;
|
|
@@ -185,6 +197,14 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
185
197
|
columnValue.position.controlIndex = 1;
|
|
186
198
|
return columnValue;
|
|
187
199
|
}
|
|
200
|
+
getFlexibleColumn(zoneIndex, sectionIndex, args, zoneId) {
|
|
201
|
+
const columnValue = this.getColumn(zoneIndex, sectionIndex, 100, args, zoneId);
|
|
202
|
+
columnValue.zoneReflowStrategy = { axis: args.options.zoneReflowStrategy ? this.zoneReflowStrategy.indexOf(args.options.zoneReflowStrategy) : 0 };
|
|
203
|
+
if (args.options.zoneHeight) {
|
|
204
|
+
columnValue.zoneHeight = args.options.zoneHeight;
|
|
205
|
+
}
|
|
206
|
+
return columnValue;
|
|
207
|
+
}
|
|
188
208
|
setBackgroundControl(zoneId, backgroundControl, args) {
|
|
189
209
|
const { overlayColor, overlayOpacity, useLightText, imageUrl } = args.options;
|
|
190
210
|
const backgroundDetails = this.getBackgroundDetails(args);
|
|
@@ -237,6 +257,18 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
237
257
|
}
|
|
238
258
|
return backgroundDetails;
|
|
239
259
|
}
|
|
260
|
+
ensureFullWidthSectionCanBeAdded(canvasContent) {
|
|
261
|
+
const hasVerticalSection = canvasContent.some((c) => c.position?.layoutIndex === 2 && c.position.sectionFactor === 12);
|
|
262
|
+
if (hasVerticalSection) {
|
|
263
|
+
throw "A vertical section already exists on the page. A full-width section cannot be added to a page that already has a vertical section.";
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
ensureVerticalSectionCanBeAdded(canvasContent) {
|
|
267
|
+
const hasFullWidthSection = canvasContent.some((c) => c.position?.layoutIndex === 1 && c.position.sectionFactor === 0);
|
|
268
|
+
if (hasFullWidthSection) {
|
|
269
|
+
throw "A full-width section already exists on the page. A vertical section cannot be added to a page that already has a full-width section.";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
240
272
|
}
|
|
241
273
|
_SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_initTelemetry = function _SpoPageSectionAddCommand_initTelemetry() {
|
|
242
274
|
this.telemetry.push((args) => {
|
|
@@ -256,7 +288,10 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
256
288
|
useLightText: !!args.options.useLightText,
|
|
257
289
|
overlayColor: typeof args.options.overlayColor !== 'undefined',
|
|
258
290
|
overlayOpacity: typeof args.options.overlayOpacity !== 'undefined',
|
|
259
|
-
collapsibleTitle: typeof args.options.collapsibleTitle !== 'undefined'
|
|
291
|
+
collapsibleTitle: typeof args.options.collapsibleTitle !== 'undefined',
|
|
292
|
+
zoneReflowStrategy: typeof args.options.zoneReflowStrategy !== 'undefined',
|
|
293
|
+
zoneHeight: typeof args.options.zoneHeight !== 'undefined',
|
|
294
|
+
headingLevel: typeof args.options.headingLevel !== 'undefined'
|
|
260
295
|
});
|
|
261
296
|
});
|
|
262
297
|
}, _SpoPageSectionAddCommand_initOptions = function _SpoPageSectionAddCommand_initOptions() {
|
|
@@ -302,11 +337,18 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
302
337
|
option: '--overlayOpacity [overlayOpacity]'
|
|
303
338
|
}, {
|
|
304
339
|
option: '--collapsibleTitle [collapsibleTitle]'
|
|
340
|
+
}, {
|
|
341
|
+
option: '--zoneReflowStrategy [zoneReflowStrategy]',
|
|
342
|
+
autocomplete: this.zoneReflowStrategy
|
|
343
|
+
}, {
|
|
344
|
+
option: '--zoneHeight [zoneHeight]'
|
|
345
|
+
}, {
|
|
346
|
+
option: '--headingLevel [headingLevel]'
|
|
305
347
|
});
|
|
306
348
|
}, _SpoPageSectionAddCommand_initValidators = function _SpoPageSectionAddCommand_initValidators() {
|
|
307
349
|
this.validators.push(async (args) => {
|
|
308
350
|
if (!(args.options.sectionTemplate in CanvasSectionTemplate)) {
|
|
309
|
-
return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight|Vertical`;
|
|
351
|
+
return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight|Vertical|Flexible`;
|
|
310
352
|
}
|
|
311
353
|
if (typeof args.options.order !== 'undefined') {
|
|
312
354
|
if (!Number.isInteger(args.options.order) || args.options.order < 1) {
|
|
@@ -314,7 +356,7 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
314
356
|
}
|
|
315
357
|
}
|
|
316
358
|
if (typeof args.options.zoneEmphasis !== 'undefined') {
|
|
317
|
-
if (!this.zoneEmphasis.some(zoneEmphasisValue => zoneEmphasisValue.
|
|
359
|
+
if (!this.zoneEmphasis.some(zoneEmphasisValue => zoneEmphasisValue.toLowerCase() === args.options.zoneEmphasis?.toLowerCase())) {
|
|
318
360
|
return `The value of parameter zoneEmphasis must be ${this.zoneEmphasis.join(', ')}`;
|
|
319
361
|
}
|
|
320
362
|
}
|
|
@@ -324,20 +366,30 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
324
366
|
}
|
|
325
367
|
}
|
|
326
368
|
if (typeof args.options.iconAlignment !== 'undefined') {
|
|
327
|
-
if (!this.iconAlignment.some(iconAlignmentValue => iconAlignmentValue.
|
|
369
|
+
if (!this.iconAlignment.some(iconAlignmentValue => iconAlignmentValue.toLowerCase() === args.options.iconAlignment?.toLowerCase())) {
|
|
328
370
|
return `The value of parameter iconAlignment must be ${this.iconAlignment.join(', ')}`;
|
|
329
371
|
}
|
|
330
372
|
}
|
|
331
373
|
if (typeof args.options.fillMode !== 'undefined') {
|
|
332
|
-
if (!this.fillMode.some(fillModeValue => fillModeValue.
|
|
374
|
+
if (!this.fillMode.some(fillModeValue => fillModeValue.toLowerCase() === args.options.fillMode?.toLowerCase())) {
|
|
333
375
|
return `The value of parameter fillMode must be ${this.fillMode.join(', ')}`;
|
|
334
376
|
}
|
|
335
377
|
}
|
|
336
|
-
if (args.options.
|
|
378
|
+
if (typeof args.options.zoneReflowStrategy !== 'undefined') {
|
|
379
|
+
if (!this.zoneReflowStrategy.some(zoneReflowStrategyValue => zoneReflowStrategyValue.toLowerCase() === args.options.zoneReflowStrategy?.toLowerCase())) {
|
|
380
|
+
return `The value of parameter zoneReflowStrategy must be ${this.zoneReflowStrategy.join(', ')}`;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (typeof args.options.headingLevel !== 'undefined') {
|
|
384
|
+
if (![2, 3, 4].some(headingLevelValue => headingLevelValue === args.options.headingLevel)) {
|
|
385
|
+
return `The value of parameter headingLevel must be 2, 3 or 4`;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (args.options.zoneEmphasis?.toLowerCase() !== 'image' && (args.options.imageUrl || args.options.imageWidth ||
|
|
337
389
|
args.options.imageHeight || args.options.fillMode)) {
|
|
338
390
|
return 'Specify imageUrl, imageWidth, imageHeight or fillMode only when zoneEmphasis is set to Image';
|
|
339
391
|
}
|
|
340
|
-
if (args.options.zoneEmphasis?.
|
|
392
|
+
if (args.options.zoneEmphasis?.toLowerCase() === 'image' && !args.options.imageUrl) {
|
|
341
393
|
return 'Specify imageUrl when zoneEmphasis is set to Image';
|
|
342
394
|
}
|
|
343
395
|
if (args.options.zoneEmphasis?.toLowerCase() !== 'gradient' && args.options.gradientText) {
|
|
@@ -355,10 +407,18 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
355
407
|
if (!(args.options.zoneEmphasis && ['image', 'gradient'].includes(args.options.zoneEmphasis.toLowerCase())) && (args.options.overlayColor || args.options.overlayOpacity || args.options.useLightText)) {
|
|
356
408
|
return 'Specify overlayColor or overlayOpacity only when zoneEmphasis is set to Image or Gradient';
|
|
357
409
|
}
|
|
410
|
+
if (args.options.sectionTemplate?.toLowerCase() !== 'flexible' && (args.options.zoneReflowStrategy || args.options.zoneHeight)) {
|
|
411
|
+
return 'Specify zoneReflowStrategy or zoneHeight only when sectionTemplate is set to Flexible';
|
|
412
|
+
}
|
|
413
|
+
if (typeof args.options.zoneHeight !== 'undefined') {
|
|
414
|
+
if (!Number.isInteger(args.options.zoneHeight) || args.options.zoneHeight < this.MINIMUM_ZONE_HEIGHT) {
|
|
415
|
+
return `The value of parameter zoneHeight must be ${this.MINIMUM_ZONE_HEIGHT} or higher`;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
358
418
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
359
419
|
});
|
|
360
420
|
}, _SpoPageSectionAddCommand_initTypes = function _SpoPageSectionAddCommand_initTypes() {
|
|
361
|
-
this.types.string = ['pageName', 'webUrl', 'sectionTemplate', 'zoneEmphasis', 'iconAlignment', 'gradientText', 'imageUrl', 'fillMode', 'overlayColor', 'collapsibleTitle'];
|
|
421
|
+
this.types.string = ['pageName', 'webUrl', 'sectionTemplate', 'zoneEmphasis', 'iconAlignment', 'gradientText', 'imageUrl', 'fillMode', 'overlayColor', 'collapsibleTitle', 'zoneReflowStrategy'];
|
|
362
422
|
this.types.boolean = ['isLayoutReflowOnTop', 'isCollapsibleSection', 'showDivider', 'isExpanded', 'useLightText'];
|
|
363
423
|
};
|
|
364
424
|
export default new SpoPageSectionAddCommand();
|
|
@@ -34,10 +34,14 @@ class SpoPageSectionListCommand extends SpoCommand {
|
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
await logger.log(output.map(s => {
|
|
37
|
-
|
|
37
|
+
const sectionOutput = {
|
|
38
38
|
order: s.order,
|
|
39
39
|
columns: s.columns.length
|
|
40
40
|
};
|
|
41
|
+
if (s.isVertical) {
|
|
42
|
+
sectionOutput.isVertical = s.isVertical;
|
|
43
|
+
}
|
|
44
|
+
return sectionOutput;
|
|
41
45
|
}));
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -45,9 +45,6 @@ class SpoServicePrincipalPermissionRequestListCommand extends SpoCommand {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
if (spoWebAppServicePrincipalPermissionRequestResult.length === 0) {
|
|
49
|
-
spoWebAppServicePrincipalPermissionRequestResult = result;
|
|
50
|
-
}
|
|
51
48
|
await logger.log(spoWebAppServicePrincipalPermissionRequestResult.map(r => {
|
|
52
49
|
return {
|
|
53
50
|
Id: r.Id.replace('/Guid(', '').replace(')/', ''),
|
|
@@ -71,14 +68,23 @@ class SpoServicePrincipalPermissionRequestListCommand extends SpoCommand {
|
|
|
71
68
|
responseType: 'json'
|
|
72
69
|
};
|
|
73
70
|
const response = await request.get(requestOptions);
|
|
74
|
-
if (response.value
|
|
75
|
-
return
|
|
71
|
+
if (!response.value || response.value.length === 0) {
|
|
72
|
+
return null;
|
|
76
73
|
}
|
|
77
|
-
|
|
74
|
+
const scopes = [];
|
|
75
|
+
response.value.forEach(grant => {
|
|
76
|
+
if (grant.scope) {
|
|
77
|
+
grant.scope.split(' ')
|
|
78
|
+
.map(permission => permission.trim())
|
|
79
|
+
.filter(Boolean)
|
|
80
|
+
.forEach(permission => scopes.push(permission));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return scopes;
|
|
78
84
|
}
|
|
79
85
|
async getSPOClientExtensibilityWebApplicationPrincipalId() {
|
|
80
86
|
const requestOptions = {
|
|
81
|
-
url: `https://graph.microsoft.com/v1.0/servicePrincipals/?$filter=displayName eq 'SharePoint Online Client Extensibility
|
|
87
|
+
url: `https://graph.microsoft.com/v1.0/servicePrincipals/?$filter=displayName eq 'SharePoint Online Web Client Extensibility'`,
|
|
82
88
|
headers: {
|
|
83
89
|
accept: 'application/json;odata.metadata=none'
|
|
84
90
|
},
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
1
4
|
import { odata } from '../../../../utils/odata.js';
|
|
2
5
|
import { spo } from '../../../../utils/spo.js';
|
|
3
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
4
7
|
import commands from '../../commands.js';
|
|
8
|
+
const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
excludeDeletedSites: zod.alias('excludeDeletedSites', z.boolean().optional())
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
5
13
|
class SpoSiteAppCatalogListCommand extends SpoCommand {
|
|
6
14
|
get name() {
|
|
7
15
|
return commands.SITE_APPCATALOG_LIST;
|
|
@@ -9,16 +17,44 @@ class SpoSiteAppCatalogListCommand extends SpoCommand {
|
|
|
9
17
|
get description() {
|
|
10
18
|
return 'List all site collection app catalogs within the tenant';
|
|
11
19
|
}
|
|
20
|
+
get schema() {
|
|
21
|
+
return options;
|
|
22
|
+
}
|
|
12
23
|
defaultProperties() {
|
|
13
24
|
return ['AbsoluteUrl', 'SiteID'];
|
|
14
25
|
}
|
|
15
|
-
async commandAction(logger) {
|
|
26
|
+
async commandAction(logger, args) {
|
|
16
27
|
try {
|
|
17
28
|
if (this.verbose) {
|
|
18
29
|
await logger.logToStderr('Retrieving site collection app catalogs...');
|
|
19
30
|
}
|
|
20
31
|
const spoUrl = await spo.getSpoUrl(logger, this.debug);
|
|
21
|
-
|
|
32
|
+
let appCatalogs = await odata.getAllItems(`${spoUrl}/_api/Web/TenantAppCatalog/SiteCollectionAppCatalogsSites`);
|
|
33
|
+
if (args.options.excludeDeletedSites) {
|
|
34
|
+
if (this.verbose) {
|
|
35
|
+
await logger.logToStderr('Excluding inaccessible sites from the results...');
|
|
36
|
+
}
|
|
37
|
+
const activeAppCatalogs = [];
|
|
38
|
+
for (const appCatalog of appCatalogs) {
|
|
39
|
+
try {
|
|
40
|
+
await spo.getWeb(appCatalog.AbsoluteUrl, logger, this.verbose);
|
|
41
|
+
activeAppCatalogs.push(appCatalog);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (this.debug) {
|
|
45
|
+
await logger.logToStderr(error);
|
|
46
|
+
}
|
|
47
|
+
if (error.status === 404 || error.status === 403) {
|
|
48
|
+
if (this.verbose) {
|
|
49
|
+
await logger.logToStderr(`Site at '${appCatalog.AbsoluteUrl}' is inaccessible. Excluding from results...`);
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
appCatalogs = activeAppCatalogs;
|
|
57
|
+
}
|
|
22
58
|
await logger.log(appCatalogs);
|
|
23
59
|
}
|
|
24
60
|
catch (err) {
|
|
@@ -31,7 +31,7 @@ class SpoTenantSiteUnarchiveCommand extends SpoCommand {
|
|
|
31
31
|
await this.unarchiveSite(logger, args.options.url);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'?
|
|
34
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to unarchive site '${args.options.url}'? You won't be able to rearchive this site for 120 days.` });
|
|
35
35
|
if (result) {
|
|
36
36
|
await this.unarchiveSite(logger, args.options.url);
|
|
37
37
|
}
|