@pnp/cli-microsoft365 6.11.0-beta.6b1d864 → 6.11.0-beta.79a1133

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.
Files changed (38) hide show
  1. package/dist/m365/planner/commands/task/task-add.js +17 -11
  2. package/dist/m365/planner/commands/task/task-get.js +35 -25
  3. package/dist/m365/planner/commands/task/task-list.js +26 -19
  4. package/dist/m365/planner/commands/task/task-remove.js +40 -35
  5. package/dist/m365/planner/commands/task/task-set.js +35 -23
  6. package/dist/m365/spfx/commands/project/DeployWorkflow.js +58 -0
  7. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.1.js → doctor-1.18.0-beta.5.js} +1 -1
  8. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  9. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +171 -0
  10. package/dist/m365/spfx/commands/project/project-github-workflow-model.js +3 -0
  11. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
  12. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.1.js → upgrade-1.18.0-beta.5.js} +26 -26
  13. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  14. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  15. package/dist/m365/spfx/commands.js +1 -0
  16. package/dist/m365/spo/commands/app/SpoAppBaseCommand.js +26 -14
  17. package/dist/m365/spo/commands/app/app-add.js +9 -9
  18. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +32 -3
  19. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +32 -32
  20. package/dist/m365/spo/commands/site/site-add.js +113 -154
  21. package/dist/m365/spo/commands/site/site-apppermission-add.js +26 -27
  22. package/dist/m365/spo/commands/site/site-apppermission-remove.js +37 -37
  23. package/dist/m365/spo/commands/site/site-apppermission-set.js +15 -16
  24. package/dist/m365/spo/commands/site/site-ensure.js +18 -69
  25. package/dist/m365/spo/commands/site/site-remove.js +139 -171
  26. package/dist/m365/spo/commands/site/site-set.js +134 -146
  27. package/dist/utils/aadGroup.js +20 -0
  28. package/dist/utils/fsUtil.js +5 -0
  29. package/dist/utils/spo.js +600 -0
  30. package/docs/docs/cmd/planner/task/task-add.mdx +22 -7
  31. package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
  32. package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
  33. package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
  34. package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
  35. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
  36. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
  37. package/npm-shrinkwrap.json +15 -1
  38. package/package.json +3 -2
@@ -0,0 +1,171 @@
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 _SpfxProjectGithubWorkflowAddCommand_instances, _SpfxProjectGithubWorkflowAddCommand_initTelemetry, _SpfxProjectGithubWorkflowAddCommand_initOptions, _SpfxProjectGithubWorkflowAddCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const fs = require("fs");
19
+ const path = require("path");
20
+ const yaml = require("yaml");
21
+ const Command_1 = require("../../../../Command");
22
+ const fsUtil_1 = require("../../../../utils/fsUtil");
23
+ const validation_1 = require("../../../../utils/validation");
24
+ const commands_1 = require("../../commands");
25
+ const DeployWorkflow_1 = require("./DeployWorkflow");
26
+ const base_project_command_1 = require("./base-project-command");
27
+ class SpfxProjectGithubWorkflowAddCommand extends base_project_command_1.BaseProjectCommand {
28
+ get name() {
29
+ return commands_1.default.PROJECT_GITHUB_WORKFLOW_ADD;
30
+ }
31
+ get description() {
32
+ return 'Adds a GitHub workflow for a SharePoint Framework project.';
33
+ }
34
+ constructor() {
35
+ super();
36
+ _SpfxProjectGithubWorkflowAddCommand_instances.add(this);
37
+ __classPrivateFieldGet(this, _SpfxProjectGithubWorkflowAddCommand_instances, "m", _SpfxProjectGithubWorkflowAddCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _SpfxProjectGithubWorkflowAddCommand_instances, "m", _SpfxProjectGithubWorkflowAddCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _SpfxProjectGithubWorkflowAddCommand_instances, "m", _SpfxProjectGithubWorkflowAddCommand_initValidators).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ this.projectRootPath = this.getProjectRoot(process.cwd());
44
+ if (this.projectRootPath === null) {
45
+ throw new Command_1.CommandError(`Couldn't find project root folder`, SpfxProjectGithubWorkflowAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
46
+ }
47
+ const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
48
+ const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
49
+ const solutionName = JSON.parse(packageJson).name;
50
+ if (this.debug) {
51
+ logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
52
+ }
53
+ try {
54
+ this.updateWorkflow(solutionName, DeployWorkflow_1.workflow, args.options);
55
+ this.saveWorkflow(DeployWorkflow_1.workflow);
56
+ }
57
+ catch (error) {
58
+ throw new Command_1.CommandError(error);
59
+ }
60
+ });
61
+ }
62
+ saveWorkflow(workflow) {
63
+ const githubPath = path.join(this.projectRootPath, '.github');
64
+ fsUtil_1.fsUtil.ensureDirectory(githubPath);
65
+ const workflowPath = path.join(githubPath, 'workflows');
66
+ fsUtil_1.fsUtil.ensureDirectory(workflowPath);
67
+ const workflowFile = path.join(workflowPath, 'deploy-spfx-solution.yml');
68
+ fs.writeFileSync(path.resolve(workflowFile), yaml.stringify(workflow), 'utf-8');
69
+ }
70
+ updateWorkflow(solutionName, workflow, options) {
71
+ var _a;
72
+ workflow.name = workflow.name.replace('{{ name }}', (_a = options.name) !== null && _a !== void 0 ? _a : solutionName);
73
+ if (options.branchName) {
74
+ workflow.on.push.branches[0] = options.branchName;
75
+ }
76
+ if (options.manuallyTrigger) {
77
+ // eslint-disable-next-line camelcase
78
+ workflow.on.workflow_dispatch = null;
79
+ }
80
+ if (options.skipFeatureDeployment) {
81
+ this.getDeployAction(workflow).with.SKIP_FEATURE_DEPLOYMENT = true;
82
+ }
83
+ if (options.overwrite) {
84
+ this.getDeployAction(workflow).with.OVERWRITE = true;
85
+ }
86
+ if (options.loginMethod === 'user') {
87
+ const loginAction = this.getLoginAction(workflow);
88
+ loginAction.with = {
89
+ ADMIN_USERNAME: '${{ secrets.ADMIN_USERNAME }}',
90
+ ADMIN_PASSWORD: '${{ secrets.ADMIN_PASSWORD }}'
91
+ };
92
+ }
93
+ if (options.scope === 'sitecollection') {
94
+ const deployAction = this.getDeployAction(workflow);
95
+ deployAction.with.SCOPE = 'sitecollection';
96
+ deployAction.with.SITE_COLLECTION_URL = options.siteUrl;
97
+ }
98
+ if (solutionName) {
99
+ const deployAction = this.getDeployAction(workflow);
100
+ deployAction.with.APP_FILE_PATH = deployAction.with.APP_FILE_PATH.replace('{{ solutionName }}', solutionName);
101
+ }
102
+ }
103
+ getLoginAction(workflow) {
104
+ const steps = this.getWorkFlowSteps(workflow);
105
+ return steps.find(step => step.uses && step.uses.indexOf('action-cli-login') >= 0);
106
+ }
107
+ getDeployAction(workflow) {
108
+ const steps = this.getWorkFlowSteps(workflow);
109
+ return steps.find(step => step.uses && step.uses.indexOf('action-cli-deploy') >= 0);
110
+ }
111
+ getWorkFlowSteps(workflow) {
112
+ return workflow.jobs['build-and-deploy'].steps;
113
+ }
114
+ }
115
+ _SpfxProjectGithubWorkflowAddCommand_instances = new WeakSet(), _SpfxProjectGithubWorkflowAddCommand_initTelemetry = function _SpfxProjectGithubWorkflowAddCommand_initTelemetry() {
116
+ this.telemetry.push((args) => {
117
+ Object.assign(this.telemetryProperties, {
118
+ name: typeof args.options.name !== 'undefined',
119
+ branchName: typeof args.options.branchName !== 'undefined',
120
+ manuallyTrigger: !!args.options.manuallyTrigger,
121
+ loginMethod: typeof args.options.loginMethod !== 'undefined',
122
+ scope: typeof args.options.scope !== 'undefined',
123
+ skipFeatureDeployment: !!args.options.skipFeatureDeployment,
124
+ overwrite: !!args.options.overwrite
125
+ });
126
+ });
127
+ }, _SpfxProjectGithubWorkflowAddCommand_initOptions = function _SpfxProjectGithubWorkflowAddCommand_initOptions() {
128
+ this.options.unshift({
129
+ option: '-n, --name [name]'
130
+ }, {
131
+ option: '-b, --branchName [branchName]'
132
+ }, {
133
+ option: '-m, --manuallyTrigger'
134
+ }, {
135
+ option: '-l, --loginMethod [loginMethod]',
136
+ autocomplete: SpfxProjectGithubWorkflowAddCommand.loginMethod
137
+ }, {
138
+ option: '-s, --scope [scope]',
139
+ autocomplete: SpfxProjectGithubWorkflowAddCommand.scope
140
+ }, {
141
+ option: '-u, --siteUrl [siteUrl]'
142
+ }, {
143
+ option: '--skipFeatureDeployment'
144
+ }, {
145
+ option: '--overwrite'
146
+ });
147
+ }, _SpfxProjectGithubWorkflowAddCommand_initValidators = function _SpfxProjectGithubWorkflowAddCommand_initValidators() {
148
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
149
+ if (args.options.scope && args.options.scope === 'sitecollection') {
150
+ if (!args.options.siteUrl) {
151
+ return `siteUrl option has to be defined when scope set to ${args.options.scope}`;
152
+ }
153
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.siteUrl);
154
+ if (isValidSharePointUrl !== true) {
155
+ return isValidSharePointUrl;
156
+ }
157
+ }
158
+ if (args.options.loginMethod && SpfxProjectGithubWorkflowAddCommand.loginMethod.indexOf(args.options.loginMethod) < 0) {
159
+ return `${args.options.loginMethod} is not a valid login method. Allowed values are ${SpfxProjectGithubWorkflowAddCommand.loginMethod.join(', ')}`;
160
+ }
161
+ if (args.options.scope && SpfxProjectGithubWorkflowAddCommand.scope.indexOf(args.options.scope) < 0) {
162
+ return `${args.options.scope} is not a valid scope. Allowed values are ${SpfxProjectGithubWorkflowAddCommand.scope.join(', ')}`;
163
+ }
164
+ return true;
165
+ }));
166
+ };
167
+ SpfxProjectGithubWorkflowAddCommand.loginMethod = ['application', 'user'];
168
+ SpfxProjectGithubWorkflowAddCommand.scope = ['tenant', 'sitecollection'];
169
+ SpfxProjectGithubWorkflowAddCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
170
+ module.exports = new SpfxProjectGithubWorkflowAddCommand();
171
+ //# sourceMappingURL=project-github-workflow-add.js.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=project-github-workflow-model.js.map
@@ -105,7 +105,7 @@ module.exports = [
105
105
  'fixWith': 'symbol'
106
106
  },
107
107
  'Function': {
108
- 'message': 'The \\'Function\\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
108
+ 'message': 'The \\'Function\\' type accepts any function-like value.\\nIt provides no type safety when calling the function, which can be a common source of bugs.\\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \\'new\\'.\\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
109
109
  }
110
110
  }
111
111
  }
@@ -29,33 +29,33 @@ const FN002023_DEVDEP_microsoft_eslint_config_spfx_1 = require("./rules/FN002023
29
29
  const FN010001_YORC_version_1 = require("./rules/FN010001_YORC_version");
30
30
  const FN010010_YORC_sdkVersions_teams_js_1 = require("./rules/FN010010_YORC_sdkVersions_teams_js");
31
31
  module.exports = [
32
- new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.18.0-beta.1'),
33
- new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.18.0-beta.1'),
34
- new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.18.0-beta.1'),
35
- new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.18.0-beta.1'),
36
- new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.18.0-beta.1'),
37
- new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.18.0-beta.1'),
38
- new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.18.0-beta.1'),
39
- new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.18.0-beta.1'),
32
+ new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.18.0-beta.5'),
33
+ new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.18.0-beta.5'),
34
+ new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.18.0-beta.5'),
35
+ new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.18.0-beta.5'),
36
+ new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.18.0-beta.5'),
37
+ new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.18.0-beta.5'),
38
+ new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.18.0-beta.5'),
39
+ new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.18.0-beta.5'),
40
40
  new FN001022_DEP_office_ui_fabric_react_1.FN001022_DEP_office_ui_fabric_react('', false),
41
- new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.18.0-beta.1'),
42
- new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.18.0-beta.1'),
43
- new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.18.0-beta.1'),
44
- new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.18.0-beta.1'),
45
- new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.18.0-beta.1'),
46
- new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.18.0-beta.1'),
47
- new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.18.0-beta.1'),
48
- new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.18.0-beta.1'),
49
- new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.18.0-beta.1'),
50
- new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.18.0-beta.1'),
41
+ new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.18.0-beta.5'),
42
+ new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.18.0-beta.5'),
43
+ new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.18.0-beta.5'),
44
+ new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.18.0-beta.5'),
45
+ new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.18.0-beta.5'),
46
+ new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.18.0-beta.5'),
47
+ new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.18.0-beta.5'),
48
+ new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.18.0-beta.5'),
49
+ new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.18.0-beta.5'),
50
+ new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.18.0-beta.5'),
51
51
  new FN001035_DEP_fluentui_react_1.FN001035_DEP_fluentui_react('8.106.4'),
52
- new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.18.0-beta.1'),
53
- new FN001034_DEP_microsoft_sp_adaptive_card_extension_base_1.FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.18.0-beta.1'),
54
- new FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1.FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.18.0-beta.1'),
55
- new FN002023_DEVDEP_microsoft_eslint_config_spfx_1.FN002023_DEVDEP_microsoft_eslint_config_spfx('1.18.0-beta.1'),
56
- new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.18.0-beta.1'),
57
- new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.18.0-beta.1'),
58
- new FN010001_YORC_version_1.FN010001_YORC_version('1.18.0-beta.1'),
52
+ new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.18.0-beta.5'),
53
+ new FN001034_DEP_microsoft_sp_adaptive_card_extension_base_1.FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.18.0-beta.5'),
54
+ new FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1.FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.18.0-beta.5'),
55
+ new FN002023_DEVDEP_microsoft_eslint_config_spfx_1.FN002023_DEVDEP_microsoft_eslint_config_spfx('1.18.0-beta.5'),
56
+ new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.18.0-beta.5'),
57
+ new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.18.0-beta.5'),
58
+ new FN010001_YORC_version_1.FN010001_YORC_version('1.18.0-beta.5'),
59
59
  new FN010010_YORC_sdkVersions_teams_js_1.FN010010_YORC_sdkVersions_teams_js('2.12.0')
60
60
  ];
61
- //# sourceMappingURL=upgrade-1.18.0-beta.1.js.map
61
+ //# sourceMappingURL=upgrade-1.18.0-beta.5.js.map
@@ -82,7 +82,7 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
82
82
  '1.17.2',
83
83
  '1.17.3',
84
84
  '1.17.4',
85
- '1.18.0-beta.1'
85
+ '1.18.0-beta.5'
86
86
  ];
87
87
  __classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initTelemetry).call(this);
88
88
  __classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initOptions).call(this);
@@ -535,14 +535,14 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
535
535
  fix: 'npm i -g yo@4'
536
536
  }
537
537
  },
538
- '1.18.0-beta.1': {
538
+ '1.18.0-beta.5': {
539
539
  gulpCli: {
540
540
  range: '^1 || ^2',
541
541
  fix: 'npm i -g gulp-cli@2'
542
542
  },
543
543
  node: {
544
- range: '>=16.13.0 <17.0.0',
545
- fix: 'Install Node.js >=16.13.0 <17.0.0'
544
+ range: '>=16.14.0 <17.0.0',
545
+ fix: 'Install Node.js >=16.14.0 <17.0.0'
546
546
  },
547
547
  sp: SharePointVersion.SPO,
548
548
  yo: {
@@ -6,6 +6,7 @@ exports.default = {
6
6
  PACKAGE_GENERATE: `${prefix} package generate`,
7
7
  PROJECT_DOCTOR: `${prefix} project doctor`,
8
8
  PROJECT_EXTERNALIZE: `${prefix} project externalize`,
9
+ PROJECT_GITHUB_WORKFLOW_ADD: `${prefix} project github workflow add`,
9
10
  PROJECT_PERMISSIONS_GRANT: `${prefix} project permissions grant`,
10
11
  PROJECT_RENAME: `${prefix} project rename`,
11
12
  PROJECT_UPGRADE: `${prefix} project upgrade`
@@ -1,16 +1,34 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.SpoAppBaseCommand = void 0;
4
13
  const request_1 = require("../../../../request");
5
14
  const SpoCommand_1 = require("../../../base/SpoCommand");
6
15
  class SpoAppBaseCommand extends SpoCommand_1.default {
7
16
  getAppCatalogSiteUrl(logger, authSiteUrl, args) {
8
- return new Promise((resolve, reject) => {
17
+ return __awaiter(this, void 0, void 0, function* () {
9
18
  if (args.options.appCatalogScope === 'sitecollection') {
10
- return resolve(args.options.appCatalogUrl.toLowerCase().replace('/appcatalog', ''));
19
+ // trim trailing slashes if there are any
20
+ const appCatalogUrl = args.options.appCatalogUrl.replace(/\/$/, '');
21
+ const appCatalogUrlChunks = appCatalogUrl.split('/');
22
+ // Trim the last part of the URL if it ends on '/appcatalog', but don't trim it if the site URL is called like that (/sites/appcatalog).
23
+ if (appCatalogUrl.toLowerCase().endsWith('/appcatalog') && appCatalogUrlChunks.length !== 5) {
24
+ return appCatalogUrl.substring(0, appCatalogUrl.lastIndexOf('/'));
25
+ }
11
26
  }
12
27
  if (args.options.appCatalogUrl) {
13
- return resolve(args.options.appCatalogUrl);
28
+ return args.options.appCatalogUrl.replace(/\/$/, '');
29
+ }
30
+ if (this.verbose) {
31
+ logger.logToStderr('Getting tenant app catalog url...');
14
32
  }
15
33
  const requestOptions = {
16
34
  url: `${authSiteUrl}/_api/SP_TenantSettings_Current`,
@@ -19,17 +37,11 @@ class SpoAppBaseCommand extends SpoCommand_1.default {
19
37
  },
20
38
  responseType: 'json'
21
39
  };
22
- request_1.default
23
- .get(requestOptions)
24
- .then((res) => {
25
- if (res.CorporateCatalogUrl) {
26
- return resolve(res.CorporateCatalogUrl);
27
- }
28
- reject('Tenant app catalog is not configured.');
29
- })
30
- .catch((err) => {
31
- reject(err);
32
- });
40
+ const response = yield request_1.default.get(requestOptions);
41
+ if (response.CorporateCatalogUrl) {
42
+ return response.CorporateCatalogUrl;
43
+ }
44
+ throw new Error('Tenant app catalog is not configured.');
33
45
  });
34
46
  }
35
47
  }
@@ -33,6 +33,7 @@ class SpoAppAddCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
33
33
  constructor() {
34
34
  super();
35
35
  _SpoAppAddCommand_instances.add(this);
36
+ this.appCatalogScopeOptions = ['tenant', 'sitecollection'];
36
37
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initTelemetry).call(this);
37
38
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initOptions).call(this);
38
39
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initValidators).call(this);
@@ -75,9 +76,9 @@ class SpoAppAddCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
75
76
  _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = function _SpoAppAddCommand_initTelemetry() {
76
77
  this.telemetry.push((args) => {
77
78
  Object.assign(this.telemetryProperties, {
78
- overwrite: (!(!args.options.overwrite)).toString(),
79
+ overwrite: !!args.options.overwrite,
79
80
  appCatalogScope: args.options.appCatalogScope || 'tenant',
80
- appCatalogUrl: (!(!args.options.appCatalogUrl)).toString()
81
+ appCatalogUrl: typeof args.options.appCatalogUrl !== 'undefined'
81
82
  });
82
83
  });
83
84
  }, _SpoAppAddCommand_initOptions = function _SpoAppAddCommand_initOptions() {
@@ -85,7 +86,7 @@ _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = f
85
86
  option: '-p, --filePath <filePath>'
86
87
  }, {
87
88
  option: '-s, --appCatalogScope [appCatalogScope]',
88
- autocomplete: ['tenant', 'sitecollection']
89
+ autocomplete: this.appCatalogScopeOptions
89
90
  }, {
90
91
  option: '-u, --appCatalogUrl [appCatalogUrl]'
91
92
  }, {
@@ -93,14 +94,13 @@ _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = f
93
94
  });
94
95
  }, _SpoAppAddCommand_initValidators = function _SpoAppAddCommand_initValidators() {
95
96
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
96
- // verify either 'tenant' or 'sitecollection' specified if scope provided
97
97
  if (args.options.appCatalogScope) {
98
- const testScope = args.options.appCatalogScope.toLowerCase();
99
- if (!(testScope === 'tenant' || testScope === 'sitecollection')) {
100
- return `appCatalogScope must be either 'tenant' or 'sitecollection'`;
98
+ const appCatalogScope = args.options.appCatalogScope.toLowerCase();
99
+ if (this.appCatalogScopeOptions.indexOf(appCatalogScope) === -1) {
100
+ return `${args.options.appCatalogScope} is not a valid appCatalogScope. Allowed values are: ${this.appCatalogScopeOptions.join(', ')}`;
101
101
  }
102
- if (testScope === 'sitecollection' && !args.options.appCatalogUrl) {
103
- return `You must specify appCatalogUrl when the appCatalogScope is sitecollection`;
102
+ if (appCatalogScope === 'sitecollection' && !args.options.appCatalogUrl) {
103
+ return `You must specify appCatalogUrl when appCatalogScope is sitecollection`;
104
104
  }
105
105
  }
106
106
  const fullPath = path.resolve(args.options.filePath);
@@ -21,6 +21,12 @@ const spo_1 = require("../../../../utils/spo");
21
21
  const validation_1 = require("../../../../utils/validation");
22
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
23
23
  const commands_1 = require("../../commands");
24
+ var OrgAssetType;
25
+ (function (OrgAssetType) {
26
+ OrgAssetType[OrgAssetType["ImageDocumentLibrary"] = 1] = "ImageDocumentLibrary";
27
+ OrgAssetType[OrgAssetType["OfficeTemplateLibrary"] = 2] = "OfficeTemplateLibrary";
28
+ OrgAssetType[OrgAssetType["OfficeFontLibrary"] = 4] = "OfficeFontLibrary";
29
+ })(OrgAssetType || (OrgAssetType = {}));
24
30
  class SpoOrgAssetsLibraryAddCommand extends SpoCommand_1.default {
25
31
  get name() {
26
32
  return commands_1.default.ORGASSETSLIBRARY_ADD;
@@ -42,6 +48,7 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand_1.default {
42
48
  const cdnType = cdnTypeString === 'Private' ? 1 : 0;
43
49
  const thumbnailSchema = typeof args.options.thumbnailUrl === 'undefined' ? `<Parameter Type="Null" />` : `<Parameter Type="String">${args.options.thumbnailUrl}</Parameter>`;
44
50
  try {
51
+ const orgAssetType = this.getOrgAssetType(args.options.orgAssetType);
45
52
  spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
46
53
  const reqDigest = yield spo_1.spo.getRequestDigest(spoAdminUrl);
47
54
  const requestOptions = {
@@ -49,7 +56,7 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand_1.default {
49
56
  headers: {
50
57
  'X-RequestDigest': reqDigest.FormDigestValue
51
58
  },
52
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="AddToOrgAssetsLibAndCdnWithType" Id="11" ObjectPathId="8"><Parameters><Parameter Type="Enum">${cdnType}</Parameter><Parameter Type="String">${args.options.libraryUrl}</Parameter>${thumbnailSchema}<Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="8" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
59
+ data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="AddToOrgAssetsLibAndCdnWithType" Id="11" ObjectPathId="8"><Parameters><Parameter Type="Enum">${cdnType}</Parameter><Parameter Type="String">${args.options.libraryUrl}</Parameter>${thumbnailSchema}<Parameter Type="Enum">${orgAssetType}</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="8" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
53
60
  };
54
61
  const res = yield request_1.default.post(requestOptions);
55
62
  const json = JSON.parse(res);
@@ -63,12 +70,23 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand_1.default {
63
70
  }
64
71
  });
65
72
  }
73
+ getOrgAssetType(orgAssetType) {
74
+ switch (orgAssetType) {
75
+ case 'OfficeTemplateLibrary':
76
+ return OrgAssetType.OfficeTemplateLibrary;
77
+ case 'OfficeFontLibrary':
78
+ return OrgAssetType.OfficeFontLibrary;
79
+ default:
80
+ return OrgAssetType.ImageDocumentLibrary;
81
+ }
82
+ }
66
83
  }
67
84
  _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAddCommand_initTelemetry = function _SpoOrgAssetsLibraryAddCommand_initTelemetry() {
68
85
  this.telemetry.push((args) => {
69
86
  Object.assign(this.telemetryProperties, {
70
87
  cdnType: args.options.cdnType || 'Private',
71
- thumbnailUrl: typeof args.options.thumbnailUrl !== 'undefined'
88
+ thumbnailUrl: typeof args.options.thumbnailUrl !== 'undefined',
89
+ orgAssetType: args.options.orgAssetType
72
90
  });
73
91
  });
74
92
  }, _SpoOrgAssetsLibraryAddCommand_initOptions = function _SpoOrgAssetsLibraryAddCommand_initOptions() {
@@ -78,7 +96,10 @@ _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAd
78
96
  option: '--thumbnailUrl [thumbnailUrl]'
79
97
  }, {
80
98
  option: '--cdnType [cdnType]',
81
- autocomplete: ['Public', 'Private']
99
+ autocomplete: SpoOrgAssetsLibraryAddCommand.cdnTypes
100
+ }, {
101
+ option: '--orgAssetType [orgAssetType]',
102
+ autocomplete: SpoOrgAssetsLibraryAddCommand.orgAssetTypes
82
103
  });
83
104
  }, _SpoOrgAssetsLibraryAddCommand_initValidators = function _SpoOrgAssetsLibraryAddCommand_initValidators() {
84
105
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -86,8 +107,16 @@ _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAd
86
107
  if (typeof args.options.thumbnailUrl !== 'undefined' && isValidThumbnailUrl !== true) {
87
108
  return isValidThumbnailUrl;
88
109
  }
110
+ if (args.options.cdnType && SpoOrgAssetsLibraryAddCommand.cdnTypes.indexOf(args.options.cdnType) < 0) {
111
+ return `${args.options.cdnType} is not a valid value for cdnType. Valid values are ${SpoOrgAssetsLibraryAddCommand.cdnTypes.join(', ')}`;
112
+ }
113
+ if (args.options.orgAssetType && SpoOrgAssetsLibraryAddCommand.orgAssetTypes.indexOf(args.options.orgAssetType) < 0) {
114
+ return `${args.options.orgAssetType} is not a valid value for orgAssetType. Valid values are ${SpoOrgAssetsLibraryAddCommand.orgAssetTypes.join(', ')}`;
115
+ }
89
116
  return validation_1.validation.isValidSharePointUrl(args.options.libraryUrl);
90
117
  }));
91
118
  };
119
+ SpoOrgAssetsLibraryAddCommand.orgAssetTypes = ['ImageDocumentLibrary', 'OfficeTemplateLibrary', 'OfficeFontLibrary'];
120
+ SpoOrgAssetsLibraryAddCommand.cdnTypes = ['Public', 'Private'];
92
121
  module.exports = new SpoOrgAssetsLibraryAddCommand();
93
122
  //# sourceMappingURL=orgassetslibrary-add.js.map
@@ -40,38 +40,8 @@ class SpoServicePrincipalSetCommand extends SpoCommand_1.default {
40
40
  }
41
41
  commandAction(logger, args) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const toggleServicePrincipal = () => __awaiter(this, void 0, void 0, function* () {
44
- try {
45
- const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
46
- const reqDigest = yield spo_1.spo.getRequestDigest(spoAdminUrl);
47
- if (this.verbose) {
48
- logger.logToStderr(`${(args.options.enabled ? 'Enabling' : 'Disabling')} service principal...`);
49
- }
50
- const requestOptions = {
51
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
52
- headers: {
53
- 'X-RequestDigest': reqDigest.FormDigestValue
54
- },
55
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="28" ObjectPathId="27" /><SetProperty Id="29" ObjectPathId="27" Name="AccountEnabled"><Parameter Type="Boolean">${args.options.enabled}</Parameter></SetProperty><Method Name="Update" Id="30" ObjectPathId="27" /><Query Id="31" ObjectPathId="27"><Query SelectAllProperties="true"><Properties><Property Name="AccountEnabled" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Constructor Id="27" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /></ObjectPaths></Request>`
56
- };
57
- const res = yield request_1.default.post(requestOptions);
58
- const json = JSON.parse(res);
59
- const response = json[0];
60
- if (response.ErrorInfo) {
61
- throw response.ErrorInfo.ErrorMessage;
62
- }
63
- else {
64
- const output = json[json.length - 1];
65
- delete output._ObjectType_;
66
- logger.log(output);
67
- }
68
- }
69
- catch (err) {
70
- this.handleRejectedPromise(err);
71
- }
72
- });
73
43
  if (args.options.confirm) {
74
- yield toggleServicePrincipal();
44
+ yield this.toggleServicePrincipal(logger, args);
75
45
  }
76
46
  else {
77
47
  const result = yield Cli_1.Cli.prompt({
@@ -81,11 +51,41 @@ class SpoServicePrincipalSetCommand extends SpoCommand_1.default {
81
51
  message: `Are you sure you want to ${args.options.enabled ? 'enable' : 'disable'} the service principal?`
82
52
  });
83
53
  if (result.continue) {
84
- yield toggleServicePrincipal();
54
+ yield this.toggleServicePrincipal(logger, args);
85
55
  }
86
56
  }
87
57
  });
88
58
  }
59
+ toggleServicePrincipal(logger, args) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ try {
62
+ const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
63
+ const reqDigest = yield spo_1.spo.getRequestDigest(spoAdminUrl);
64
+ if (this.verbose) {
65
+ logger.logToStderr(`${(args.options.enabled ? 'Enabling' : 'Disabling')} service principal...`);
66
+ }
67
+ const requestOptions = {
68
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
69
+ headers: {
70
+ 'X-RequestDigest': reqDigest.FormDigestValue
71
+ },
72
+ data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="28" ObjectPathId="27" /><SetProperty Id="29" ObjectPathId="27" Name="AccountEnabled"><Parameter Type="Boolean">${args.options.enabled}</Parameter></SetProperty><Method Name="Update" Id="30" ObjectPathId="27" /><Query Id="31" ObjectPathId="27"><Query SelectAllProperties="true"><Properties><Property Name="AccountEnabled" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Constructor Id="27" TypeId="{104e8f06-1e00-4675-99c6-1b9b504ed8d8}" /></ObjectPaths></Request>`
73
+ };
74
+ const response = yield request_1.default.post(requestOptions);
75
+ const json = JSON.parse(response);
76
+ const responseContent = json[0];
77
+ if (responseContent.ErrorInfo) {
78
+ throw responseContent.ErrorInfo.ErrorMessage;
79
+ }
80
+ const output = json[json.length - 1];
81
+ delete output._ObjectType_;
82
+ logger.log(output);
83
+ }
84
+ catch (err) {
85
+ this.handleRejectedPromise(err);
86
+ }
87
+ });
88
+ }
89
89
  }
90
90
  _SpoServicePrincipalSetCommand_instances = new WeakSet(), _SpoServicePrincipalSetCommand_initTelemetry = function _SpoServicePrincipalSetCommand_initTelemetry() {
91
91
  this.telemetry.push((args) => {