@pnp/cli-microsoft365 6.9.0-beta.f6054b4 → 6.10.0-beta.81a81c0
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/.devcontainer/Dockerfile +12 -19
- package/.devcontainer/devcontainer.json +24 -17
- package/Dockerfile +3 -1
- package/dist/Auth.js +2 -8
- package/dist/AuthServer.js +2 -4
- package/dist/cli/Cli.js +2 -2
- package/dist/m365/aad/commands/app/app-add.js +258 -249
- package/dist/m365/aad/commands/app/app-get.js +65 -62
- package/dist/m365/aad/commands/app/app-remove.js +22 -23
- package/dist/m365/aad/commands/app/app-role-add.js +35 -34
- package/dist/m365/aad/commands/app/app-role-list.js +22 -23
- package/dist/m365/aad/commands/app/app-role-remove.js +76 -73
- package/dist/m365/aad/commands/app/app-set.js +103 -103
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +16 -14
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +43 -52
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +20 -16
- package/dist/m365/aad/commands/o365group/o365group-add.js +40 -37
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +7 -6
- package/dist/m365/aad/commands/o365group/o365group-list.js +6 -11
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +7 -8
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +23 -24
- package/dist/m365/aad/commands/o365group/o365group-set.js +15 -20
- package/dist/m365/aad/commands/o365group/o365group-teamify.js +15 -16
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +17 -10
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +17 -10
- package/dist/m365/aad/commands/policy/policy-list.js +12 -13
- package/dist/m365/aad/commands/siteclassification/siteclassification-enable.js +1 -3
- package/dist/m365/aad/commands/siteclassification/siteclassification-set.js +19 -20
- package/dist/m365/aad/commands/sp/sp-add.js +22 -23
- package/dist/m365/aad/commands/sp/sp-get.js +22 -23
- package/dist/m365/aad/commands/sp/sp-list.js +78 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/app/commands/app-open.js +4 -14
- package/dist/m365/base/AzmgmtItemsListCommand.js +31 -33
- package/dist/m365/cli/commands/cli-issue.js +4 -10
- package/dist/m365/cli/commands/cli-reconsent.js +2 -8
- package/dist/m365/cli/commands/config/config-set.js +0 -1
- package/dist/m365/commands/docs.js +2 -8
- package/dist/m365/commands/login.js +20 -0
- package/dist/m365/file/commands/convert/convert-pdf.js +147 -143
- package/dist/m365/file/commands/file-add.js +87 -93
- package/dist/m365/file/commands/file-list.js +49 -55
- package/dist/m365/flow/commands/flow-list.js +30 -12
- package/dist/m365/flow/commands/flow-remove.js +2 -3
- package/dist/m365/flow/commands/run/run-resubmit.js +11 -10
- package/dist/m365/onedrive/commands/onedrive-list.js +21 -32
- package/dist/m365/outlook/commands/message/message-list.js +18 -23
- package/dist/m365/outlook/commands/message/message-move.js +15 -20
- package/dist/m365/pa/commands/app/app-export.js +3 -4
- package/dist/m365/pa/commands/app/app-get.js +11 -9
- package/dist/m365/pa/commands/app/app-remove.js +1 -1
- package/dist/m365/pa/commands/pcf/pcf-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-reference-add.js +1 -2
- package/dist/m365/planner/commands/bucket/bucket-add.js +15 -13
- package/dist/m365/planner/commands/bucket/bucket-get.js +27 -28
- package/dist/m365/planner/commands/bucket/bucket-list.js +15 -13
- package/dist/m365/planner/commands/bucket/bucket-remove.js +33 -34
- package/dist/m365/planner/commands/bucket/bucket-set.js +33 -34
- package/dist/m365/planner/commands/plan/plan-add.js +49 -52
- package/dist/m365/planner/commands/plan/plan-set.js +19 -20
- package/dist/m365/planner/commands/task/task-add.js +75 -78
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +11 -10
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +10 -8
- package/dist/m365/planner/commands/task/task-get.js +53 -56
- package/dist/m365/planner/commands/task/task-list.js +23 -24
- package/dist/m365/planner/commands/task/task-reference-add.js +11 -10
- package/dist/m365/planner/commands/task/task-reference-remove.js +13 -14
- package/dist/m365/planner/commands/task/task-remove.js +44 -48
- package/dist/m365/planner/commands/task/task-set.js +83 -87
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +19 -20
- package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +3 -8
- package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +1 -6
- package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +1 -6
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +1 -6
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +1 -6
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +1 -6
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +1 -6
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +1 -6
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +1 -6
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +19 -22
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +0 -5
- package/dist/m365/spfx/commands/project/JsonRule.js +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.3.js +25 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.4.js +25 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +3 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002027_DEVDEP_fluentui_react.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021003_PKG_engines_node.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.3.js +59 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.4.js +55 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +3 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +30 -0
- package/dist/m365/spo/commands/app/app-teamspackage-download.js +17 -24
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +154 -0
- package/dist/m365/spo/commands/apppage/apppage-set.js +1 -1
- package/dist/m365/spo/commands/commandset/commandset-set.js +11 -2
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +65 -94
- package/dist/m365/spo/commands/customaction/customaction-clear.js +4 -12
- package/dist/m365/spo/commands/customaction/customaction-remove.js +12 -23
- package/dist/m365/spo/commands/customaction/customaction-set.js +21 -29
- package/dist/m365/spo/commands/file/file-add.js +133 -133
- package/dist/m365/spo/commands/file/file-checkout-undo.js +119 -0
- package/dist/m365/spo/commands/file/file-rename.js +11 -9
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +2 -2
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +41 -61
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +3 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +3 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +3 -0
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +23 -21
- package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
- package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +3 -3
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/group/group-member-add.js +17 -16
- package/dist/m365/spo/commands/group/group-set.js +20 -20
- package/dist/m365/spo/commands/homesite/homesite-remove.js +1 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +33 -31
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +18 -29
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +3 -0
- package/dist/m365/spo/commands/list/list-add.js +1 -1
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +1 -1
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +45 -52
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +33 -38
- package/dist/m365/spo/commands/list/list-sensitivitylabel-ensure.js +137 -0
- package/dist/m365/spo/commands/list/list-view-field-add.js +12 -10
- package/dist/m365/spo/commands/list/list-view-field-remove.js +12 -10
- package/dist/m365/spo/commands/list/list-view-field-set.js +12 -10
- package/dist/m365/spo/commands/list/list-view-remove.js +3 -0
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +41 -61
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +71 -74
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +36 -34
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +32 -30
- package/dist/m365/spo/commands/navigation/navigation-node-remove.js +24 -22
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +29 -27
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +26 -24
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +34 -40
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +23 -21
- package/dist/m365/spo/commands/sitescript/sitescript-remove.js +24 -22
- package/dist/m365/spo/commands/spo-search.js +7 -15
- package/dist/m365/spo/commands/storageentity/storageentity-remove.js +29 -27
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +156 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +50 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +1 -1
- package/dist/m365/spo/commands.js +5 -0
- package/dist/m365/teams/commands/app/app-install.js +23 -21
- package/dist/m365/teams/commands/app/app-remove.js +3 -0
- package/dist/m365/teams/commands/app/app-uninstall.js +3 -0
- package/dist/m365/teams/commands/app/app-update.js +15 -16
- package/dist/m365/teams/commands/channel/channel-add.js +40 -39
- package/dist/m365/teams/commands/channel/channel-get.js +23 -25
- package/dist/m365/teams/commands/channel/channel-list.js +6 -7
- package/dist/m365/teams/commands/channel/channel-member-add.js +61 -60
- package/dist/m365/teams/commands/channel/channel-member-list.js +20 -22
- package/dist/m365/teams/commands/channel/channel-member-remove.js +43 -48
- package/dist/m365/teams/commands/channel/channel-member-set.js +36 -39
- package/dist/m365/teams/commands/channel/channel-remove.js +4 -1
- package/dist/m365/teams/commands/funsettings/funsettings-list.js +3 -0
- package/dist/m365/teams/commands/funsettings/funsettings-set.js +3 -0
- package/dist/m365/teams/commands/tab/tab-get.js +34 -37
- package/dist/m365/teams/commands/team/team-archive.js +6 -7
- package/dist/m365/teams/commands/team/team-get.js +6 -7
- package/dist/m365/teams/commands/team/team-list.js +9 -11
- package/dist/m365/teams/commands/team/team-remove.js +6 -7
- package/dist/m365/teams/commands/team/team-unarchive.js +6 -7
- package/dist/m365/teams/commands/user/user-app-list.js +13 -11
- package/dist/m365/teams/commands/user/user-list.js +7 -4
- package/dist/m365/tenant/commands/security/security-alerts-list.js +25 -26
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +13 -14
- package/dist/m365/todo/commands/list/list-remove.js +39 -36
- package/dist/m365/todo/commands/list/list-set.js +16 -14
- package/dist/m365/todo/commands/task/task-add.js +14 -14
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -7
- package/dist/settingsNames.js +0 -1
- package/dist/utils/browserUtil.js +23 -0
- package/dist/utils/md.js +1 -3
- package/docs/docs/cmd/aad/app/app-add.mdx +113 -0
- package/docs/docs/cmd/aad/app/app-get.mdx +217 -0
- package/docs/docs/cmd/aad/app/app-list.mdx +21 -0
- package/docs/docs/cmd/aad/app/app-role-add.mdx +4 -0
- package/docs/docs/cmd/aad/app/app-role-list.mdx +63 -0
- package/docs/docs/cmd/aad/app/app-role-remove.mdx +4 -0
- package/docs/docs/cmd/aad/app/app-set.mdx +4 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +61 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +59 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +4 -0
- package/docs/docs/cmd/aad/group/group-get.mdx +24 -0
- package/docs/docs/cmd/aad/group/group-list.mdx +98 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-add.mdx +114 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-get.mdx +115 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-list.mdx +115 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-remove.mdx +4 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-set.mdx +4 -0
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-get.mdx +63 -0
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-list.mdx +63 -0
- package/docs/docs/cmd/aad/o365group/o365group-add.mdx +122 -0
- package/docs/docs/cmd/aad/o365group/o365group-conversation-list.mdx +68 -0
- package/docs/docs/cmd/aad/o365group/o365group-conversation-post-list.mdx +77 -0
- package/docs/docs/cmd/aad/o365group/o365group-get.mdx +122 -0
- package/docs/docs/cmd/aad/o365group/o365group-list.mdx +99 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-clear.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-list.mdx +96 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-renew.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitycounts.mdx +48 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitydetail.mdx +60 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activityfilecounts.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitygroupcounts.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitystorage.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-set.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-teamify.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-add.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-list.mdx +56 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-set.mdx +8 -4
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +4 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +59 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +4 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +4 -0
- package/docs/docs/cmd/aad/policy/policy-list.mdx +77 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +4 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +4 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +57 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +4 -0
- package/docs/docs/cmd/aad/sp/sp-add.mdx +136 -0
- package/docs/docs/cmd/aad/sp/sp-get.mdx +166 -0
- package/docs/docs/cmd/aad/sp/sp-list.mdx +162 -0
- package/docs/docs/cmd/aad/user/user-get.mdx +75 -0
- package/docs/docs/cmd/aad/user/user-guest-add.mdx +23 -0
- package/docs/docs/cmd/aad/user/user-hibp.mdx +82 -0
- package/docs/docs/cmd/aad/user/user-license-add.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-license-remove.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-list.mdx +52 -0
- package/docs/docs/cmd/aad/user/user-password-validate.mdx +67 -0
- package/docs/docs/cmd/aad/user/user-signin-list.mdx +131 -0
- package/docs/docs/cmd/flow/flow-list.mdx +15 -0
- package/docs/docs/cmd/login.mdx +39 -0
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentionevent/retentionevent-list.mdx +0 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.mdx +0 -6
- package/docs/docs/cmd/setup.mdx +2 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +72 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.mdx +12 -3
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +55 -0
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +73 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +81 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-add.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +114 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +6 -0
- package/docs/docs/cmd/status.mdx +6 -3
- package/docs/docs/cmd/util/accesstoken/accesstoken-get.mdx +12 -2
- package/npm-shrinkwrap.json +301 -274
- package/package.json +18 -17
- package/dist/m365/aad/commands/approleassignment/AppRoleAssignment.js +0 -3
- package/dist/m365/aad/commands/approleassignment/ServicePrincipal.js +0 -3
- package/dist/m365/aad/commands/groupsetting/GroupSetting.js +0 -3
- package/dist/m365/aad/commands/groupsettingtemplate/GroupSettingTemplate.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySetting.js +0 -10
- package/dist/m365/aad/commands/siteclassification/DirectorySettingTemplatesRsp.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySettingValue.js +0 -3
- package/dist/m365/outlook/Message.js +0 -3
- package/dist/m365/spo/commands/site/SitePermission.js +0 -3
- package/dist/m365/teams/Channel.js +0 -3
- package/dist/m365/teams/ConversationMember.js +0 -3
- package/dist/m365/teams/Message.js +0 -3
- package/dist/m365/teams/Reply.js +0 -3
- package/dist/m365/teams/Tab.js +0 -3
- package/dist/m365/teams/Team.js +0 -3
- package/dist/m365/teams/TeamsApp.js +0 -3
- package/dist/m365/teams/TeamsAppInstallation.js +0 -3
- package/dist/m365/teams/TeamsTabConfiguration.js +0 -3
- package/dist/m365/teams/commands/Meeting.js +0 -3
|
@@ -118,9 +118,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
|
|
|
118
118
|
Size: fileSize
|
|
119
119
|
};
|
|
120
120
|
try {
|
|
121
|
-
yield
|
|
122
|
-
this.uploadFileChunks(fileUploadInfo, logger, resolve, reject);
|
|
123
|
-
});
|
|
121
|
+
yield this.uploadFileChunks(fileUploadInfo, logger);
|
|
124
122
|
if (this.verbose) {
|
|
125
123
|
logger.logToStderr(`Finished uploading ${fileUploadInfo.Position} bytes in ${fileChunkCount} chunks`);
|
|
126
124
|
}
|
|
@@ -243,175 +241,177 @@ class SpoFileAddCommand extends SpoCommand_1.default {
|
|
|
243
241
|
});
|
|
244
242
|
}
|
|
245
243
|
listHasContentType(contentType, webUrl, listSettings, logger) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
if (this.verbose) {
|
|
246
|
+
logger.logToStderr(`Getting list of available content types ...`);
|
|
247
|
+
}
|
|
248
|
+
const requestOptions = {
|
|
249
|
+
url: `${webUrl}/_api/web/lists('${listSettings.Id}')/contenttypes?$select=Name,Id`,
|
|
250
|
+
headers: {
|
|
251
|
+
'accept': 'application/json;odata=nometadata'
|
|
252
|
+
},
|
|
253
|
+
responseType: 'json'
|
|
254
|
+
};
|
|
255
|
+
const response = yield request_1.default.get(requestOptions);
|
|
257
256
|
// check if the specified content type is in the list
|
|
258
257
|
for (const ct of response.value) {
|
|
259
258
|
if (ct.Id.StringValue === contentType || ct.Name === contentType) {
|
|
260
|
-
return
|
|
259
|
+
return;
|
|
261
260
|
}
|
|
262
261
|
}
|
|
263
|
-
|
|
262
|
+
throw `Specified content type '${contentType}' doesn't exist on the target list`;
|
|
264
263
|
});
|
|
265
264
|
}
|
|
266
265
|
fileCheckOut(fileName, webUrl, folder) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
.
|
|
276
|
-
|
|
277
|
-
const requestOptions = {
|
|
266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
// check if file already exists, otherwise it can't be checked out
|
|
268
|
+
const requestOptionsGetFile = {
|
|
269
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')`,
|
|
270
|
+
headers: {
|
|
271
|
+
'accept': 'application/json;odata=nometadata'
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
yield request_1.default.get(requestOptionsGetFile);
|
|
275
|
+
const requestOptionsCheckOut = {
|
|
278
276
|
url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckOut()`,
|
|
279
277
|
headers: {
|
|
280
278
|
'accept': 'application/json;odata=nometadata'
|
|
281
279
|
},
|
|
282
280
|
responseType: 'json'
|
|
283
281
|
};
|
|
284
|
-
return request_1.default.post(
|
|
282
|
+
return request_1.default.post(requestOptionsCheckOut);
|
|
285
283
|
});
|
|
286
284
|
}
|
|
287
|
-
uploadFileChunks(info, logger
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// trim buffer for last chunk
|
|
300
|
-
fileBuffer = fileBuffer.slice(0, readCount);
|
|
301
|
-
}
|
|
302
|
-
const requestOptions = {
|
|
303
|
-
url: `${info.WebUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
|
|
304
|
-
data: fileBuffer,
|
|
305
|
-
headers: {
|
|
306
|
-
'accept': 'application/json;odata=nometadata',
|
|
307
|
-
'content-length': readCount
|
|
308
|
-
},
|
|
309
|
-
maxBodyLength: this.fileChunkingThreshold
|
|
310
|
-
};
|
|
311
|
-
request_1.default
|
|
312
|
-
.post(requestOptions)
|
|
313
|
-
.then(() => {
|
|
314
|
-
if (this.verbose) {
|
|
315
|
-
logger.logToStderr(`Uploaded ${info.Position} of ${info.Size} bytes (${Math.round(100 * info.Position / info.Size)}%)`);
|
|
316
|
-
}
|
|
285
|
+
uploadFileChunks(info, logger) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
let fd = 0;
|
|
288
|
+
try {
|
|
289
|
+
fd = fs.openSync(info.FilePath, 'r');
|
|
290
|
+
let fileBuffer = Buffer.alloc(this.fileChunkSize);
|
|
291
|
+
const readCount = fs.readSync(fd, fileBuffer, 0, this.fileChunkSize, info.Position);
|
|
292
|
+
fs.closeSync(fd);
|
|
293
|
+
fd = 0;
|
|
294
|
+
const offset = info.Position;
|
|
295
|
+
info.Position += readCount;
|
|
296
|
+
const isLastChunk = info.Position >= info.Size;
|
|
317
297
|
if (isLastChunk) {
|
|
318
|
-
|
|
298
|
+
// trim buffer for last chunk
|
|
299
|
+
fileBuffer = fileBuffer.slice(0, readCount);
|
|
319
300
|
}
|
|
320
|
-
|
|
321
|
-
|
|
301
|
+
const requestOptions = {
|
|
302
|
+
url: `${info.WebUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
|
|
303
|
+
data: fileBuffer,
|
|
304
|
+
headers: {
|
|
305
|
+
'accept': 'application/json;odata=nometadata',
|
|
306
|
+
'content-length': readCount
|
|
307
|
+
},
|
|
308
|
+
maxBodyLength: this.fileChunkingThreshold
|
|
309
|
+
};
|
|
310
|
+
try {
|
|
311
|
+
yield request_1.default.post(requestOptions);
|
|
312
|
+
if (this.verbose) {
|
|
313
|
+
logger.logToStderr(`Uploaded ${info.Position} of ${info.Size} bytes (${Math.round(100 * info.Position / info.Size)}%)`);
|
|
314
|
+
}
|
|
315
|
+
if (isLastChunk) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
return this.uploadFileChunks(info, logger);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
if (--info.RetriesLeft > 0) {
|
|
324
|
+
if (this.verbose) {
|
|
325
|
+
logger.logToStderr(`Retrying to upload chunk due to error: ${err}`);
|
|
326
|
+
}
|
|
327
|
+
info.Position -= readCount; // rewind
|
|
328
|
+
return this.uploadFileChunks(info, logger);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch (err) {
|
|
336
|
+
if (fd) {
|
|
337
|
+
try {
|
|
338
|
+
fs.closeSync(fd);
|
|
339
|
+
/* c8 ignore next */
|
|
340
|
+
}
|
|
341
|
+
catch (_a) { }
|
|
322
342
|
}
|
|
323
|
-
})
|
|
324
|
-
.catch((err) => {
|
|
325
343
|
if (--info.RetriesLeft > 0) {
|
|
326
344
|
if (this.verbose) {
|
|
327
|
-
logger.logToStderr(`Retrying to
|
|
345
|
+
logger.logToStderr(`Retrying to read chunk due to error: ${err}`);
|
|
328
346
|
}
|
|
329
|
-
info
|
|
330
|
-
this.uploadFileChunks(info, logger, resolve, reject);
|
|
347
|
+
return this.uploadFileChunks(info, logger);
|
|
331
348
|
}
|
|
332
349
|
else {
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
catch (err) {
|
|
338
|
-
if (fd) {
|
|
339
|
-
try {
|
|
340
|
-
fs.closeSync(fd);
|
|
341
|
-
/* c8 ignore next */
|
|
350
|
+
throw err;
|
|
342
351
|
}
|
|
343
|
-
catch (_a) { }
|
|
344
352
|
}
|
|
345
|
-
|
|
346
|
-
if (this.verbose) {
|
|
347
|
-
logger.logToStderr(`Retrying to read chunk due to error: ${err}`);
|
|
348
|
-
}
|
|
349
|
-
this.uploadFileChunks(info, logger, resolve, reject);
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
reject(err);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
353
|
+
});
|
|
355
354
|
}
|
|
356
355
|
getFileParentList(fileName, webUrl, folder, logger) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
356
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
357
|
+
if (this.verbose) {
|
|
358
|
+
logger.logToStderr(`Getting list details in order to get its available content types afterwards...`);
|
|
359
|
+
}
|
|
360
|
+
const requestOptions = {
|
|
361
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ParentList?$Select=Id,EnableModeration,EnableVersioning,EnableMinorVersions`,
|
|
362
|
+
headers: {
|
|
363
|
+
'accept': 'application/json;odata=nometadata'
|
|
364
|
+
},
|
|
365
|
+
responseType: 'json'
|
|
366
|
+
};
|
|
367
|
+
return request_1.default.get(requestOptions);
|
|
368
|
+
});
|
|
368
369
|
}
|
|
369
370
|
validateUpdateListItem(webUrl, folderPath, fileName, fieldsToUpdate, logger, checkInComment) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
.
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
if (this.verbose) {
|
|
373
|
+
logger.logToStderr(`Validate and update list item values for file ${fileName}`);
|
|
374
|
+
}
|
|
375
|
+
const requestBody = {
|
|
376
|
+
formValues: fieldsToUpdate,
|
|
377
|
+
bNewDocumentUpdate: true,
|
|
378
|
+
checkInComment: checkInComment || ''
|
|
379
|
+
};
|
|
380
|
+
if (this.debug) {
|
|
381
|
+
logger.logToStderr('ValidateUpdateListItem will perform the checkin ...');
|
|
382
|
+
logger.logToStderr('');
|
|
383
|
+
}
|
|
384
|
+
// update the existing file list item fields
|
|
385
|
+
const requestOptions = {
|
|
386
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ValidateUpdateListItem()`,
|
|
387
|
+
headers: {
|
|
388
|
+
'accept': 'application/json;odata=nometadata'
|
|
389
|
+
},
|
|
390
|
+
data: requestBody,
|
|
391
|
+
responseType: 'json'
|
|
392
|
+
};
|
|
393
|
+
const res = yield request_1.default.post(requestOptions);
|
|
393
394
|
// check for field value update for errors
|
|
394
395
|
const fieldValues = res.value;
|
|
395
396
|
for (const fieldValue of fieldValues) {
|
|
396
397
|
if (fieldValue.HasException) {
|
|
397
|
-
|
|
398
|
+
throw `Update field value error: ${JSON.stringify(fieldValues)}`;
|
|
398
399
|
}
|
|
399
400
|
}
|
|
400
|
-
return
|
|
401
|
-
})
|
|
402
|
-
.catch((err) => {
|
|
403
|
-
return Promise.reject(err);
|
|
401
|
+
return;
|
|
404
402
|
});
|
|
405
403
|
}
|
|
406
404
|
fileCheckIn(args, fileName) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
405
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
406
|
+
const requestOptions = {
|
|
407
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(args.options.folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckIn(comment='${formatting_1.formatting.encodeQueryParameter(args.options.checkInComment || '')}',checkintype=0)`,
|
|
408
|
+
headers: {
|
|
409
|
+
'accept': 'application/json;odata=nometadata'
|
|
410
|
+
},
|
|
411
|
+
responseType: 'json'
|
|
412
|
+
};
|
|
413
|
+
return request_1.default.post(requestOptions);
|
|
414
|
+
});
|
|
415
415
|
}
|
|
416
416
|
mapUnknownOptionsAsFieldValue(options) {
|
|
417
417
|
const result = [];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoFileCheckoutUndoCommand_instances, _SpoFileCheckoutUndoCommand_initTelemetry, _SpoFileCheckoutUndoCommand_initOptions, _SpoFileCheckoutUndoCommand_initValidators, _SpoFileCheckoutUndoCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
21
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
|
+
const validation_1 = require("../../../../utils/validation");
|
|
23
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
|
+
const commands_1 = require("../../commands");
|
|
25
|
+
class SpoFileCheckoutUndoCommand extends SpoCommand_1.default {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands_1.default.FILE_CHECKOUT_UNDO;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Discards a checked out file';
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_SpoFileCheckoutUndoCommand_instances.add(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initTelemetry).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initOptions).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initValidators).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initOptionSets).call(this);
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const undoCheckout = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Undoing checkout for file ${args.options.fileId || args.options.fileUrl} on web ${args.options.webUrl}`);
|
|
46
|
+
}
|
|
47
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
48
|
+
if (args.options.fileId) {
|
|
49
|
+
requestUrl += `getFileById('${args.options.fileId}')`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.fileUrl) {
|
|
52
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
53
|
+
requestUrl += `getFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')`;
|
|
54
|
+
}
|
|
55
|
+
requestUrl += '/undocheckout';
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: requestUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
yield request_1.default.post(requestOptions);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
this.handleRejectedODataJsonPromise(err);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (args.options.confirm) {
|
|
70
|
+
yield undoCheckout();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const result = yield Cli_1.Cli.prompt({
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: 'continue',
|
|
76
|
+
default: false,
|
|
77
|
+
message: `Are you sure you want to undo the checkout for file ${args.options.fileId || args.options.fileUrl} ?`
|
|
78
|
+
});
|
|
79
|
+
if (result.continue) {
|
|
80
|
+
yield undoCheckout();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_SpoFileCheckoutUndoCommand_instances = new WeakSet(), _SpoFileCheckoutUndoCommand_initTelemetry = function _SpoFileCheckoutUndoCommand_initTelemetry() {
|
|
87
|
+
this.telemetry.push((args) => {
|
|
88
|
+
Object.assign(this.telemetryProperties, {
|
|
89
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
90
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
91
|
+
confirm: !!args.options.confirm
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}, _SpoFileCheckoutUndoCommand_initOptions = function _SpoFileCheckoutUndoCommand_initOptions() {
|
|
95
|
+
this.options.unshift({
|
|
96
|
+
option: '-u, --webUrl <webUrl>'
|
|
97
|
+
}, {
|
|
98
|
+
option: '-f, --fileUrl [fileUrl]'
|
|
99
|
+
}, {
|
|
100
|
+
option: '-i, --fileId [fileId]'
|
|
101
|
+
}, {
|
|
102
|
+
option: '--confirm'
|
|
103
|
+
});
|
|
104
|
+
}, _SpoFileCheckoutUndoCommand_initValidators = function _SpoFileCheckoutUndoCommand_initValidators() {
|
|
105
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
107
|
+
if (isValidSharePointUrl !== true) {
|
|
108
|
+
return isValidSharePointUrl;
|
|
109
|
+
}
|
|
110
|
+
if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
|
|
111
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}));
|
|
115
|
+
}, _SpoFileCheckoutUndoCommand_initOptionSets = function _SpoFileCheckoutUndoCommand_initOptionSets() {
|
|
116
|
+
this.optionSets.push({ options: ['fileId', 'fileUrl'] });
|
|
117
|
+
};
|
|
118
|
+
module.exports = new SpoFileCheckoutUndoCommand();
|
|
119
|
+
//# sourceMappingURL=file-checkout-undo.js.map
|
|
@@ -69,15 +69,17 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
getFile(originalFileServerRelativeUrl, webUrl) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativeUrl)}')?$select=UniqueId`;
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
url: requestUrl,
|
|
76
|
+
headers: {
|
|
77
|
+
'accept': 'application/json;odata=nometadata'
|
|
78
|
+
},
|
|
79
|
+
responseType: 'json'
|
|
80
|
+
};
|
|
81
|
+
return request_1.default.get(requestOptions);
|
|
82
|
+
});
|
|
81
83
|
}
|
|
82
84
|
deleteFile(webUrl, sourceUrl, targetFileName) {
|
|
83
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -84,7 +84,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand_1.default {
|
|
|
84
84
|
},
|
|
85
85
|
responseType: 'json'
|
|
86
86
|
};
|
|
87
|
-
return
|
|
87
|
+
return request_1.default.get(requestOptions);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
applyAssetId(webUrl, listId, listItemId, assetId) {
|
|
@@ -99,7 +99,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand_1.default {
|
|
|
99
99
|
data: requestBody,
|
|
100
100
|
responseType: 'json'
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
return request_1.default.post(requestOptions);
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -68,21 +68,16 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
68
68
|
}
|
|
69
69
|
addRoleAssignment(fileUrl, webUrl, principalId, roleDefinitionId) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
yield request_1.default.post(requestOptions);
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
return Promise.reject(err);
|
|
85
|
-
}
|
|
71
|
+
const requestOptions = {
|
|
72
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileUrl)}')/ListItemAllFields/roleassignments/addroleassignment(principalid='${principalId}',roledefid='${roleDefinitionId}')`,
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: {
|
|
75
|
+
'accept': 'application/json;odata=nometadata',
|
|
76
|
+
'content-type': 'application/json'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
return request_1.default.post(requestOptions);
|
|
86
81
|
});
|
|
87
82
|
}
|
|
88
83
|
getRoleDefinitionId(options) {
|
|
@@ -90,60 +85,45 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
90
85
|
if (!options.roleDefinitionName) {
|
|
91
86
|
return options.roleDefinitionId;
|
|
92
87
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return roleDefinitionId;
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
return Promise.reject(err);
|
|
107
|
-
}
|
|
88
|
+
const roleDefinitionListCommandOptions = {
|
|
89
|
+
webUrl: options.webUrl,
|
|
90
|
+
output: 'json',
|
|
91
|
+
debug: this.debug,
|
|
92
|
+
verbose: this.verbose
|
|
93
|
+
};
|
|
94
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoRoleDefinitionListCommand, { options: Object.assign(Object.assign({}, roleDefinitionListCommandOptions), { _: [] }) });
|
|
95
|
+
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
96
|
+
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
97
|
+
return roleDefinitionId;
|
|
108
98
|
});
|
|
109
99
|
}
|
|
110
100
|
getGroupPrincipalId(options) {
|
|
111
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return getGroupOutput.Id;
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
return Promise.reject(err);
|
|
126
|
-
}
|
|
102
|
+
const groupGetCommandOptions = {
|
|
103
|
+
webUrl: options.webUrl,
|
|
104
|
+
name: options.groupName,
|
|
105
|
+
output: 'json',
|
|
106
|
+
debug: this.debug,
|
|
107
|
+
verbose: this.verbose
|
|
108
|
+
};
|
|
109
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
110
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
111
|
+
return getGroupOutput.Id;
|
|
127
112
|
});
|
|
128
113
|
}
|
|
129
114
|
getUserPrincipalId(options) {
|
|
130
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return getUserOutput.Id;
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
return Promise.reject(err);
|
|
146
|
-
}
|
|
116
|
+
const userGetCommandOptions = {
|
|
117
|
+
webUrl: options.webUrl,
|
|
118
|
+
email: options.upn,
|
|
119
|
+
id: undefined,
|
|
120
|
+
output: 'json',
|
|
121
|
+
debug: this.debug,
|
|
122
|
+
verbose: this.verbose
|
|
123
|
+
};
|
|
124
|
+
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
125
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
126
|
+
return getUserOutput.Id;
|
|
147
127
|
});
|
|
148
128
|
}
|
|
149
129
|
getFileURL(args) {
|
|
@@ -43,6 +43,9 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
43
43
|
commandAction(logger, args) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (this.verbose) {
|
|
47
|
+
logger.logToStderr(`Removing role assignment for ${args.options.groupName || args.options.upn} from file ${args.options.fileUrl || args.options.fileId}`);
|
|
48
|
+
}
|
|
46
49
|
try {
|
|
47
50
|
const fileURL = yield this.getFileURL(args);
|
|
48
51
|
let principalId;
|
|
@@ -41,6 +41,9 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand_1.default {
|
|
|
41
41
|
commandAction(logger, args) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
const breakFileRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Breaking role inheritance for file ${args.options.fileId || args.options.fileUrl}`);
|
|
46
|
+
}
|
|
44
47
|
try {
|
|
45
48
|
const fileURL = yield this.getFileURL(args);
|
|
46
49
|
const keepExistingPermissions = !args.options.clearExistingPermissions;
|