@pnp/cli-microsoft365 11.7.0-beta.bd906c5 → 11.8.0-beta.50a1b64

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 (66) hide show
  1. package/.devproxy/api-specs/sharepoint.yaml +53 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/m365/context/commands/option/option-list.js +6 -1
  5. package/dist/m365/entra/commands/resourcenamespace/resourcenamespace-list.js +6 -0
  6. package/dist/m365/external/commands/connection/connection-list.js +6 -0
  7. package/dist/m365/outlook/commands/calendar/calendar-set.js +132 -0
  8. package/dist/m365/outlook/commands/calendargroup/calendargroup-get.js +114 -0
  9. package/dist/m365/outlook/commands/calendargroup/calendargroup-remove.js +98 -0
  10. package/dist/m365/outlook/commands.js +3 -0
  11. package/dist/m365/spfx/commands/project/DeployWorkflow.js +9 -5
  12. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +10 -9
  13. package/dist/m365/spfx/commands/project/project-doctor.js +6 -0
  14. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -10
  15. package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +11 -5
  16. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js +10 -0
  17. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0.js +2 -2
  18. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.23.0-rc.0.js +2 -2
  19. package/dist/m365/spfx/commands/project/project-upgrade.js +23 -6
  20. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +13 -1
  21. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +24 -3
  22. package/dist/m365/spo/commands/brandcenter/brandcenter-colors-list.js +59 -0
  23. package/dist/m365/spo/commands/file/file-archive.js +83 -0
  24. package/dist/m365/spo/commands/propertybag/propertybag-set.js +3 -9
  25. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +20 -0
  26. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +27 -2
  27. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +5 -1
  28. package/dist/m365/spo/commands.js +2 -0
  29. package/dist/request.js +1 -17
  30. package/dist/utils/packageManager.js +29 -7
  31. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +21 -0
  32. package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +19 -0
  33. package/docs/docs/cmd/entra/m365group/m365group-user-remove.mdx +21 -0
  34. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +21 -0
  35. package/docs/docs/cmd/entra/roledefinition/roledefinition-add.mdx +19 -0
  36. package/docs/docs/cmd/entra/roledefinition/roledefinition-get.mdx +19 -0
  37. package/docs/docs/cmd/entra/roledefinition/roledefinition-list.mdx +19 -0
  38. package/docs/docs/cmd/entra/roledefinition/roledefinition-remove.mdx +21 -0
  39. package/docs/docs/cmd/entra/roledefinition/roledefinition-set.mdx +21 -0
  40. package/docs/docs/cmd/entra/siteclassification/siteclassification-disable.mdx +21 -0
  41. package/docs/docs/cmd/entra/siteclassification/siteclassification-enable.mdx +21 -0
  42. package/docs/docs/cmd/entra/siteclassification/siteclassification-get.mdx +19 -0
  43. package/docs/docs/cmd/entra/siteclassification/siteclassification-set.mdx +20 -0
  44. package/docs/docs/cmd/external/connection/connection-add.mdx +21 -0
  45. package/docs/docs/cmd/external/connection/connection-doctor.mdx +19 -0
  46. package/docs/docs/cmd/external/connection/connection-get.mdx +19 -0
  47. package/docs/docs/cmd/external/connection/connection-list.mdx +19 -0
  48. package/docs/docs/cmd/external/connection/connection-remove.mdx +21 -0
  49. package/docs/docs/cmd/external/connection/connection-schema-add.mdx +21 -0
  50. package/docs/docs/cmd/external/connection/connection-urltoitemresolver-add.mdx +21 -0
  51. package/docs/docs/cmd/external/item/item-add.mdx +19 -0
  52. package/docs/docs/cmd/outlook/calendar/calendar-set.mdx +178 -0
  53. package/docs/docs/cmd/outlook/calendargroup/calendargroup-get.mdx +125 -0
  54. package/docs/docs/cmd/outlook/calendargroup/calendargroup-remove.mdx +91 -0
  55. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  56. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +14 -11
  57. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +9 -6
  58. package/docs/docs/cmd/spo/brandcenter/brandcenter-colors-list.mdx +115 -0
  59. package/docs/docs/cmd/spo/file/file-archive.mdx +68 -0
  60. package/docs/docs/cmd/spo/propertybag/propertybag-set.mdx +1 -1
  61. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.mdx +13 -10
  62. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +7 -4
  63. package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +3 -0
  64. package/npm-shrinkwrap.json +583 -224
  65. package/package.json +33 -19
  66. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_overrides_rushstack_heft.js +0 -45
@@ -48,7 +48,7 @@ import { FN021005_PKG_scripts_test } from './rules/FN021005_PKG_scripts_test.js'
48
48
  import { FN021006_PKG_scripts_clean } from './rules/FN021006_PKG_scripts_clean.js';
49
49
  import { FN021007_PKG_scripts_start } from './rules/FN021007_PKG_scripts_start.js';
50
50
  import { FN021008_PKG_scripts_eject_webpack } from './rules/FN021008_PKG_scripts_eject_webpack.js';
51
- import { FN021009_PKG_overrides_rushstack_heft } from './rules/FN021009_PKG_overrides_rushstack_heft.js';
51
+ import { FN027001_OVERRIDES_rushstack_heft } from './rules/FN027001_OVERRIDES_rushstack_heft.js';
52
52
  import { FN023003_GITIGNORE_libdts } from './rules/FN023003_GITIGNORE_libdts.js';
53
53
  import { FN023004_GITIGNORE_libcommonjs } from './rules/FN023004_GITIGNORE_libcommonjs.js';
54
54
  import { FN023005_GITIGNORE_libesm } from './rules/FN023005_GITIGNORE_libesm.js';
@@ -151,7 +151,7 @@ export default [
151
151
  new FN021006_PKG_scripts_clean('heft clean'),
152
152
  new FN021007_PKG_scripts_start('heft start --clean'),
153
153
  new FN021008_PKG_scripts_eject_webpack('heft eject-webpack'),
154
- new FN021009_PKG_overrides_rushstack_heft('1.1.2'),
154
+ new FN027001_OVERRIDES_rushstack_heft('1.1.2'),
155
155
  new FN023003_GITIGNORE_libdts(),
156
156
  new FN023004_GITIGNORE_libcommonjs(),
157
157
  new FN023005_GITIGNORE_libesm(),
@@ -31,7 +31,7 @@ import { FN002034_DEVDEP_microsoft_spfx_heft_plugins } from './rules/FN002034_DE
31
31
  import { FN010001_YORC_version } from './rules/FN010001_YORC_version.js';
32
32
  import { FN015008_FILE_eslintrc_js } from './rules/FN015008_FILE_eslintrc_js.js';
33
33
  import { FN015016_FILE_eslint_config_js } from './rules/FN015016_FILE_eslint_config_js.js';
34
- import { FN021009_PKG_overrides_rushstack_heft } from './rules/FN021009_PKG_overrides_rushstack_heft.js';
34
+ import { FN027001_OVERRIDES_rushstack_heft } from './rules/FN027001_OVERRIDES_rushstack_heft.js';
35
35
  export default [
36
36
  new FN001001_DEP_microsoft_sp_core_library('1.23.0-rc.0'),
37
37
  new FN001002_DEP_microsoft_sp_lodash_subset('1.23.0-rc.0'),
@@ -60,7 +60,7 @@ export default [
60
60
  new FN002034_DEVDEP_microsoft_spfx_heft_plugins('1.23.0-rc.0'),
61
61
  new FN010001_YORC_version('1.23.0-rc.0'),
62
62
  new FN002031_DEVDEP_rushstack_heft('1.2.7'),
63
- new FN021009_PKG_overrides_rushstack_heft('1.2.7'),
63
+ new FN027001_OVERRIDES_rushstack_heft('1.2.7'),
64
64
  new FN002025_DEVDEP_eslint_plugin_react_hooks('5.2.0'),
65
65
  new FN002024_DEVDEP_eslint('9.37.0'),
66
66
  new FN015016_FILE_eslint_config_js(true, `const spfxProfile = require('@microsoft/eslint-config-spfx/lib/flat-profiles/react');
@@ -12,7 +12,7 @@ import { BaseProjectCommand } from './base-project-command.js';
12
12
  import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
13
13
  export const options = z.strictObject({
14
14
  ...globalOptionsZod.shape,
15
- packageManager: z.enum(['npm', 'pnpm', 'yarn']).default('npm'),
15
+ packageManager: z.enum(['npm', 'pnpm']).default('npm'),
16
16
  preview: z.boolean().optional(),
17
17
  toVersion: z.string().optional().alias('v'),
18
18
  shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
@@ -201,7 +201,15 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
201
201
  // replace package operation tokens with command for the specific package manager
202
202
  findingsToReport.forEach(f => {
203
203
  // matches must be in this particular order to avoid false matches, eg.
204
- // uninstallDev contains install
204
+ // uninstallDev contains install, removeOverride contains override
205
+ if (f.resolution.startsWith('removeOverride')) {
206
+ f.resolution = f.resolution.replace('removeOverride', packageManager.getPackageManagerCommand('removeOverride', this.packageManager));
207
+ return;
208
+ }
209
+ if (f.resolution.startsWith('override')) {
210
+ f.resolution = f.resolution.replace('override', packageManager.getPackageManagerCommand('override', this.packageManager));
211
+ return;
212
+ }
205
213
  if (f.resolution.startsWith('uninstallDev')) {
206
214
  f.resolution = f.resolution.replace('uninstallDev', packageManager.getPackageManagerCommand('uninstallDev', this.packageManager));
207
215
  return;
@@ -296,7 +304,9 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
296
304
  .filter((command) => command.indexOf(packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
297
305
  command.indexOf(packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
298
306
  command.indexOf(packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
299
- command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1))).join(os.EOL), os.EOL,
307
+ command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1 &&
308
+ command.indexOf(packageManager.getPackageManagerCommand('override', this.packageManager)) === -1 &&
309
+ command.indexOf(packageManager.getPackageManagerCommand('removeOverride', this.packageManager)) === -1))).join(os.EOL), os.EOL,
300
310
  os.EOL,
301
311
  Object.keys(reportData.modificationPerFile).map(file => {
302
312
  return [
@@ -356,7 +366,9 @@ ${f.resolution}
356
366
  .filter((command) => command.indexOf(packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
357
367
  command.indexOf(packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
358
368
  command.indexOf(packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
359
- command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1))).join(os.EOL), os.EOL,
369
+ command.indexOf(packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1 &&
370
+ command.indexOf(packageManager.getPackageManagerCommand('override', this.packageManager)) === -1 &&
371
+ command.indexOf(packageManager.getPackageManagerCommand('removeOverride', this.packageManager)) === -1))).join(os.EOL), os.EOL,
360
372
  '```', os.EOL,
361
373
  os.EOL,
362
374
  '### Modify files', os.EOL,
@@ -433,16 +445,19 @@ ${f.resolution}
433
445
  const packagesDepExact = [];
434
446
  const packagesDepUn = [];
435
447
  const packagesDevUn = [];
448
+ const packagesOverride = [];
449
+ const packagesOverrideRemove = [];
436
450
  findings.forEach(f => {
437
451
  if (f.resolutionType === 'cmd') {
438
- if (f.resolution.indexOf('npm') > -1 ||
439
- f.resolution.indexOf('yarn') > -1) {
452
+ if (f.resolution.indexOf('npm') > -1) {
440
453
  packageManager.mapPackageManagerCommand({
441
454
  command: f.resolution,
442
455
  packagesDevExact,
443
456
  packagesDepExact,
444
457
  packagesDepUn,
445
458
  packagesDevUn,
459
+ packagesOverride,
460
+ packagesOverrideRemove,
446
461
  packageMgr: this.packageManager
447
462
  });
448
463
  }
@@ -468,6 +483,8 @@ ${f.resolution}
468
483
  packagesDevExact,
469
484
  packagesDepUn,
470
485
  packagesDevUn,
486
+ packagesOverride,
487
+ packagesOverrideRemove,
471
488
  packageMgr: this.packageManager
472
489
  });
473
490
  if (this.packageManager === 'npm') {
@@ -31,7 +31,8 @@ class SpoApplicationCustomizerAddCommand extends SpoCommand {
31
31
  Name: args.options.title,
32
32
  Description: args.options.description,
33
33
  Location: 'ClientSideExtension.ApplicationCustomizer',
34
- ClientSideComponentId: args.options.clientSideComponentId
34
+ ClientSideComponentId: args.options.clientSideComponentId,
35
+ HostProperties: args.options.hostProperties || ''
35
36
  };
36
37
  if (args.options.clientSideComponentProperties) {
37
38
  requestBody.ClientSideComponentProperties = args.options.clientSideComponentProperties;
@@ -59,6 +60,8 @@ _a = SpoApplicationCustomizerAddCommand, _SpoApplicationCustomizerAddCommand_ins
59
60
  option: '--description [description]'
60
61
  }, {
61
62
  option: '--clientSideComponentProperties [clientSideComponentProperties]'
63
+ }, {
64
+ option: '--hostProperties [hostProperties]'
62
65
  }, {
63
66
  option: '-s, --scope [scope]', autocomplete: _a.scopes
64
67
  });
@@ -67,6 +70,7 @@ _a = SpoApplicationCustomizerAddCommand, _SpoApplicationCustomizerAddCommand_ins
67
70
  Object.assign(this.telemetryProperties, {
68
71
  description: typeof args.options.description !== 'undefined',
69
72
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
73
+ hostProperties: typeof args.options.hostProperties !== 'undefined',
70
74
  scope: typeof args.options.scope !== 'undefined'
71
75
  });
72
76
  });
@@ -89,6 +93,14 @@ _a = SpoApplicationCustomizerAddCommand, _SpoApplicationCustomizerAddCommand_ins
89
93
  return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
90
94
  }
91
95
  }
96
+ if (args.options.hostProperties) {
97
+ try {
98
+ JSON.parse(args.options.hostProperties);
99
+ }
100
+ catch (e) {
101
+ return `An error has occurred while parsing hostProperties: ${e}`;
102
+ }
103
+ }
92
104
  if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
93
105
  return `${args.options.scope} is not a valid value for allowedMembers. Valid values are ${_a.scopes.join(', ')}`;
94
106
  }
@@ -37,11 +37,13 @@ class SpoApplicationCustomizerSetCommand extends SpoCommand {
37
37
  }
38
38
  }
39
39
  async updateAppCustomizer(logger, options, appCustomizer) {
40
- const { clientSideComponentProperties, webUrl, newTitle, description } = options;
40
+ const { clientSideComponentProperties, hostProperties, webUrl, newTitle, description } = options;
41
41
  if (this.verbose) {
42
42
  await logger.logToStderr(`Updating application customizer with ID '${appCustomizer.Id}' on the site '${webUrl}'...`);
43
43
  }
44
- const requestBody = {};
44
+ const requestBody = {
45
+ HostProperties: hostProperties
46
+ };
45
47
  if (newTitle) {
46
48
  requestBody.Title = newTitle;
47
49
  }
@@ -106,6 +108,8 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
106
108
  option: '--description [description]'
107
109
  }, {
108
110
  option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
111
+ }, {
112
+ option: '--hostProperties [hostProperties]'
109
113
  }, {
110
114
  option: '-s, --scope [scope]', autocomplete: this.allowedScopes
111
115
  });
@@ -118,6 +122,7 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
118
122
  newTitle: typeof args.options.newTitle !== 'undefined',
119
123
  description: typeof args.options.description !== 'undefined',
120
124
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
125
+ hostProperties: typeof args.options.hostProperties !== 'undefined',
121
126
  scope: typeof args.options.scope !== 'undefined'
122
127
  });
123
128
  });
@@ -132,7 +137,23 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
132
137
  if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
133
138
  return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
134
139
  }
135
- if (!args.options.newTitle && args.options.description === undefined && !args.options.clientSideComponentProperties) {
140
+ if (args.options.clientSideComponentProperties) {
141
+ try {
142
+ JSON.parse(args.options.clientSideComponentProperties);
143
+ }
144
+ catch (e) {
145
+ return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
146
+ }
147
+ }
148
+ if (args.options.hostProperties) {
149
+ try {
150
+ JSON.parse(args.options.hostProperties);
151
+ }
152
+ catch (e) {
153
+ return `An error has occurred while parsing hostProperties: ${e}`;
154
+ }
155
+ }
156
+ if (!args.options.newTitle && args.options.description === undefined && !args.options.clientSideComponentProperties && args.options.hostProperties === undefined) {
136
157
  return `Please specify an option to be updated`;
137
158
  }
138
159
  return validation.isValidSharePointUrl(args.options.webUrl);
@@ -0,0 +1,59 @@
1
+ import commands from '../../commands.js';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import request from '../../../../request.js';
4
+ import { odata } from '../../../../utils/odata.js';
5
+ import { spo } from '../../../../utils/spo.js';
6
+ import SpoCommand from '../../../base/SpoCommand.js';
7
+ const options = globalOptionsZod.strict();
8
+ class SpoBrandCenterColorsListCommand extends SpoCommand {
9
+ get name() {
10
+ return commands.BRANDCENTER_COLORS_LIST;
11
+ }
12
+ get description() {
13
+ return 'Lists the brand center colors';
14
+ }
15
+ defaultProperties() {
16
+ return ['ColorCode', 'Title', 'IsVisible'];
17
+ }
18
+ get schema() {
19
+ return options;
20
+ }
21
+ async commandAction(logger) {
22
+ if (this.verbose) {
23
+ await logger.logToStderr(`Retrieving brand center colors...`);
24
+ }
25
+ try {
26
+ const spoUrl = await spo.getSpoUrl(logger, this.verbose);
27
+ const configRequestOptions = {
28
+ url: `${spoUrl}/_api/Brandcenter/Configuration`,
29
+ headers: {
30
+ accept: 'application/json;odata=nometadata'
31
+ },
32
+ responseType: 'json'
33
+ };
34
+ const config = await request.get(configRequestOptions);
35
+ if (!config.BrandColorsListUrl) {
36
+ if (this.verbose) {
37
+ await logger.logToStderr('Brand colors list not found.');
38
+ }
39
+ await logger.log([]);
40
+ return;
41
+ }
42
+ if (this.verbose) {
43
+ await logger.logToStderr(`Brand colors list found at '${config.BrandColorsListUrl.DecodedUrl}'.`);
44
+ }
45
+ const items = await odata.getAllItems(`${config.SiteUrl}/_api/web/lists(guid'${config.BrandColorsListId}')/items?$select=OData__SPColorTitle,OData__SPColorCode,OData__SPColorVisible`);
46
+ const result = items.map(item => ({
47
+ Title: item.OData__SPColorTitle,
48
+ ColorCode: item.OData__SPColorCode,
49
+ IsVisible: item.OData__SPColorVisible
50
+ }));
51
+ await logger.log(result);
52
+ }
53
+ catch (err) {
54
+ this.handleRejectedODataJsonPromise(err);
55
+ }
56
+ }
57
+ }
58
+ export default new SpoBrandCenterColorsListCommand();
59
+ //# sourceMappingURL=brandcenter-colors-list.js.map
@@ -0,0 +1,83 @@
1
+ import commands from '../../commands.js';
2
+ import SpoCommand from '../../../base/SpoCommand.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import { z } from 'zod';
5
+ import { validation } from '../../../../utils/validation.js';
6
+ import { cli } from '../../../../cli/cli.js';
7
+ import { urlUtil } from '../../../../utils/urlUtil.js';
8
+ import request from '../../../../request.js';
9
+ import { formatting } from '../../../../utils/formatting.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ webUrl: z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
14
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
15
+ })
16
+ .alias('u'),
17
+ url: z.string().optional(),
18
+ id: z.uuid().optional().alias('i'),
19
+ force: z.boolean().optional().alias('f')
20
+ });
21
+ class SpoFileArchiveCommand extends SpoCommand {
22
+ get name() {
23
+ return commands.FILE_ARCHIVE;
24
+ }
25
+ get description() {
26
+ return 'Archives a file';
27
+ }
28
+ get schema() {
29
+ return options;
30
+ }
31
+ getRefinedSchema(schema) {
32
+ return schema
33
+ .refine(options => [options.url, options.id].filter(o => o !== undefined).length === 1, {
34
+ error: `Specify 'url' or 'id', but not both.`
35
+ });
36
+ }
37
+ getExcludedOptionsWithUrls() {
38
+ return ['url'];
39
+ }
40
+ async commandAction(logger, args) {
41
+ const { webUrl, url, id, force, verbose } = args.options;
42
+ if (!force) {
43
+ const result = await cli.promptForConfirmation({ message: `Are you sure you would like to archive this item? You will be able to reactivate it instantly for the first 7 days. After that, it will take up to 24 hours to reactivate.` });
44
+ if (!result) {
45
+ return;
46
+ }
47
+ }
48
+ try {
49
+ if (verbose) {
50
+ await logger.logToStderr(`Archiving file ${url || id} at site ${webUrl}...`);
51
+ }
52
+ let requestUrl = `${webUrl}/_api/web`;
53
+ if (id) {
54
+ requestUrl += `/GetFileById('${formatting.encodeQueryParameter(id)}')`;
55
+ }
56
+ else if (url) {
57
+ const serverRelativePath = urlUtil.getServerRelativePath(webUrl, url);
58
+ requestUrl += `/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')`;
59
+ }
60
+ requestUrl += '?$select=ListId,ListItemAllFields/Id&$expand=ListItemAllFields';
61
+ const fileInfo = await request.get({
62
+ url: requestUrl,
63
+ headers: {
64
+ accept: 'application/json;odata=nometadata'
65
+ },
66
+ responseType: 'json'
67
+ });
68
+ const requestOptions = {
69
+ url: `${webUrl}/_api/Lists(guid'${fileInfo.ListId}')/items(${fileInfo.ListItemAllFields.Id})/Archive`,
70
+ headers: {
71
+ accept: 'application/json;odata=nometadata'
72
+ },
73
+ responseType: 'json'
74
+ };
75
+ await request.post(requestOptions);
76
+ }
77
+ catch (err) {
78
+ this.handleRejectedODataJsonPromise(err);
79
+ }
80
+ }
81
+ }
82
+ export default new SpoFileArchiveCommand();
83
+ //# sourceMappingURL=file-archive.js.map
@@ -28,12 +28,6 @@ class SpoPropertyBagSetCommand extends SpoPropertyBagBaseCommand {
28
28
  this.formDigestValue = contextResponse.FormDigestValue;
29
29
  let identityResp = await spo.getCurrentWebIdentity(args.options.webUrl, this.formDigestValue);
30
30
  const webIdentityResp = identityResp;
31
- // Check if web no script enabled or not
32
- // Cannot set property bag value if no script is enabled
33
- const isNoScriptSite = await this.isNoScriptSite(identityResp, args.options, logger);
34
- if (isNoScriptSite) {
35
- throw 'Site has NoScript enabled, and setting property bag values is not supported';
36
- }
37
31
  const opts = args.options;
38
32
  if (opts.folder) {
39
33
  // get the folder guid instead of the web guid
@@ -42,15 +36,15 @@ class SpoPropertyBagSetCommand extends SpoPropertyBagBaseCommand {
42
36
  await this.setProperty(identityResp, args.options, logger);
43
37
  }
44
38
  catch (err) {
39
+ if (err.toString().indexOf('E_ACCESSDENIED') > -1) {
40
+ await logger.logToStderr('Tip: If a site has NoScript enabled, setting the property bag value may result in exceptions.');
41
+ }
45
42
  this.handleRejectedPromise(err);
46
43
  }
47
44
  }
48
45
  setProperty(identityResp, options, logger) {
49
46
  return SpoPropertyBagBaseCommand.setProperty(options.key, options.value, options.webUrl, this.formDigestValue, identityResp, logger, this.debug, options.folder);
50
47
  }
51
- isNoScriptSite(webIdentityResp, options, logger) {
52
- return SpoPropertyBagBaseCommand.isNoScriptSite(options.webUrl, this.formDigestValue, webIdentityResp, logger, this.debug);
53
- }
54
48
  }
55
49
  _SpoPropertyBagSetCommand_instances = new WeakSet(), _SpoPropertyBagSetCommand_initTelemetry = function _SpoPropertyBagSetCommand_initTelemetry() {
56
50
  this.telemetry.push((args) => {
@@ -120,6 +120,7 @@ class SpoTenantApplicationCustomizerAddCommand extends SpoCommand {
120
120
  TenantWideExtensionSequence: 0,
121
121
  TenantWideExtensionListTemplate: 0,
122
122
  TenantWideExtensionComponentProperties: options.clientSideComponentProperties || '',
123
+ TenantWideExtensionHostProperties: options.hostProperties || '',
123
124
  TenantWideExtensionWebTemplate: options.webTemplate || '',
124
125
  TenantWideExtensionDisabled: false,
125
126
  verbose: this.verbose,
@@ -133,6 +134,7 @@ _SpoTenantApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoTenantA
133
134
  this.telemetry.push((args) => {
134
135
  Object.assign(this.telemetryProperties, {
135
136
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
137
+ hostProperties: typeof args.options.hostProperties !== 'undefined',
136
138
  webTemplate: typeof args.options.webTemplate !== 'undefined'
137
139
  });
138
140
  });
@@ -143,6 +145,8 @@ _SpoTenantApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoTenantA
143
145
  option: '-i, --clientSideComponentId <clientSideComponentId>'
144
146
  }, {
145
147
  option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
148
+ }, {
149
+ option: '--hostProperties [hostProperties]'
146
150
  }, {
147
151
  option: '-w, --webTemplate [webTemplate]'
148
152
  });
@@ -151,6 +155,22 @@ _SpoTenantApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoTenantA
151
155
  if (!validation.isValidGuid(args.options.clientSideComponentId)) {
152
156
  return `${args.options.clientSideComponentId} is not a valid GUID`;
153
157
  }
158
+ if (args.options.clientSideComponentProperties) {
159
+ try {
160
+ JSON.parse(args.options.clientSideComponentProperties);
161
+ }
162
+ catch (e) {
163
+ return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
164
+ }
165
+ }
166
+ if (args.options.hostProperties) {
167
+ try {
168
+ JSON.parse(args.options.hostProperties);
169
+ }
170
+ catch (e) {
171
+ return `An error has occurred while parsing hostProperties: ${e}`;
172
+ }
173
+ }
154
174
  return true;
155
175
  });
156
176
  };
@@ -121,7 +121,7 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
121
121
  return outputParsed[0];
122
122
  }
123
123
  async updateTenantWideExtension(appCatalogUrl, options, listServerRelativeUrl, itemId, logger) {
124
- const { title, id, clientSideComponentId, newTitle, newClientSideComponentId, clientSideComponentProperties, webTemplate } = options;
124
+ const { title, id, clientSideComponentId, newTitle, newClientSideComponentId, clientSideComponentProperties, hostProperties, webTemplate } = options;
125
125
  if (this.verbose) {
126
126
  await logger.logToStderr(`Updating tenant-wide application customizer: "${title || id || clientSideComponentId}"...`);
127
127
  }
@@ -144,6 +144,12 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
144
144
  FieldValue: clientSideComponentProperties
145
145
  });
146
146
  }
147
+ if (hostProperties !== undefined) {
148
+ formValues.push({
149
+ FieldName: 'TenantWideExtensionHostProperties',
150
+ FieldValue: hostProperties
151
+ });
152
+ }
147
153
  if (webTemplate !== undefined) {
148
154
  formValues.push({
149
155
  FieldName: 'TenantWideExtensionWebTemplate',
@@ -172,6 +178,7 @@ _SpoTenantApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoTenantA
172
178
  newTitle: typeof args.options.newTitle !== 'undefined',
173
179
  newClientSideComponentId: typeof args.options.newClientSideComponentId !== 'undefined',
174
180
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
181
+ hostProperties: typeof args.options.hostProperties !== 'undefined',
175
182
  webTemplate: typeof args.options.webTemplate !== 'undefined'
176
183
  });
177
184
  });
@@ -188,6 +195,8 @@ _SpoTenantApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoTenantA
188
195
  option: '--newClientSideComponentId [newClientSideComponentId]'
189
196
  }, {
190
197
  option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
198
+ }, {
199
+ option: '--hostProperties [hostProperties]'
191
200
  }, {
192
201
  option: '-w, --webTemplate [webTemplate]'
193
202
  });
@@ -202,7 +211,23 @@ _SpoTenantApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoTenantA
202
211
  if (args.options.newClientSideComponentId && !validation.isValidGuid(args.options.newClientSideComponentId)) {
203
212
  return `${args.options.newClientSideComponentId} is not a valid GUID`;
204
213
  }
205
- if (!args.options.newTitle && !args.options.newClientSideComponentId && !args.options.clientSideComponentProperties && !args.options.webTemplate) {
214
+ if (args.options.clientSideComponentProperties) {
215
+ try {
216
+ JSON.parse(args.options.clientSideComponentProperties);
217
+ }
218
+ catch (e) {
219
+ return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
220
+ }
221
+ }
222
+ if (args.options.hostProperties) {
223
+ try {
224
+ JSON.parse(args.options.hostProperties);
225
+ }
226
+ catch (e) {
227
+ return `An error has occurred while parsing hostProperties: ${e}`;
228
+ }
229
+ }
230
+ if (!args.options.newTitle && !args.options.newClientSideComponentId && !args.options.clientSideComponentProperties && args.options.hostProperties === undefined && !args.options.webTemplate) {
206
231
  return `Please specify an option to be updated`;
207
232
  }
208
233
  return true;
@@ -414,6 +414,9 @@ _a = SpoTenantSettingsSetCommand, _SpoTenantSettingsSetCommand_instances = new W
414
414
  }, {
415
415
  option: '--SyncAadB2BManagementPolicy [SyncAadB2BManagementPolicy]',
416
416
  autocomplete: ['true', 'false']
417
+ }, {
418
+ option: '--AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled [AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled]',
419
+ autocomplete: ['true', 'false']
417
420
  });
418
421
  }, _SpoTenantSettingsSetCommand_initValidators = function _SpoTenantSettingsSetCommand_initValidators() {
419
422
  this.validators.push(async (args) => {
@@ -496,7 +499,8 @@ SpoTenantSettingsSetCommand.booleanOptions = [
496
499
  'DisableCustomAppAuthentication',
497
500
  'CommentsOnListItemsDisabled',
498
501
  'EnableAzureADB2BIntegration',
499
- 'SyncAadB2BManagementPolicy'
502
+ 'SyncAadB2BManagementPolicy',
503
+ 'AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled'
500
504
  ];
501
505
  export default new SpoTenantSettingsSetCommand();
502
506
  //# sourceMappingURL=tenant-settings-set.js.map
@@ -19,6 +19,7 @@ export default {
19
19
  APPLICATIONCUSTOMIZER_SET: `${prefix} applicationcustomizer set`,
20
20
  APPPAGE_ADD: `${prefix} apppage add`,
21
21
  APPPAGE_SET: `${prefix} apppage set`,
22
+ BRANDCENTER_COLORS_LIST: `${prefix} brandcenter colors list`,
22
23
  BRANDCENTER_SETTINGS_LIST: `${prefix} brandcenter settings list`,
23
24
  CDN_GET: `${prefix} cdn get`,
24
25
  CDN_ORIGIN_ADD: `${prefix} cdn origin add`,
@@ -61,6 +62,7 @@ export default {
61
62
  FIELD_REMOVE: `${prefix} field remove`,
62
63
  FIELD_SET: `${prefix} field set`,
63
64
  FILE_ADD: `${prefix} file add`,
65
+ FILE_ARCHIVE: `${prefix} file archive`,
64
66
  FILE_CHECKIN: `${prefix} file checkin`,
65
67
  FILE_CHECKOUT: `${prefix} file checkout`,
66
68
  FILE_CHECKOUT_UNDO: `${prefix} file checkout undo`,
package/dist/request.js CHANGED
@@ -34,7 +34,7 @@ class Request {
34
34
  await this._logger.logToStderr('Response:');
35
35
  const properties = ['status', 'statusText', 'headers'];
36
36
  if (response.headers['content-type'] &&
37
- response.headers['content-type'].indexOf('json') > -1) {
37
+ response.headers['content-type'].toString().indexOf('json') > -1) {
38
38
  properties.push('data');
39
39
  }
40
40
  await this._logger.logToStderr(JSON.stringify({
@@ -154,10 +154,6 @@ class Request {
154
154
  options.headers.authorization = `Bearer ${accessToken}`;
155
155
  }
156
156
  }
157
- const proxyUrl = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
158
- if (proxyUrl) {
159
- options.proxy = this.createProxyConfigFromUrl(proxyUrl);
160
- }
161
157
  const res = await this.req(options);
162
158
  const end = process.hrtime.bigint();
163
159
  timings.api.push(Number(end - start));
@@ -192,18 +188,6 @@ class Request {
192
188
  options.url = options.url.substring(0, 8) +
193
189
  options.url.substring(8).replace('//', '/');
194
190
  }
195
- createProxyConfigFromUrl(url) {
196
- const parsedUrl = new URL(url);
197
- const port = parsedUrl.port || (url.toLowerCase().startsWith('https') ? 443 : 80);
198
- let authObject = null;
199
- if (parsedUrl.username && parsedUrl.password) {
200
- authObject = {
201
- username: parsedUrl.username,
202
- password: parsedUrl.password
203
- };
204
- }
205
- return { host: parsedUrl.hostname, port: Number(port), protocol: 'http', ...(authObject && { auth: authObject }) };
206
- }
207
191
  }
208
192
  export default new Request();
209
193
  //# sourceMappingURL=request.js.map
@@ -3,28 +3,41 @@ const packageCommands = {
3
3
  install: 'npm i -SE',
4
4
  installDev: 'npm i -DE',
5
5
  uninstall: 'npm un -S',
6
- uninstallDev: 'npm un -D'
6
+ uninstallDev: 'npm un -D',
7
+ override: 'npm pkg set',
8
+ removeOverride: 'npm pkg delete'
7
9
  },
8
10
  pnpm: {
9
11
  install: 'pnpm i -E',
10
12
  installDev: 'pnpm i -DE',
11
13
  uninstall: 'pnpm un',
12
- uninstallDev: 'pnpm un'
14
+ uninstallDev: 'pnpm un',
15
+ override: 'pnpm pkg set',
16
+ removeOverride: 'pnpm pkg delete'
13
17
  },
14
18
  yarn: {
15
19
  install: 'yarn add -E',
16
20
  installDev: 'yarn add -DE',
17
21
  uninstall: 'yarn remove',
18
22
  uninstallDev: 'yarn remove'
23
+ // Yarn is not supported for project upgrade since their CLI does not support setting overrides.
19
24
  }
20
25
  };
21
26
  export const packageManager = {
22
27
  getPackageManagerCommand(command, packageManager) {
23
28
  return packageCommands[packageManager][command];
24
29
  },
25
- mapPackageManagerCommand({ command, packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packageMgr }) {
30
+ mapPackageManagerCommand({ command, packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packagesOverride, packagesOverrideRemove, packageMgr }) {
26
31
  // matches must be in this particular order to avoid false matches, eg.
27
- // uninstallDev contains install
32
+ // uninstallDev contains install, removeOverride contains override
33
+ if (command.startsWith(`${packageManager.getPackageManagerCommand('removeOverride', packageMgr)} `)) {
34
+ packagesOverrideRemove.push(command.replace(packageManager.getPackageManagerCommand('removeOverride', packageMgr), '').trim());
35
+ return;
36
+ }
37
+ if (command.startsWith(`${packageManager.getPackageManagerCommand('override', packageMgr)} `)) {
38
+ packagesOverride.push(command.replace(packageManager.getPackageManagerCommand('override', packageMgr), '').trim());
39
+ return;
40
+ }
28
41
  if (command.startsWith(`${packageManager.getPackageManagerCommand('uninstallDev', packageMgr)} `)) {
29
42
  packagesDevUn.push(command.replace(packageManager.getPackageManagerCommand('uninstallDev', packageMgr), '').trim());
30
43
  return;
@@ -41,10 +54,19 @@ export const packageManager = {
41
54
  packagesDepExact.push(command.replace(packageManager.getPackageManagerCommand('install', packageMgr), '').trim());
42
55
  }
43
56
  },
44
- reducePackageManagerCommand({ packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packageMgr }) {
57
+ reducePackageManagerCommand({ packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn, packagesOverride, packagesOverrideRemove, packageMgr }) {
45
58
  const commandsToExecute = [];
46
- // uninstall commands must come first otherwise there is a chance that
47
- // whatever we recommended to install, will be immediately uninstalled
59
+ // override commands must come first to ensure that install/uninstall operations
60
+ // use the correct package version when an override is added or removed for a
61
+ // package that is being updated, installed, or uninstalled
62
+ // uninstall commands must come before install commands otherwise there is a
63
+ // chance that whatever we recommended to install will be immediately uninstalled
64
+ if (packagesOverrideRemove.length > 0) {
65
+ commandsToExecute.push(`${packageManager.getPackageManagerCommand('removeOverride', packageMgr)} ${packagesOverrideRemove.join(' ')}`);
66
+ }
67
+ if (packagesOverride.length > 0) {
68
+ commandsToExecute.push(`${packageManager.getPackageManagerCommand('override', packageMgr)} ${packagesOverride.join(' ')}`);
69
+ }
48
70
  if (packagesDepUn.length > 0) {
49
71
  commandsToExecute.push(`${packageManager.getPackageManagerCommand('uninstall', packageMgr)} ${packagesDepUn.join(' ')}`);
50
72
  }