@pnp/cli-microsoft365 7.0.0-beta.093ef31 → 7.0.0-beta.18ce559
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/README.md +4 -4
- package/dist/Auth.js +10 -1
- package/dist/Command.js +2 -2
- package/dist/cli/Cli.js +4 -4
- package/dist/m365/aad/commands/app/app-get.js +4 -1
- package/dist/m365/aad/commands/app/app-remove.js +3 -1
- package/dist/m365/aad/commands/app/app-role-add.js +4 -1
- package/dist/m365/aad/commands/app/app-role-list.js +4 -1
- package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
- package/dist/m365/aad/commands/app/app-set.js +8 -5
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +11 -6
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
- package/dist/m365/aad/commands/group/group-get.js +4 -4
- package/dist/m365/aad/commands/group/group-list.js +1 -23
- package/dist/m365/aad/commands/group/group-remove.js +98 -0
- package/dist/m365/aad/commands/m365group/m365group-add.js +21 -12
- package/dist/m365/aad/commands/m365group/m365group-conversation-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-conversation-post-list.js +4 -0
- package/dist/m365/aad/commands/m365group/m365group-get.js +4 -3
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
- package/dist/m365/aad/commands/m365group/m365group-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-renew.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-set.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-teamify.js +14 -6
- package/dist/m365/aad/commands/m365group/m365group-user-add.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-list.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-remove.js +5 -0
- package/dist/m365/aad/commands/m365group/m365group-user-set.js +5 -0
- package/dist/m365/aad/commands/sp/sp-add.js +4 -1
- package/dist/m365/aad/commands/sp/sp-get.js +4 -1
- package/dist/m365/aad/commands/user/user-get.js +7 -2
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/booking/commands/business/business-get.js +4 -1
- package/dist/m365/commands/login.js +2 -2
- package/dist/m365/flow/commands/flow-export.js +13 -13
- package/dist/m365/graph/commands/subscription/subscription-add.js +5 -5
- package/dist/m365/outlook/commands/message/message-list.js +4 -2
- package/dist/m365/outlook/commands/message/message-move.js +4 -2
- package/dist/m365/pa/commands/app/app-export.js +7 -7
- package/dist/m365/pa/commands/connector/connector-export.js +5 -5
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-get.js +9 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-remove.js +7 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +8 -2
- package/dist/m365/planner/commands/plan/plan-add.js +4 -1
- package/dist/m365/planner/commands/plan/plan-get.js +4 -1
- package/dist/m365/planner/commands/plan/plan-list.js +4 -1
- package/dist/m365/planner/commands/plan/plan-remove.js +4 -1
- package/dist/m365/planner/commands/plan/plan-set.js +4 -1
- package/dist/m365/planner/commands/roster/roster-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-add.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -1
- package/dist/m365/planner/commands/roster/roster-plan-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-list.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-get.js +11 -3
- package/dist/m365/planner/commands/task/task-list.js +10 -2
- package/dist/m365/planner/commands/task/task-reference-add.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-list.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-remove.js +10 -4
- package/dist/m365/planner/commands/task/task-set.js +4 -1
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
- package/dist/m365/pp/commands/card/card-get.js +3 -5
- package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
- package/dist/m365/pp/commands/chatbot/chatbot-list.js +2 -2
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
- package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0.js} +2 -2
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0.js} +35 -27
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/commandset/commandset-get.js +4 -2
- package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -1
- package/dist/m365/spo/commands/commandset/commandset-set.js +3 -1
- package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
- package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
- package/dist/m365/spo/commands/file/file-get.js +11 -8
- package/dist/m365/spo/commands/file/file-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-clear.js +2 -2
- package/dist/m365/spo/commands/file/file-version-get.js +2 -2
- package/dist/m365/spo/commands/file/file-version-list.js +2 -2
- package/dist/m365/spo/commands/file/file-version-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-restore.js +2 -2
- package/dist/m365/spo/commands/group/group-member-add.js +24 -24
- package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
- package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +127 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +97 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +121 -0
- package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +115 -0
- package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
- package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
- package/dist/m365/spo/commands/page/page-get.js +1 -0
- package/dist/m365/spo/commands/page/page-list.js +4 -3
- package/dist/m365/spo/commands/page/page-section-add.js +56 -21
- package/dist/m365/spo/commands/page/page-set.js +13 -2
- package/dist/m365/spo/commands/site/site-commsite-enable.js +34 -5
- package/dist/m365/spo/commands/site/site-list.js +5 -7
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
- package/dist/m365/spo/commands/term/term-get.js +6 -6
- package/dist/m365/spo/commands/user/user-get.js +10 -10
- package/dist/m365/spo/commands.js +4 -0
- package/dist/m365/teams/commands/app/app-remove.js +49 -15
- package/dist/m365/teams/commands/channel/channel-add.js +5 -1
- package/dist/m365/teams/commands/channel/channel-member-add.js +12 -10
- package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
- package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
- package/dist/m365/teams/commands/chat/chat-get.js +7 -10
- package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
- package/dist/m365/teams/commands/team/team-clone.js +5 -10
- package/dist/m365/teams/commands/team/team-list.js +94 -30
- package/dist/m365/tenant/commands/info/info-get.js +83 -0
- package/dist/m365/tenant/commands.js +1 -0
- package/dist/utils/aadGroup.js +21 -3
- package/dist/utils/formatting.js +7 -0
- package/dist/utils/powerPlatform.js +1 -1
- package/docs/docs/_clisettings.mdx +1 -1
- package/docs/docs/cmd/aad/app/app-set.mdx +15 -15
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +9 -9
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +10 -10
- package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
- package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
- package/docs/docs/cmd/aad/group/group-remove.mdx +44 -0
- package/docs/docs/cmd/aad/m365group/m365group-add.mdx +13 -3
- package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
- package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
- package/docs/docs/cmd/flow/flow-export.mdx +11 -11
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +10 -10
- package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
- package/docs/docs/cmd/pa/connector/connector-export.mdx +3 -3
- package/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +4 -4
- package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +2 -2
- package/docs/docs/cmd/pp/solution/solution-publisher-remove.mdx +2 -2
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +2 -2
- package/docs/docs/cmd/spo/group/group-member-add.mdx +27 -27
- package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
- package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +110 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +104 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
- package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
- package/docs/docs/cmd/spo/page/page-set.mdx +23 -0
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -2
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
- package/docs/docs/cmd/spo/user/user-get.mdx +8 -8
- package/docs/docs/cmd/teams/app/app-remove.mdx +9 -6
- package/docs/docs/cmd/teams/channel/channel-member-add.mdx +4 -4
- package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
- package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
- package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
- package/npm-shrinkwrap.json +24 -24
- package/package.json +8 -12
|
@@ -0,0 +1,97 @@
|
|
|
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 _SpoListItemAttachmentGetCommand_instances, _SpoListItemAttachmentGetCommand_initTelemetry, _SpoListItemAttachmentGetCommand_initOptions, _SpoListItemAttachmentGetCommand_initValidators, _SpoListItemAttachmentGetCommand_initOptionSets;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
class SpoListItemAttachmentGetCommand extends SpoCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.LISTITEM_ATTACHMENT_GET;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Gets an attachment from a list item';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpoListItemAttachmentGetCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentGetCommand_instances, "m", _SpoListItemAttachmentGetCommand_initOptionSets).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
30
|
+
if (args.options.listId) {
|
|
31
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
32
|
+
}
|
|
33
|
+
else if (args.options.listTitle) {
|
|
34
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
35
|
+
}
|
|
36
|
+
else if (args.options.listUrl) {
|
|
37
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
38
|
+
requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
39
|
+
}
|
|
40
|
+
const requestOptions = {
|
|
41
|
+
url: `${requestUrl}/items(${args.options.listItemId})/AttachmentFiles('${args.options.fileName}')`,
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
'accept': 'application/json;odata=nometadata'
|
|
45
|
+
},
|
|
46
|
+
responseType: 'json'
|
|
47
|
+
};
|
|
48
|
+
try {
|
|
49
|
+
const attachmentFile = await request.get(requestOptions);
|
|
50
|
+
await logger.log(attachmentFile);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_SpoListItemAttachmentGetCommand_instances = new WeakSet(), _SpoListItemAttachmentGetCommand_initTelemetry = function _SpoListItemAttachmentGetCommand_initTelemetry() {
|
|
58
|
+
this.telemetry.push((args) => {
|
|
59
|
+
Object.assign(this.telemetryProperties, {
|
|
60
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
61
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
62
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}, _SpoListItemAttachmentGetCommand_initOptions = function _SpoListItemAttachmentGetCommand_initOptions() {
|
|
66
|
+
this.options.unshift({
|
|
67
|
+
option: '-u, --webUrl <webUrl>'
|
|
68
|
+
}, {
|
|
69
|
+
option: '--listId [listId]'
|
|
70
|
+
}, {
|
|
71
|
+
option: '--listTitle [listTitle]'
|
|
72
|
+
}, {
|
|
73
|
+
option: '--listUrl [listUrl]'
|
|
74
|
+
}, {
|
|
75
|
+
option: '--listItemId <listItemId>'
|
|
76
|
+
}, {
|
|
77
|
+
option: '-n, --fileName <fileName>'
|
|
78
|
+
});
|
|
79
|
+
}, _SpoListItemAttachmentGetCommand_initValidators = function _SpoListItemAttachmentGetCommand_initValidators() {
|
|
80
|
+
this.validators.push(async (args) => {
|
|
81
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
82
|
+
if (isValidSharePointUrl !== true) {
|
|
83
|
+
return isValidSharePointUrl;
|
|
84
|
+
}
|
|
85
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
86
|
+
return `${args.options.listId} in option listId is not a valid GUID.`;
|
|
87
|
+
}
|
|
88
|
+
if (isNaN(args.options.listItemId)) {
|
|
89
|
+
return `${args.options.listItemId} is not a number.`;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
}, _SpoListItemAttachmentGetCommand_initOptionSets = function _SpoListItemAttachmentGetCommand_initOptionSets() {
|
|
94
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
95
|
+
};
|
|
96
|
+
export default new SpoListItemAttachmentGetCommand();
|
|
97
|
+
//# sourceMappingURL=listitem-attachment-get.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
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 _SpoListItemAttachmentRemoveCommand_instances, _SpoListItemAttachmentRemoveCommand_initTelemetry, _SpoListItemAttachmentRemoveCommand_initOptions, _SpoListItemAttachmentRemoveCommand_initValidators, _SpoListItemAttachmentRemoveCommand_initOptionSets;
|
|
7
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class SpoListItemAttachmentRemoveCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.LISTITEM_ATTACHMENT_REMOVE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Removes an attachment from a list item';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoListItemAttachmentRemoveCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentRemoveCommand_instances, "m", _SpoListItemAttachmentRemoveCommand_initOptionSets).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
const removeListItemAttachment = async () => {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
const list = (args.options.listId ? args.options.listId : args.options.listTitle ? args.options.listTitle : args.options.listUrl);
|
|
33
|
+
await logger.logToStderr(`Removing attachment ${args.options.fileName} of item with id ${args.options.listItemId} from list ${list} in site at ${args.options.webUrl}...`);
|
|
34
|
+
}
|
|
35
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
36
|
+
if (args.options.listId) {
|
|
37
|
+
requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
38
|
+
}
|
|
39
|
+
else if (args.options.listTitle) {
|
|
40
|
+
requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
41
|
+
}
|
|
42
|
+
else if (args.options.listUrl) {
|
|
43
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
44
|
+
requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
45
|
+
}
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
url: `${requestUrl}/items(${args.options.listItemId})/AttachmentFiles('${args.options.fileName}')`,
|
|
48
|
+
headers: {
|
|
49
|
+
'X-HTTP-Method': 'DELETE',
|
|
50
|
+
'If-Match': '*',
|
|
51
|
+
'accept': 'application/json;odata=nometadata'
|
|
52
|
+
},
|
|
53
|
+
responseType: 'json'
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
await request.post(requestOptions);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (args.options.force) {
|
|
63
|
+
await removeListItemAttachment();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const result = await Cli.prompt({
|
|
67
|
+
type: 'confirm',
|
|
68
|
+
name: 'continue',
|
|
69
|
+
default: false,
|
|
70
|
+
message: `Are you sure you want to remove the attachment ${args.options.fileName} of item with id ${args.options.listItemId} from the list ${args.options.listId ? args.options.listId : args.options.listTitle ? args.options.listTitle : args.options.listUrl} in site ${args.options.webUrl}?`
|
|
71
|
+
});
|
|
72
|
+
if (result.continue) {
|
|
73
|
+
await removeListItemAttachment();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_SpoListItemAttachmentRemoveCommand_instances = new WeakSet(), _SpoListItemAttachmentRemoveCommand_initTelemetry = function _SpoListItemAttachmentRemoveCommand_initTelemetry() {
|
|
79
|
+
this.telemetry.push((args) => {
|
|
80
|
+
Object.assign(this.telemetryProperties, {
|
|
81
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
82
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
83
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
84
|
+
force: (!(!args.options.force)).toString()
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}, _SpoListItemAttachmentRemoveCommand_initOptions = function _SpoListItemAttachmentRemoveCommand_initOptions() {
|
|
88
|
+
this.options.unshift({
|
|
89
|
+
option: '-u, --webUrl <webUrl>'
|
|
90
|
+
}, {
|
|
91
|
+
option: '--listId [listId]'
|
|
92
|
+
}, {
|
|
93
|
+
option: '--listTitle [listTitle]'
|
|
94
|
+
}, {
|
|
95
|
+
option: '--listUrl [listUrl]'
|
|
96
|
+
}, {
|
|
97
|
+
option: '--listItemId <listItemId>'
|
|
98
|
+
}, {
|
|
99
|
+
option: '-n, --fileName <fileName>'
|
|
100
|
+
}, {
|
|
101
|
+
option: '-f, --force'
|
|
102
|
+
});
|
|
103
|
+
}, _SpoListItemAttachmentRemoveCommand_initValidators = function _SpoListItemAttachmentRemoveCommand_initValidators() {
|
|
104
|
+
this.validators.push(async (args) => {
|
|
105
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
106
|
+
if (isValidSharePointUrl !== true) {
|
|
107
|
+
return isValidSharePointUrl;
|
|
108
|
+
}
|
|
109
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
110
|
+
return `${args.options.listId} in option listId is not a valid GUID`;
|
|
111
|
+
}
|
|
112
|
+
if (isNaN(args.options.listItemId)) {
|
|
113
|
+
return `${args.options.listItemId} is not a number`;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
}, _SpoListItemAttachmentRemoveCommand_initOptionSets = function _SpoListItemAttachmentRemoveCommand_initOptionSets() {
|
|
118
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
119
|
+
};
|
|
120
|
+
export default new SpoListItemAttachmentRemoveCommand();
|
|
121
|
+
//# sourceMappingURL=listitem-attachment-remove.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
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 _SpoListItemAttachmentSetCommand_instances, _SpoListItemAttachmentSetCommand_initTelemetry, _SpoListItemAttachmentSetCommand_initOptions, _SpoListItemAttachmentSetCommand_initValidators, _SpoListItemAttachmentSetCommand_initOptionSets;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
import fs from 'fs';
|
|
14
|
+
class SpoListItemAttachmentSetCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.LISTITEM_ATTACHMENT_SET;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Updates an attachment from a list item';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoListItemAttachmentSetCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoListItemAttachmentSetCommand_instances, "m", _SpoListItemAttachmentSetCommand_initOptionSets).call(this);
|
|
28
|
+
}
|
|
29
|
+
async commandAction(logger, args) {
|
|
30
|
+
if (this.verbose) {
|
|
31
|
+
await logger.logToStderr(`Updating attachment ${args.options.fileName} at path ${args.options.filePath} for list item with id ${args.options.listItemId} on list ${args.options.listId || args.options.listTitle || args.options.listUrl} on web ${args.options.webUrl}.`);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const fileName = this.getFileName(args.options.filePath, args.options.fileName);
|
|
35
|
+
const fileBody = fs.readFileSync(args.options.filePath);
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
url: `${args.options.webUrl}/_api/web/${this.getListUrl(args.options.webUrl, args.options.listId, args.options.listTitle, args.options.listUrl)}/items(${args.options.listItemId})/AttachmentFiles('${fileName}')/$value`,
|
|
38
|
+
headers: {
|
|
39
|
+
'accept': 'application/json;odata=nometadata'
|
|
40
|
+
},
|
|
41
|
+
data: fileBody,
|
|
42
|
+
responseType: 'json'
|
|
43
|
+
};
|
|
44
|
+
await request.put(requestOptions);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
this.handleRejectedODataJsonPromise(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getFileName(filePath, fileName) {
|
|
51
|
+
const extension = filePath.split('.').pop();
|
|
52
|
+
if (!fileName.endsWith(`.${extension}`)) {
|
|
53
|
+
fileName += `.${extension}`;
|
|
54
|
+
}
|
|
55
|
+
return fileName;
|
|
56
|
+
}
|
|
57
|
+
getListUrl(webUrl, listId, listTitle, listUrl) {
|
|
58
|
+
if (listId) {
|
|
59
|
+
return `lists(guid'${formatting.encodeQueryParameter(listId)}')`;
|
|
60
|
+
}
|
|
61
|
+
else if (listTitle) {
|
|
62
|
+
return `lists/getByTitle('${formatting.encodeQueryParameter(listTitle)}')`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
|
|
66
|
+
return `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
_SpoListItemAttachmentSetCommand_instances = new WeakSet(), _SpoListItemAttachmentSetCommand_initTelemetry = function _SpoListItemAttachmentSetCommand_initTelemetry() {
|
|
71
|
+
this.telemetry.push((args) => {
|
|
72
|
+
Object.assign(this.telemetryProperties, {
|
|
73
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
74
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
75
|
+
listUrl: typeof args.options.listUrl !== 'undefined'
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, _SpoListItemAttachmentSetCommand_initOptions = function _SpoListItemAttachmentSetCommand_initOptions() {
|
|
79
|
+
this.options.unshift({
|
|
80
|
+
option: '-u, --webUrl <webUrl>'
|
|
81
|
+
}, {
|
|
82
|
+
option: '--listId [listId]'
|
|
83
|
+
}, {
|
|
84
|
+
option: '--listTitle [listTitle]'
|
|
85
|
+
}, {
|
|
86
|
+
option: '--listUrl [listUrl]'
|
|
87
|
+
}, {
|
|
88
|
+
option: '--listItemId <listItemId>'
|
|
89
|
+
}, {
|
|
90
|
+
option: '-p, --filePath <filePath>'
|
|
91
|
+
}, {
|
|
92
|
+
option: '-n, --fileName <fileName>'
|
|
93
|
+
});
|
|
94
|
+
}, _SpoListItemAttachmentSetCommand_initValidators = function _SpoListItemAttachmentSetCommand_initValidators() {
|
|
95
|
+
this.validators.push(async (args) => {
|
|
96
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
97
|
+
if (isValidSharePointUrl !== true) {
|
|
98
|
+
return isValidSharePointUrl;
|
|
99
|
+
}
|
|
100
|
+
if (isNaN(args.options.listItemId)) {
|
|
101
|
+
return `${args.options.listItemId} in option listItemId is not a valid number.`;
|
|
102
|
+
}
|
|
103
|
+
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
104
|
+
return `${args.options.listId} in option listId is not a valid GUID.`;
|
|
105
|
+
}
|
|
106
|
+
if (!fs.existsSync(args.options.filePath)) {
|
|
107
|
+
return `File with path '${args.options.filePath}' was not found.`;
|
|
108
|
+
}
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
}, _SpoListItemAttachmentSetCommand_initOptionSets = function _SpoListItemAttachmentSetCommand_initOptionSets() {
|
|
112
|
+
this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
|
|
113
|
+
};
|
|
114
|
+
export default new SpoListItemAttachmentSetCommand();
|
|
115
|
+
//# sourceMappingURL=listitem-attachment-set.js.map
|
|
@@ -188,8 +188,9 @@ class SpoListItemSetCommand extends SpoCommand {
|
|
|
188
188
|
},
|
|
189
189
|
responseType: 'json'
|
|
190
190
|
};
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const item = await request.get(requestOptionsItems);
|
|
192
|
+
delete item.ID;
|
|
193
|
+
await logger.log(item);
|
|
193
194
|
}
|
|
194
195
|
catch (err) {
|
|
195
196
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -26,7 +26,25 @@ export var CanvasSectionTemplate;
|
|
|
26
26
|
/// Two columns, left one is 1/3, right one 2/3
|
|
27
27
|
/// </summary>
|
|
28
28
|
CanvasSectionTemplate[CanvasSectionTemplate["TwoColumnRight"] = 5] = "TwoColumnRight";
|
|
29
|
+
/// <summary>
|
|
30
|
+
/// Vertical
|
|
31
|
+
/// </summary>
|
|
32
|
+
CanvasSectionTemplate[CanvasSectionTemplate["Vertical"] = 6] = "Vertical";
|
|
29
33
|
})(CanvasSectionTemplate || (CanvasSectionTemplate = {}));
|
|
34
|
+
/**
|
|
35
|
+
* Section background shading
|
|
36
|
+
* 0 - None
|
|
37
|
+
* 1 - Neutral
|
|
38
|
+
* 2 - Soft
|
|
39
|
+
* 3 - Strong
|
|
40
|
+
*/
|
|
41
|
+
export var ZoneEmphasis;
|
|
42
|
+
(function (ZoneEmphasis) {
|
|
43
|
+
ZoneEmphasis[ZoneEmphasis["None"] = 0] = "None";
|
|
44
|
+
ZoneEmphasis[ZoneEmphasis["Neutral"] = 1] = "Neutral";
|
|
45
|
+
ZoneEmphasis[ZoneEmphasis["Soft"] = 2] = "Soft";
|
|
46
|
+
ZoneEmphasis[ZoneEmphasis["Strong"] = 3] = "Strong";
|
|
47
|
+
})(ZoneEmphasis || (ZoneEmphasis = {}));
|
|
30
48
|
/**
|
|
31
49
|
* Shorthand for Object.hasOwnProperty
|
|
32
50
|
*
|
|
@@ -34,9 +34,9 @@ class SpoPageListCommand extends SpoCommand {
|
|
|
34
34
|
if (pagesList && pagesList.length > 0) {
|
|
35
35
|
pages = pagesList;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const clientSidePages =
|
|
37
|
+
const files = await odata.getAllItems(`${args.options.webUrl}/_api/web/lists/SitePages/rootfolder/files?$expand=ListItemAllFields/ClientSideApplicationId&$orderby=Name`);
|
|
38
|
+
if (files?.length > 0) {
|
|
39
|
+
const clientSidePages = files.filter(f => f.ListItemAllFields.ClientSideApplicationId === 'b6917cb1-93a0-4b97-a84d-7cf49975d4ec');
|
|
40
40
|
pages = pages.map(p => {
|
|
41
41
|
const clientSidePage = clientSidePages.find(cp => cp && cp.ListItemAllFields && cp.ListItemAllFields.Id === p.Id);
|
|
42
42
|
if (clientSidePage) {
|
|
@@ -47,6 +47,7 @@ class SpoPageListCommand extends SpoCommand {
|
|
|
47
47
|
}
|
|
48
48
|
return p;
|
|
49
49
|
});
|
|
50
|
+
pages.filter(p => p.ListItemAllFields).forEach(page => delete page.ListItemAllFields.ID);
|
|
50
51
|
await logger.log(pages);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
@@ -3,13 +3,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _SpoPageSectionAddCommand_instances, _SpoPageSectionAddCommand_initTelemetry, _SpoPageSectionAddCommand_initOptions, _SpoPageSectionAddCommand_initValidators;
|
|
6
|
+
var _SpoPageSectionAddCommand_instances, _a, _SpoPageSectionAddCommand_initTelemetry, _SpoPageSectionAddCommand_initOptions, _SpoPageSectionAddCommand_initValidators;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.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 { CanvasSectionTemplate } from './clientsidepages.js';
|
|
12
|
+
import { CanvasSectionTemplate, ZoneEmphasis } from './clientsidepages.js';
|
|
13
13
|
class SpoPageSectionAddCommand extends SpoCommand {
|
|
14
14
|
get name() {
|
|
15
15
|
return commands.PAGE_SECTION_ADD;
|
|
@@ -67,7 +67,7 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
67
67
|
// zoneIndex for the new section to add
|
|
68
68
|
const zoneIndex = this.getSectionIndex(zoneIndices, args.options.order);
|
|
69
69
|
// get the list of columns to insert based on the selected template
|
|
70
|
-
const columnsToAdd = this.getColumns(zoneIndex, args.options.sectionTemplate);
|
|
70
|
+
const columnsToAdd = this.getColumns(zoneIndex, args.options.sectionTemplate, args.options.zoneEmphasis, args.options.isLayoutReflowOnTop);
|
|
71
71
|
// insert the column in the right place in the array so that
|
|
72
72
|
// it stays sorted ascending by zoneIndex
|
|
73
73
|
let pos = canvasContent.findIndex(c => typeof c.controlType === 'undefined' && c.position.zoneIndex > zoneIndex);
|
|
@@ -107,39 +107,42 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
107
107
|
}
|
|
108
108
|
return zoneIndices[order - 2] + ((zoneIndices[order - 1] - zoneIndices[order - 2]) / 2);
|
|
109
109
|
}
|
|
110
|
-
getColumns(zoneIndex, sectionTemplate) {
|
|
110
|
+
getColumns(zoneIndex, sectionTemplate, zoneEmphasis, isLayoutReflowOnTop) {
|
|
111
111
|
const columns = [];
|
|
112
112
|
let sectionIndex = 1;
|
|
113
113
|
switch (sectionTemplate) {
|
|
114
114
|
case 'OneColumnFullWidth':
|
|
115
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 0));
|
|
115
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 0, zoneEmphasis));
|
|
116
116
|
break;
|
|
117
117
|
case 'TwoColumn':
|
|
118
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6));
|
|
119
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6));
|
|
118
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6, zoneEmphasis));
|
|
119
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 6, zoneEmphasis));
|
|
120
120
|
break;
|
|
121
121
|
case 'ThreeColumn':
|
|
122
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4));
|
|
123
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4));
|
|
124
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4));
|
|
122
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, zoneEmphasis));
|
|
123
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, zoneEmphasis));
|
|
124
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, zoneEmphasis));
|
|
125
125
|
break;
|
|
126
126
|
case 'TwoColumnLeft':
|
|
127
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8));
|
|
128
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4));
|
|
127
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8, zoneEmphasis));
|
|
128
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, zoneEmphasis));
|
|
129
129
|
break;
|
|
130
130
|
case 'TwoColumnRight':
|
|
131
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4));
|
|
132
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8));
|
|
131
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 4, zoneEmphasis));
|
|
132
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 8, zoneEmphasis));
|
|
133
|
+
break;
|
|
134
|
+
case 'Vertical':
|
|
135
|
+
columns.push(this.getVerticalColumn(zoneEmphasis, isLayoutReflowOnTop));
|
|
133
136
|
break;
|
|
134
137
|
case 'OneColumn':
|
|
135
138
|
default:
|
|
136
|
-
columns.push(this.getColumn(zoneIndex, sectionIndex++, 12));
|
|
139
|
+
columns.push(this.getColumn(zoneIndex, sectionIndex++, 12, zoneEmphasis));
|
|
137
140
|
break;
|
|
138
141
|
}
|
|
139
142
|
return columns;
|
|
140
143
|
}
|
|
141
|
-
getColumn(zoneIndex, sectionIndex, sectionFactor) {
|
|
142
|
-
|
|
144
|
+
getColumn(zoneIndex, sectionIndex, sectionFactor, zoneEmphasis) {
|
|
145
|
+
const columnValue = {
|
|
143
146
|
displayMode: 2,
|
|
144
147
|
position: {
|
|
145
148
|
zoneIndex: zoneIndex,
|
|
@@ -149,12 +152,26 @@ class SpoPageSectionAddCommand extends SpoCommand {
|
|
|
149
152
|
},
|
|
150
153
|
emphasis: {}
|
|
151
154
|
};
|
|
155
|
+
if (zoneEmphasis) {
|
|
156
|
+
const zoneEmphasisValue = ZoneEmphasis[zoneEmphasis];
|
|
157
|
+
columnValue.emphasis = { zoneEmphasis: zoneEmphasisValue };
|
|
158
|
+
}
|
|
159
|
+
return columnValue;
|
|
160
|
+
}
|
|
161
|
+
getVerticalColumn(zoneEmphasis, isLayoutReflowOnTop) {
|
|
162
|
+
const columnValue = this.getColumn(1, 1, 12, zoneEmphasis);
|
|
163
|
+
columnValue.position.isLayoutReflowOnTop = isLayoutReflowOnTop !== undefined ? true : false;
|
|
164
|
+
columnValue.position.layoutIndex = 2;
|
|
165
|
+
columnValue.position.controlIndex = 1;
|
|
166
|
+
return columnValue;
|
|
152
167
|
}
|
|
153
168
|
}
|
|
154
|
-
_SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_initTelemetry = function _SpoPageSectionAddCommand_initTelemetry() {
|
|
169
|
+
_a = SpoPageSectionAddCommand, _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_initTelemetry = function _SpoPageSectionAddCommand_initTelemetry() {
|
|
155
170
|
this.telemetry.push((args) => {
|
|
156
171
|
Object.assign(this.telemetryProperties, {
|
|
157
|
-
order: typeof args.options.order !== 'undefined'
|
|
172
|
+
order: typeof args.options.order !== 'undefined',
|
|
173
|
+
zoneEmphasis: typeof args.options.zoneEmphasis !== 'undefined',
|
|
174
|
+
isLayoutReflowOnTop: !!args.options.isLayoutReflowOnTop
|
|
158
175
|
});
|
|
159
176
|
});
|
|
160
177
|
}, _SpoPageSectionAddCommand_initOptions = function _SpoPageSectionAddCommand_initOptions() {
|
|
@@ -163,22 +180,40 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
|
|
|
163
180
|
}, {
|
|
164
181
|
option: '-u, --webUrl <webUrl>'
|
|
165
182
|
}, {
|
|
166
|
-
option: '-t, --sectionTemplate <sectionTemplate>'
|
|
183
|
+
option: '-t, --sectionTemplate <sectionTemplate>',
|
|
184
|
+
autocomplete: _a.SectionTemplate
|
|
167
185
|
}, {
|
|
168
186
|
option: '--order [order]'
|
|
187
|
+
}, {
|
|
188
|
+
option: '--zoneEmphasis [zoneEmphasis]',
|
|
189
|
+
autocomplete: _a.ZoneEmphasis
|
|
190
|
+
}, {
|
|
191
|
+
option: '--isLayoutReflowOnTop'
|
|
169
192
|
});
|
|
170
193
|
}, _SpoPageSectionAddCommand_initValidators = function _SpoPageSectionAddCommand_initValidators() {
|
|
171
194
|
this.validators.push(async (args) => {
|
|
172
195
|
if (!(args.options.sectionTemplate in CanvasSectionTemplate)) {
|
|
173
|
-
return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight`;
|
|
196
|
+
return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight|Vertical`;
|
|
174
197
|
}
|
|
175
198
|
if (typeof args.options.order !== 'undefined') {
|
|
176
199
|
if (!Number.isInteger(args.options.order) || args.options.order < 1) {
|
|
177
200
|
return 'The value of parameter order must be 1 or higher';
|
|
178
201
|
}
|
|
179
202
|
}
|
|
203
|
+
if (typeof args.options.zoneEmphasis !== 'undefined') {
|
|
204
|
+
if (!(args.options.zoneEmphasis in ZoneEmphasis)) {
|
|
205
|
+
return 'The value of parameter zoneEmphasis must be None|Neutral|Soft|Strong';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (typeof args.options.isLayoutReflowOnTop !== 'undefined') {
|
|
209
|
+
if (args.options.sectionTemplate !== 'Vertical') {
|
|
210
|
+
return 'Specify isLayoutReflowOnTop when the sectionTemplate is set to Vertical.';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
180
213
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
181
214
|
});
|
|
182
215
|
};
|
|
216
|
+
SpoPageSectionAddCommand.SectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical'];
|
|
217
|
+
SpoPageSectionAddCommand.ZoneEmphasis = ['None', 'Neutral', 'Soft', 'Strong'];
|
|
183
218
|
export default new SpoPageSectionAddCommand();
|
|
184
219
|
//# sourceMappingURL=page-section-add.js.map
|
|
@@ -58,7 +58,7 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
58
58
|
pageTitle = pageTitle || page.Title;
|
|
59
59
|
pageId = page.Id;
|
|
60
60
|
bannerImageUrl = page.BannerImageUrl;
|
|
61
|
-
canvasContent1 = page.CanvasContent1;
|
|
61
|
+
canvasContent1 = args.options.content || page.CanvasContent1;
|
|
62
62
|
layoutWebpartsContent = page.LayoutWebpartsContent;
|
|
63
63
|
pageDescription = pageDescription || page.Description;
|
|
64
64
|
topicHeader = page.TopicHeader;
|
|
@@ -277,7 +277,8 @@ _SpoPageSetCommand_instances = new WeakSet(), _SpoPageSetCommand_initTelemetry =
|
|
|
277
277
|
publish: args.options.publish || false,
|
|
278
278
|
publishMessage: typeof args.options.publishMessage !== 'undefined',
|
|
279
279
|
description: typeof args.options.description !== 'undefined',
|
|
280
|
-
title: typeof args.options.title !== 'undefined'
|
|
280
|
+
title: typeof args.options.title !== 'undefined',
|
|
281
|
+
content: typeof args.options.content !== 'undefined'
|
|
281
282
|
});
|
|
282
283
|
});
|
|
283
284
|
}, _SpoPageSetCommand_initOptions = function _SpoPageSetCommand_initOptions() {
|
|
@@ -305,6 +306,8 @@ _SpoPageSetCommand_instances = new WeakSet(), _SpoPageSetCommand_initTelemetry =
|
|
|
305
306
|
option: '--description [description]'
|
|
306
307
|
}, {
|
|
307
308
|
option: '--title [title]'
|
|
309
|
+
}, {
|
|
310
|
+
option: '--content [content]'
|
|
308
311
|
});
|
|
309
312
|
}, _SpoPageSetCommand_initTypes = function _SpoPageSetCommand_initTypes() {
|
|
310
313
|
this.types.boolean.push('commentsEnabled');
|
|
@@ -332,6 +335,14 @@ _SpoPageSetCommand_instances = new WeakSet(), _SpoPageSetCommand_initTelemetry =
|
|
|
332
335
|
if (args.options.promoteAs === 'NewsPage' && args.options.layoutType && args.options.layoutType !== 'Article') {
|
|
333
336
|
return 'You can only promote article pages as news article';
|
|
334
337
|
}
|
|
338
|
+
if (args.options.content) {
|
|
339
|
+
try {
|
|
340
|
+
JSON.parse(args.options.content);
|
|
341
|
+
}
|
|
342
|
+
catch (e) {
|
|
343
|
+
return `Specified content is not a valid JSON string. Input: ${args.options.content}. Error: ${e}`;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
335
346
|
return true;
|
|
336
347
|
});
|
|
337
348
|
};
|